2004-07-23 Paul Jakma <paul@dishone.st>
* irdp_main.c: use setsockopt_pktinfo_ipv4
* irdp_packet.c: use SOPT_SIZE_CMSG_PKTINFO_IPV4 and
getsockopt_pktinfo_ifindex()
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 147d597..e881ef9 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -186,7 +186,7 @@
struct msghdr msg;
struct iovec iov;
struct cmsghdr *ptr;
- char adata[1024];
+ char adata[CMSG_SPACE( SOPT_SIZE_CMSG_PKTINFO_IPV4() )];
int ret;
msg.msg_name = (void *)0;
@@ -214,13 +214,8 @@
return ret;
}
- for (ptr = CMSG_FIRSTHDR(&msg); ptr ; ptr = CMSG_NXTHDR(&msg, ptr))
- if (ptr->cmsg_level == SOL_IP && ptr->cmsg_type == IP_PKTINFO)
- {
- struct in_pktinfo *pktinfo;
- pktinfo = (struct in_pktinfo *) CMSG_DATA (ptr);
- *ifindex = pktinfo->ipi_ifindex;
- }
+ ifindex = getsockopt_pktinfo_ifindex (AF_INET, &msg);
+
return ret;
}