Date: Tue, 30 Oct 2007 04:31:18 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 128319 for review Message-ID: <200710300431.l9U4VIw8005684@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=128319 Change 128319 by kmacy@kmacy:storage:toestack on 2007/10/30 04:30:42 change route_eventhandler to take 2 rtentry arguments for redirect updates Affected files ... .. //depot/projects/toestack/sys/net/route.c#6 edit .. //depot/projects/toestack/sys/net/route.h#6 edit .. //depot/projects/toestack/sys/netinet/if_ether.c#8 edit .. //depot/projects/toestack/sys/netinet/ip_icmp.c#5 edit Differences ... ==== //depot/projects/toestack/sys/net/route.c#6 (text+ko) ==== @@ -442,7 +442,7 @@ int flags, struct sockaddr *src) { - struct rtentry *rt; + struct rtentry *rt, *rt0 = NULL; int error = 0; short *stat = NULL; struct rt_addrinfo info; @@ -486,8 +486,8 @@ * Create new route, rather than smashing route to net. */ create: - if (rt) - rtfree(rt); + rt0 = rt; + flags |= RTF_GATEWAY | RTF_DYNAMIC; bzero((caddr_t)&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; @@ -500,9 +500,12 @@ error = rtrequest1(RTM_ADD, &info, &rt); if (rt != NULL) { RT_LOCK(rt); - EVENTHANDLER_INVOKE(route_event, RTEVENT_REDIRECT_UPDATE, rt); + EVENTHANDLER_INVOKE(route_event, RTEVENT_REDIRECT_UPDATE, rt0, rt); flags = rt->rt_flags; } + if (rt0) + RTFREE_LOCKED(rt0); + stat = &rtstat.rts_dynamic; } else { /* @@ -516,7 +519,7 @@ * add the key and gateway (in one malloc'd chunk). */ rt_setgate(rt, rt_key(rt), gateway); - EVENTHANDLER_INVOKE(route_event, RTEVENT_REDIRECT_UPDATE, rt); + EVENTHANDLER_INVOKE(route_event, RTEVENT_REDIRECT_UPDATE, rt, gateway); } } else error = EHOSTUNREACH; ==== //depot/projects/toestack/sys/net/route.h#6 (text+ko) ==== @@ -370,7 +370,7 @@ #define RTEVENT_ARP_UPDATE 1 #define RTEVENT_PMTU_UPDATE 2 #define RTEVENT_REDIRECT_UPDATE 3 -typedef void (*rtevent_fn)(void *, int, struct rtentry *); +typedef void (*rtevent_fn)(void *, int, struct rtentry *, struct rtentry *); EVENTHANDLER_DECLARE(route_event, rtevent_fn); ==== //depot/projects/toestack/sys/netinet/if_ether.c#8 (text+ko) ==== @@ -415,7 +415,7 @@ sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) { bcopy(LLADDR(sdl), desten, sdl->sdl_alen); - EVENTHANDLER_INVOKE(route_event, RTEVENT_ARP_UPDATE, rt); + EVENTHANDLER_INVOKE(route_event, RTEVENT_ARP_UPDATE, rt, NULL); /* * If entry has an expiry time and it is approaching, ==== //depot/projects/toestack/sys/netinet/ip_icmp.c#5 (text+ko) ==== @@ -154,7 +154,7 @@ #endif if (mtu >= 296 && rt->rt_rmx.rmx_mtu > mtu) { rt->rt_rmx.rmx_mtu = mtu; - EVENTHANDLER_INVOKE(route_event, RTEVENT_PMTU_UPDATE, rt); + EVENTHANDLER_INVOKE(route_event, RTEVENT_PMTU_UPDATE, rt, NULL); } } if (rt)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710300431.l9U4VIw8005684>