summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd
diff options
context:
space:
mode:
authorChris Cappuccio <chris@cvs.openbsd.org>2009-06-05 22:40:25 +0000
committerChris Cappuccio <chris@cvs.openbsd.org>2009-06-05 22:40:25 +0000
commit4e9d97f9bd4bf6ffea35c2fc1c968806bab268a6 (patch)
tree8dd99e6c5ab1c033916b198c7678a4a083f2aa9e /usr.sbin/ldpd
parent637897ed02de73e77d8087fcaf4bb06dfca62df0 (diff)
rtm->rtm_hdrlen conversion
ok claudio@, henning@
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r--usr.sbin/ldpd/kroute.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c
index ab722b76e0c..287958b9724 100644
--- a/usr.sbin/ldpd/kroute.c
+++ b/usr.sbin/ldpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.1 2009/06/01 20:59:45 michele Exp $ */
+/* $OpenBSD: kroute.c,v 1.2 2009/06/05 22:40:24 chris Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -1089,6 +1089,7 @@ send_rtlabelmsg(int fd, int action, struct kroute *kroute, u_int32_t family)
hdr.rtm_priority = 0;
hdr.rtm_seq = kr_state.rtseq++; /* overflow doesn't matter */
hdr.rtm_msglen = sizeof(hdr);
+ hdr.rtm_hdrlen = sizeof(struct rt_msghdr);
/* adjust iovec */
iov[iovcnt].iov_base = &hdr;
iov[iovcnt++].iov_len = sizeof(hdr);
@@ -1222,6 +1223,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute)
hdr.rtm_fmask = RTF_PROTO2|RTF_PROTO1|RTF_REJECT|RTF_BLACKHOLE;
hdr.rtm_seq = kr_state.rtseq++; /* overflow doesn't matter */
hdr.rtm_msglen = sizeof(hdr);
+ hdr.rtm_hdrlen = sizeof(struct rt_msghdr);
/* adjust iovec */
iov[iovcnt].iov_base = &hdr;
iov[iovcnt++].iov_len = sizeof(hdr);
@@ -1351,7 +1353,7 @@ fetchtable(void)
rtm = (struct rt_msghdr *)next;
if (rtm->rtm_version != RTM_VERSION)
continue;
- sa = (struct sockaddr *)(rtm + 1);
+ sa = (struct sockaddr *)(next + rtm->rtm_hdrlen);
get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
if ((sa = rti_info[RTAX_DST]) == NULL)
@@ -1546,7 +1548,7 @@ dispatch_rtmsg(void)
if (rtm->rtm_type == RTM_ADD || rtm->rtm_type == RTM_CHANGE ||
rtm->rtm_type == RTM_DELETE) {
- sa = (struct sockaddr *)(rtm + 1);
+ sa = (struct sockaddr *)(next + rtm->rtm_hdrlen);
get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
if (rtm->rtm_tableid != 0)