diff options
author | paul <paul> | 2004-07-23 15:25:01 +0000 |
---|---|---|
committer | paul <paul> | 2004-07-23 15:25:01 +0000 |
commit | 1470bafb7aa179dad7dc4bdc998d68c14752f824 (patch) | |
tree | 4ad15e51d3ebd1e731385919ac4c0f6e5f29287d /zebra | |
parent | caa248198ad276f5edc9065e6c416e7f864ef7fa (diff) |
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()
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/ChangeLog | 6 | ||||
-rw-r--r-- | zebra/irdp_main.c | 4 | ||||
-rw-r--r-- | zebra/irdp_packet.c | 11 |
3 files changed, 10 insertions, 11 deletions
diff --git a/zebra/ChangeLog b/zebra/ChangeLog index 5a0ff8c6..b121b448 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,9 @@ +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() + 2004-07-13 David Wiggins <dwiggins@bbn.com * kernel_socket.c (rtm_flag_dump): terminate buffer with '\0', not '0'. diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 56e41840..fd56c881 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -124,9 +124,7 @@ irdp_sock_init (void) return ret; }; - i = 1; - ret = setsockopt (irdp_sock, IPPROTO_IP, IP_PKTINFO, - (void *) &i, sizeof (i)); + ret = setsockopt_pktinfo_ipv4 (irdp_sock, 1); if (ret < 0) { zlog_warn ("IRDP: can't do irdp sockopt %s", strerror(errno)); return ret; diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 147d5970..e881ef93 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -186,7 +186,7 @@ int irdp_recvmsg (int sock, 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 @@ int irdp_recvmsg (int sock, 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; } |