diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2015-11-30 12:44:37 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2015-11-30 12:44:37 +0000 |
commit | 8694b8525a8d34282f33caf682028ba9a7735347 (patch) | |
tree | 53c2a87e0f179f84c81d92f3fe3b5d6d9e144066 | |
parent | efea10f55504efd0ae59c25e98375664f8b50480 (diff) |
Fix dynamic prefix tracking.
This code should not be using RTAX_GATEWAY to retrieve the interface
index. Also this index is meaningless within get_next_msg(), further
cleanup is planned.
Issue reported by Sly Midnight on bugs@, ok mpi@
-rw-r--r-- | usr.sbin/rtadvd/if.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c index 169113f60cd..9df747187a1 100644 --- a/usr.sbin/rtadvd/if.c +++ b/usr.sbin/rtadvd/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.30 2015/11/03 15:59:31 mpi Exp $ */ +/* $OpenBSD: if.c,v 1.31 2015/11/30 12:44:36 jca Exp $ */ /* $KAME: if.c,v 1.17 2001/01/21 15:27:30 itojun Exp $ */ /* @@ -256,7 +256,7 @@ get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter) continue; if ((gw = rti_info[RTAX_GATEWAY]) == NULL || - gw->sa_family != AF_LINK) + gw->sa_family != AF_INET6) continue; if (ifindex && SDL(gw)->sdl_index != ifindex) continue; @@ -319,12 +319,8 @@ int get_rtm_ifindex(char *buf) { struct rt_msghdr *rtm = (struct rt_msghdr *)buf; - struct sockaddr *sa, *rti_info[RTAX_MAX]; - - sa = (struct sockaddr *)(buf + rtm->rtm_hdrlen); - get_rtaddrs(rtm->rtm_addrs, sa, rti_info); - return(((struct sockaddr_dl *)rti_info[RTAX_GATEWAY])->sdl_index); + return rtm->rtm_index; } int |