mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 18:42:23 +00:00
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.
This commit is contained in:
parent
5b73a671aa
commit
33f92320e8
@ -1,3 +1,10 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-07-23 Paul Jakma <paul@dishone.st>
|
2004-07-23 Paul Jakma <paul@dishone.st>
|
||||||
|
|
||||||
* sockopt.h: Add SOPT_SIZE_CMSG_PKTINFO{_IPV{4,6}} define, for
|
* sockopt.h: Add SOPT_SIZE_CMSG_PKTINFO{_IPV{4,6}} define, for
|
||||||
|
@ -272,28 +272,31 @@ getsockopt_ipv4_pktinfo_ifindex (struct msghdr *msgh)
|
|||||||
int ifindex = 0;
|
int ifindex = 0;
|
||||||
#if defined (IP_PKTINFO)
|
#if defined (IP_PKTINFO)
|
||||||
struct in_pktinfo *pktinfo;
|
struct in_pktinfo *pktinfo;
|
||||||
#elif defined (IP_REVCIF)
|
#elif defined (IP_RECVIF)
|
||||||
#ifndef SUNOS_5
|
#ifndef SUNOS_5
|
||||||
|
/* RECVIF, but not SUNOS, so BSD */
|
||||||
struct sockaddr_dl *sdl;
|
struct sockaddr_dl *sdl;
|
||||||
#endif /* SUNOS_5 */
|
#endif /* SUNOS_5 */
|
||||||
|
/* SUNOS_5 doesn't need a structure to extract ifindex */
|
||||||
#else /* IP_RECVIF */
|
#else /* IP_RECVIF */
|
||||||
char *pktinfo;
|
/* XXX Neither, so we are going to lose. */
|
||||||
#endif /* IP_PKTINFO */
|
#endif /* IP_PKTINFO */
|
||||||
|
|
||||||
#ifdef IP_PKTINFO
|
#ifdef IP_PKTINFO
|
||||||
pktinfo =
|
pktinfo =
|
||||||
(struct in_pktinfo *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_PKTINFO);
|
(struct in_pktinfo *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_PKTINFO);
|
||||||
#elif defined (IP_RECVIF)
|
#elif defined (IP_RECVIF)
|
||||||
#ifdef SUNOS_5
|
#ifndef SUNOS_5
|
||||||
ifindex = *(uint_t *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_RECVIF);
|
sdl =
|
||||||
#else
|
|
||||||
pktinfo =
|
|
||||||
(struct sockaddr_dl *)getsockopt_cmsg_data (msgh, IPPROTO_IP, IP_RECVIF);
|
(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 */
|
#endif /* SUNOS_5 */
|
||||||
#else
|
#else
|
||||||
#warning "getsockopt_ipv4_pktinfo_ifindex: dont have PKTINFO or RECVIF"
|
#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 */
|
#endif /* IP_PKTINFO */
|
||||||
|
|
||||||
return ifindex;
|
return ifindex;
|
||||||
|
Loading…
Reference in New Issue
Block a user