Index: src/sys/net/if.c =================================================================== RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.146 diff -u -r1.146 if.c --- src/sys/net/if.c 2006/03/22 14:37:44 1.146 +++ src/sys/net/if.c 2006/04/19 10:01:55 @@ -143,7 +143,10 @@ void if_congestion_clear(void *); int if_group_egress_build(void); +int in_markdown(struct radix_node *, void *); +int in_markup(struct radix_node *, void *); + TAILQ_HEAD(, ifg_group) ifg_head; LIST_HEAD(, if_clone) if_cloners = LIST_HEAD_INITIALIZER(if_cloners); int if_cloners_count; @@ -1007,6 +1010,38 @@ } } +int in_markup(rn, vifp) + struct radix_node *rn; + void *vifp; +{ + struct ifnet *ifp = vifp; + struct rtentry *rt = (struct rtentry *)rn; + int s = splsoftnet(); + + if (rt->rt_ifp == ifp) + rt->rt_flags |= RTF_UP; + + splx(s); + + return (0); +} + +int in_markdown(rn, vifp) + struct radix_node *rn; + void *vifp; +{ + struct ifnet *ifp = vifp; + struct rtentry *rt = (struct rtentry *)rn; + int s = splsoftnet(); + + if (rt->rt_ifp == ifp) + rt->rt_flags &= ~RTF_UP; + + splx(s); + + return (0); +} + /* * Mark an interface down and notify protocols of * the transition. @@ -1015,6 +1050,7 @@ void if_down(struct ifnet *ifp) { + struct radix_node_head *rnh; struct ifaddr *ifa; splassert(IPL_SOFTNET); @@ -1029,6 +1065,12 @@ if (ifp->if_carp) carp_carpdev_state(ifp); #endif + rnh = rt_gettable(AF_INET, 0); + if (rnh) + while ((*rnh->rnh_walktree)(rnh, + in_markdown, ifp) == EAGAIN) + ; + rt_ifmsg(ifp); } @@ -1040,6 +1082,7 @@ void if_up(struct ifnet *ifp) { + struct radix_node_head *rnh; #ifdef notyet struct ifaddr *ifa; #endif @@ -1058,6 +1101,12 @@ if (ifp->if_carp) carp_carpdev_state(ifp); #endif + rnh = rt_gettable(AF_INET, 0); + if (rnh) + while ((*rnh->rnh_walktree)(rnh, + in_markup, ifp) == EAGAIN) + ; + rt_ifmsg(ifp); #ifdef INET6 in6_if_up(ifp); Index: src/sys/netinet/in.c =================================================================== RCS file: /cvs/src/sys/netinet/in.c,v retrieving revision 1.44 diff -u -r1.44 in.c --- src/sys/netinet/in.c 2006/03/05 21:48:56 1.44 +++ src/sys/netinet/in.c 2006/04/19 10:02:27 @@ -89,7 +89,11 @@ static int in_addprefix(struct in_ifaddr *, int); static int in_scrubprefix(struct in_ifaddr *); +static int in_scrubroute(struct radix_node *, void *); +int rtdeletemsg(struct rtentry *); +extern struct radix_node_head *rt_tables[AF_MAX+1]; + #ifndef SUBNETSARELOCAL #define SUBNETSARELOCAL 0 #endif @@ -659,8 +663,15 @@ struct ifnet *ifp; struct in_ifaddr *ia; { + struct radix_node_head *rnh; in_scrubprefix(ia); + + rnh = rt_gettable(AF_INET, 0); + if (rnh) + while ((*rnh->rnh_walktree)(rnh, + in_scrubroute, ia) == EAGAIN) + ; } /* @@ -871,6 +882,22 @@ } #undef rtinitflags + +static int +in_scrubroute(rn, vifp) + struct radix_node *rn; + void *vifp; +{ + struct in_ifaddr *ia = vifp; + struct rtentry *rt = (struct rtentry *)rn; + int error; + + if (rt->rt_ifp == ia->ia_ifp) + error = rtdeletemsg(rt); + + return (error); +} + /* * Return 1 if the address might be a local broadcast address.