summaryrefslogtreecommitdiffstats
path: root/lib/sockopt.c
diff options
context:
space:
mode:
authorgdt <gdt>2004-07-23 16:14:32 +0000
committergdt <gdt>2004-07-23 16:14:32 +0000
commit4079ab3a323b8582c532644e3c1b890c817be479 (patch)
treec0f467e1d628d6e7981839e675ad411f052ab89f /lib/sockopt.c
parent10709852055776c7c5fabfc2ab7604828e592947 (diff)
downloadquagga-4079ab3a323b8582c532644e3c1b890c817be479.tar.bz2
quagga-4079ab3a323b8582c532644e3c1b890c817be479.tar.xz
2004-07-23 Greg Troxel <gdt@poblano.ir.bbn.com>
* sockopt.c (getsockopt_ipv4_pktinfo_ifindex): Make this compile on NetBSD, and add comments to make it less confusing. Change the sense of the SUNOS_5 test to make parallel structure between the variables and the code.
Diffstat (limited to 'lib/sockopt.c')
-rw-r--r--lib/sockopt.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c
index ee10ac30..682b7397 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -272,28 +272,31 @@ getsockopt_ipv4_pktinfo_ifindex (struct msghdr *msgh)
int ifindex = 0;
#if defined (IP_PKTINFO)
struct in_pktinfo *pktinfo;
-#elif defined (IP_REVCIF)
+#elif defined (IP_RECVIF)
#ifndef SUNOS_5
+ /* RECVIF, but not SUNOS, so BSD */
struct sockaddr_dl *sdl;
#endif /* SUNOS_5 */
+ /* SUNOS_5 doesn't need a structure to extract ifindex */
#else /* IP_RECVIF */
- char *pktinfo;
+ /* XXX Neither, so we are going to lose. */
#endif /* IP_PKTINFO */
#ifdef IP_PKTINFO
pktinfo =
(struct in_pktinfo *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_PKTINFO);
#elif defined (IP_RECVIF)
-#ifdef SUNOS_5
- ifindex = *(uint_t *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_RECVIF);
-#else
- pktinfo =
+#ifndef SUNOS_5
+ sdl =
(struct sockaddr_dl *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_RECVIF);
- ifindex = pktinfo->sdl_index;
+ ifindex = sdl->sdl_index;
+#else
+ ifindex = *(uint_t *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_RECVIF);
#endif /* SUNOS_5 */
#else
#warning "getsockopt_ipv4_pktinfo_ifindex: dont have PKTINFO or RECVIF"
- ifindex = 0;
+ /* XXX why not -1 - this is a failure condition. */
+ ifindex = 0;
#endif /* IP_PKTINFO */
return ifindex;