Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Don't add local routes for the any address or p2p addres...
details: https://anonhg.NetBSD.org/src/rev/918ac68a1d43
branches: trunk
changeset: 336345:918ac68a1d43
user: roy <roy%NetBSD.org@localhost>
date: Thu Feb 26 12:58:36 2015 +0000
description:
Don't add local routes for the any address or p2p addresses where the address matches the destination.
diffstat:
sys/netinet/in.c | 14 ++++++++++++--
sys/netinet6/in6.c | 12 ++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)
diffs (68 lines):
diff -r 07c3de1d1e97 -r 918ac68a1d43 sys/netinet/in.c
--- a/sys/netinet/in.c Thu Feb 26 10:31:52 2015 +0000
+++ b/sys/netinet/in.c Thu Feb 26 12:58:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in.c,v 1.150 2015/02/26 09:54:46 roy Exp $ */
+/* $NetBSD: in.c,v 1.151 2015/02/26 12:58:36 roy Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.150 2015/02/26 09:54:46 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.151 2015/02/26 12:58:36 roy Exp $");
#include "opt_inet.h"
#include "opt_inet_conf.h"
@@ -606,6 +606,16 @@
static void
in_ifaddlocal(struct ifaddr *ifa)
{
+ struct in_ifaddr *ia;
+
+ ia = (struct in_ifaddr *)ifa;
+ if (ia->ia_addr.sin_addr.s_addr == INADDR_ANY ||
+ (ia->ia_ifp->if_flags & IFF_POINTOPOINT &&
+ in_hosteq(ia->ia_dstaddr.sin_addr, ia->ia_addr.sin_addr)))
+ {
+ rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
+ return;
+ }
rt_ifa_addlocal(ifa);
}
diff -r 07c3de1d1e97 -r 918ac68a1d43 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Thu Feb 26 10:31:52 2015 +0000
+++ b/sys/netinet6/in6.c Thu Feb 26 12:58:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.c,v 1.184 2015/02/26 09:54:46 roy Exp $ */
+/* $NetBSD: in6.c,v 1.185 2015/02/26 12:58:36 roy Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.184 2015/02/26 09:54:46 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.185 2015/02/26 12:58:36 roy Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@@ -155,6 +155,14 @@
in6_ifaddlocal(struct ifaddr *ifa)
{
+ if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &in6addr_any) ||
+ (ifa->ifa_ifp->if_flags & IFF_POINTOPOINT &&
+ IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), IFA_DSTIN6(ifa))))
+ {
+ rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
+ return;
+ }
+
rt_ifa_addlocal(ifa);
}
Home |
Main Index |
Thread Index |
Old Index