diff options
author | Chris Cappuccio <chris@cvs.openbsd.org> | 2009-06-05 22:40:25 +0000 |
---|---|---|
committer | Chris Cappuccio <chris@cvs.openbsd.org> | 2009-06-05 22:40:25 +0000 |
commit | 4e9d97f9bd4bf6ffea35c2fc1c968806bab268a6 (patch) | |
tree | 8dd99e6c5ab1c033916b198c7678a4a083f2aa9e /usr.sbin/rtadvd | |
parent | 637897ed02de73e77d8087fcaf4bb06dfca62df0 (diff) |
rtm->rtm_hdrlen conversion
ok claudio@, henning@
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r-- | usr.sbin/rtadvd/if.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c index a388dfec180..c2788da2766 100644 --- a/usr.sbin/rtadvd/if.c +++ b/usr.sbin/rtadvd/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.18 2008/04/21 20:40:55 rainer Exp $ */ +/* $OpenBSD: if.c,v 1.19 2009/06/05 22:40:24 chris Exp $ */ /* $KAME: if.c,v 1.17 2001/01/21 15:27:30 itojun Exp $ */ /* @@ -236,7 +236,7 @@ get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter) *lenp = 0; for (rtm = (struct rt_msghdr *)buf; rtm < (struct rt_msghdr *)lim; - rtm = (struct rt_msghdr *)(((char *)rtm) + rtm->rtm_msglen)) { + rtm = (struct rt_msghdr *)((char *)rtm + rtm->rtm_msglen)) { /* just for safety */ if (!rtm->rtm_msglen) { log_warnx("rtm_msglen is 0 (buf=%p lim=%p rtm=%p)", @@ -255,7 +255,7 @@ get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter) continue; /* address related checks */ - sa = (struct sockaddr *)(rtm + 1); + sa = (struct sockaddr *)((char *)rtm + rtm->rtm_hdrlen); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); if ((dst = rti_info[RTAX_DST]) == NULL || dst->sa_family != AF_INET6) @@ -320,7 +320,7 @@ get_addr(char *buf) struct rt_msghdr *rtm = (struct rt_msghdr *)buf; struct sockaddr *sa, *rti_info[RTAX_MAX]; - sa = (struct sockaddr *)(rtm + 1); + sa = (struct sockaddr *)(buf + rtm->rtm_hdrlen); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); return(&SIN6(rti_info[RTAX_DST])->sin6_addr); @@ -332,7 +332,7 @@ get_rtm_ifindex(char *buf) struct rt_msghdr *rtm = (struct rt_msghdr *)buf; struct sockaddr *sa, *rti_info[RTAX_MAX]; - sa = (struct sockaddr *)(rtm + 1); + 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); @@ -369,7 +369,7 @@ get_prefixlen(char *buf) struct sockaddr *sa, *rti_info[RTAX_MAX]; u_char *p, *lim; - sa = (struct sockaddr *)(rtm + 1); + sa = (struct sockaddr *)(buf + rtm->rtm_hdrlen); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); sa = rti_info[RTAX_NETMASK]; |