diff options
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 1ff5b2b5203..0b13189a026 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.372 2015/09/11 09:15:56 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.373 2015/09/11 16:58:00 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -2256,7 +2256,7 @@ if_group_egress_build(void) #ifdef INET6 struct sockaddr_in6 sa_in6; #endif - struct rtentry *rt; + struct rtentry *rt0, *rt; TAILQ_FOREACH(ifg, &ifg_head, ifg_next) if (!strcmp(ifg->ifg_group, IFG_EGRESS)) @@ -2269,8 +2269,9 @@ if_group_egress_build(void) bzero(&sa_in, sizeof(sa_in)); sa_in.sin_len = sizeof(sa_in); sa_in.sin_family = AF_INET; - rt = rtable_lookup(0, sintosa(&sa_in), sintosa(&sa_in)); - if (rt != NULL) { + rt0 = rtable_lookup(0, sintosa(&sa_in), sintosa(&sa_in)); + if (rt0 != NULL) { + rt = rt0; do { if (rt->rt_ifp) if_addgroup(rt->rt_ifp, IFG_EGRESS); @@ -2281,11 +2282,13 @@ if_group_egress_build(void) #endif } while (rt != NULL); } + rtfree(rt0); #ifdef INET6 bcopy(&sa6_any, &sa_in6, sizeof(sa_in6)); - rt = rtable_lookup(0, sin6tosa(&sa_in6), sin6tosa(&sa_in6)); - if (rt != NULL) { + rt0 = rtable_lookup(0, sin6tosa(&sa_in6), sin6tosa(&sa_in6)); + if (rt0 != NULL) { + rt = rt0; do { if (rt->rt_ifp) if_addgroup(rt->rt_ifp, IFG_EGRESS); @@ -2297,6 +2300,7 @@ if_group_egress_build(void) } while (rt != NULL); } #endif + rtfree(rt0); return (0); } |