Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Fix usage of routing messages on arp -d and ndp -d
details: https://anonhg.NetBSD.org/src/rev/4ccc0f1e6220
branches: trunk
changeset: 824999:4ccc0f1e6220
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Jun 26 03:13:40 2017 +0000
description:
Fix usage of routing messages on arp -d and ndp -d
It didn't work as we expected; we should set RTA_GATEWAY not
RTA_IFP on RTM_GET to return an if_index and the kernel should
use it on RTM_DELETE.
diffstat:
sys/net/rtsock.c | 8 +++++---
tests/net/arp/t_arp.sh | 10 +++++-----
tests/net/ndp/t_ndp.sh | 10 +++++-----
usr.sbin/arp/arp.c | 6 +++---
usr.sbin/ndp/ndp.c | 4 ++--
5 files changed, 20 insertions(+), 18 deletions(-)
diffs (133 lines):
diff -r d4660c19ee4e -r 4ccc0f1e6220 sys/net/rtsock.c
--- a/sys/net/rtsock.c Sun Jun 25 22:16:46 2017 +0000
+++ b/sys/net/rtsock.c Mon Jun 26 03:13:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock.c,v 1.219 2017/06/23 05:46:10 ozaki-r Exp $ */
+/* $NetBSD: rtsock.c,v 1.220 2017/06/26 03:13:40 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.219 2017/06/23 05:46:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.220 2017/06/26 03:13:40 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -856,8 +856,10 @@
if (info.rti_info[RTAX_GATEWAY] &&
(info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) &&
(rtm->rtm_flags & RTF_LLDATA) != 0) {
+ const struct sockaddr_dl *sdlp =
+ satocsdl(info.rti_info[RTAX_GATEWAY]);
error = lla_rt_output(rtm->rtm_type, rtm->rtm_flags,
- rtm->rtm_rmx.rmx_expire, &info, 0);
+ rtm->rtm_rmx.rmx_expire, &info, sdlp->sdl_index);
break;
}
#endif /* INET */
diff -r d4660c19ee4e -r 4ccc0f1e6220 tests/net/arp/t_arp.sh
--- a/tests/net/arp/t_arp.sh Sun Jun 25 22:16:46 2017 +0000
+++ b/tests/net/arp/t_arp.sh Mon Jun 26 03:13:40 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_arp.sh,v 1.27 2017/06/22 10:06:33 ozaki-r Exp $
+# $NetBSD: t_arp.sh,v 1.28 2017/06/26 03:13:40 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -647,15 +647,15 @@
str="RTM_GET.+<UP,DONE,LLINFO>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
- str="<DST,GATEWAY,IFP,IFA>"
+ str="<DST,GATEWAY>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
- str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
+ str="$IP4DST $macaddr_dst"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
str="RTM_DELETE.+<UP,DONE,LLINFO>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
- str="<DST,GATEWAY,IFP,IFA>"
+ str="<DST,GATEWAY>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
- str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
+ str="$IP4DST $macaddr_dst"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
rump_server_destroy_ifaces
diff -r d4660c19ee4e -r 4ccc0f1e6220 tests/net/ndp/t_ndp.sh
--- a/tests/net/ndp/t_ndp.sh Sun Jun 25 22:16:46 2017 +0000
+++ b/tests/net/ndp/t_ndp.sh Mon Jun 26 03:13:40 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ndp.sh,v 1.24 2017/06/22 10:06:34 ozaki-r Exp $
+# $NetBSD: t_ndp.sh,v 1.25 2017/06/26 03:13:40 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -446,15 +446,15 @@
str="RTM_GET.+<UP,DONE,LLINFO>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
- str="<DST,GATEWAY,IFP,IFA>"
+ str="<DST,GATEWAY>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
- str="$IP6DST $macaddr_dst $macaddr_src $IP6SRC"
+ str="$IP6DST $macaddr_dst"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
str="RTM_DELETE.+<UP,DONE,LLINFO>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
- str="<DST,GATEWAY,IFP,IFA>"
+ str="<DST,GATEWAY>"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
- str="$IP6DST $macaddr_dst $macaddr_src $IP6SRC"
+ str="$IP6DST $macaddr_dst"
atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
rump_server_destroy_ifaces
diff -r d4660c19ee4e -r 4ccc0f1e6220 usr.sbin/arp/arp.c
--- a/usr.sbin/arp/arp.c Sun Jun 25 22:16:46 2017 +0000
+++ b/usr.sbin/arp/arp.c Mon Jun 26 03:13:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arp.c,v 1.56 2017/06/06 19:59:10 ryo Exp $ */
+/* $NetBSD: arp.c,v 1.57 2017/06/26 03:13:40 ozaki-r Exp $ */
/*
* Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)arp.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: arp.c,v 1.56 2017/06/06 19:59:10 ryo Exp $");
+__RCSID("$NetBSD: arp.c,v 1.57 2017/06/26 03:13:40 ozaki-r Exp $");
#endif
#endif /* not lint */
@@ -660,7 +660,7 @@
break;
case RTM_GET:
rtm->rtm_flags |= RTF_LLDATA;
- rtm->rtm_addrs |= RTA_DST | RTA_IFP;
+ rtm->rtm_addrs |= RTA_DST | RTA_GATEWAY;
}
#define NEXTADDR(w, s) \
diff -r d4660c19ee4e -r 4ccc0f1e6220 usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c Sun Jun 25 22:16:46 2017 +0000
+++ b/usr.sbin/ndp/ndp.c Mon Jun 26 03:13:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ndp.c,v 1.48 2016/09/19 19:13:14 christos Exp $ */
+/* $NetBSD: ndp.c,v 1.49 2017/06/26 03:13:40 ozaki-r Exp $ */
/* $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $ */
/*
@@ -813,7 +813,7 @@
break;
case RTM_GET:
rtm->rtm_flags |= RTF_LLDATA;
- rtm->rtm_addrs |= RTA_DST | RTA_IFP;
+ rtm->rtm_addrs |= RTA_DST | RTA_GATEWAY;
}
#define NEXTADDR(w, s) \
if (rtm->rtm_addrs & (w)) { \
Home |
Main Index |
Thread Index |
Old Index