Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet PR/15662: Sean Boudreau: make sure we clean all ...
details: https://anonhg.NetBSD.org/src/rev/47fb1e4aa373
branches: trunk
changeset: 522575:47fb1e4aa373
user: christos <christos%NetBSD.org@localhost>
date: Thu Feb 21 21:59:16 2002 +0000
description:
PR/15662: Sean Boudreau: make sure we clean all routes of an interface when
we change its ip address.
diffstat:
sys/netinet/in.c | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diffs (80 lines):
diff -r 89d4ad1859bb -r 47fb1e4aa373 sys/netinet/in.c
--- a/sys/netinet/in.c Thu Feb 21 21:58:00 2002 +0000
+++ b/sys/netinet/in.c Thu Feb 21 21:59:16 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in.c,v 1.71 2001/11/13 00:32:35 lukem Exp $ */
+/* $NetBSD: in.c,v 1.72 2002/02/21 21:59:16 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.71 2001/11/13 00:32:35 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.72 2002/02/21 21:59:16 christos Exp $");
#include "opt_inet.h"
#include "opt_inet_conf.h"
@@ -116,6 +116,7 @@
#include <sys/socketvar.h>
#include <sys/systm.h>
#include <sys/proc.h>
+#include <sys/syslog.h>
#include <net/if.h>
#include <net/route.h>
@@ -135,6 +136,7 @@
static void in_len2mask __P((struct in_addr *, int));
static int in_lifaddr_ioctl __P((struct socket *, u_long, caddr_t,
struct ifnet *, struct proc *));
+static int in_rt_walktree __P((struct radix_node *, void *));
static int in_addprefix __P((struct in_ifaddr *, int));
static int in_scrubprefix __P((struct in_ifaddr *));
@@ -539,12 +541,34 @@
return (0);
}
+static int
+in_rt_walktree(rn, v)
+ struct radix_node *rn;
+ void *v;
+{
+ struct in_ifaddr *ia = (struct in_ifaddr *)v;
+ struct rtentry *rt = (struct rtentry *)rn;
+ int error;
+
+ if (rt->rt_ifa == &ia->ia_ifa) {
+ if ((error = rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway,
+ rt_mask(rt), rt->rt_flags, NULL)) != 0) {
+ log(LOG_WARNING, "ifa_rt_walktree: unable to delete "
+ "rtentry. error= %d", error);
+ } else {
+ IFAFREE(&ia->ia_ifa);
+ }
+ }
+ return 0;
+}
+
void
in_purgeaddr(ifa, ifp)
struct ifaddr *ifa;
struct ifnet *ifp;
{
struct in_ifaddr *ia = (void *) ifa;
+ struct radix_node_head *rnh;
in_ifscrub(ifp, ia);
LIST_REMOVE(ia, ia_hash);
@@ -561,6 +585,10 @@
ifp->if_output != if_nulloutput)
in_savemkludge(ia);
IFAFREE(&ia->ia_ifa);
+
+ if ((rnh = rt_tables[AF_INET]) != NULL)
+ (*rnh->rnh_walktree)(rnh, in_rt_walktree, ifa);
+
in_setmaxmtu();
}
Home |
Main Index |
Thread Index |
Old Index