forked from Mirror/frr
2004-10-22 Paul Jakma <paul@dishone.st>
* sockopt.c: (setsockopt_pktinfo) unexported * sockopt.h: Cleanup SOCKOPT_CMSG defines a bit. Add a throwaway define for SOPT_SIZE_CMSG_IFINDEX_IPV4 for systems which have neither IP_RECVIF nor IP_PKTINFO (eg openbsd).
This commit is contained in:
parent
7d9c6e5115
commit
23b9c61e5b
|
@ -1,7 +1,11 @@
|
||||||
2004-10-13 Paul Jakma <paul@dishone.st>
|
2004-10-22 Paul Jakma <paul@dishone.st>
|
||||||
|
|
||||||
* sockopt.c: (getsockopt_ipv4_ifindex) no ifindex should be 0, not
|
* sockopt.c: (getsockopt_ipv4_ifindex) no ifindex should be 0, not
|
||||||
-1.
|
-1.
|
||||||
|
(setsockopt_pktinfo) unexported
|
||||||
|
* sockopt.h: Cleanup SOCKOPT_CMSG defines a bit. Add a throwaway
|
||||||
|
define for SOPT_SIZE_CMSG_IFINDEX_IPV4 for systems which have
|
||||||
|
neither IP_RECVIF nor IP_PKTINFO (eg openbsd).
|
||||||
|
|
||||||
2004-10-19 Hasso Tepper <hasso at quagga.net>
|
2004-10-19 Hasso Tepper <hasso at quagga.net>
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ setsockopt_ipv4_ifindex (int sock, int val)
|
||||||
* interface index.
|
* interface index.
|
||||||
* Not portable for IPv4, use only setsockopt_ifindex for v4.
|
* Not portable for IPv4, use only setsockopt_ifindex for v4.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
setsockopt_pktinfo (int af, int sock, int val)
|
setsockopt_pktinfo (int af, int sock, int val)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
|
@ -48,34 +48,36 @@ int setsockopt_ipv6_multicast_loop (int, int);
|
||||||
*/
|
*/
|
||||||
#if defined (IP_PKTINFO)
|
#if defined (IP_PKTINFO)
|
||||||
/* Linux in_pktinfo. */
|
/* Linux in_pktinfo. */
|
||||||
#define SOPT_SIZE_CMSG_PKTINFO_IPV4() (sizeof (struct in_pktinfo))
|
#define SOPT_SIZE_CMSG_PKTINFO_IPV4() (CMSG_SPACE(sizeof (struct in_pktinfo)))
|
||||||
|
|
||||||
/* XXX This should perhaps be defined even if IP_PKTINFO is not. */
|
/* XXX This should perhaps be defined even if IP_PKTINFO is not. */
|
||||||
#define SOPT_SIZE_CMSG_PKTINFO(af) \
|
#define SOPT_SIZE_CMSG_PKTINFO(af) \
|
||||||
((af == AF_INET) ? SOPT_SIZE_CMSG_PKTINFO_IPV4() \
|
((af == AF_INET) ? SOPT_SIZE_CMSG_PKTINFO_IPV4() \
|
||||||
: SOPT_SIZE_CMSG_PKTINFO_IPV6()
|
: SOPT_SIZE_CMSG_PKTINFO_IPV6()
|
||||||
|
#endif /* IP_PKTINFO */
|
||||||
|
|
||||||
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() SOPT_SIZE_CMSG_PKTINFO_IPV4()
|
#if defined (IP_RECVIF)
|
||||||
|
/* BSD/Solaris */
|
||||||
#elif defined (IP_RECVIF)
|
|
||||||
/* BSD/Solaris. Arguably these should say RECVIF rather than IFINDEX. */
|
|
||||||
|
|
||||||
#if defined (SUNOS_5)
|
#if defined (SUNOS_5)
|
||||||
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() (sizeof (uint_t))
|
#define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof (uint_t))
|
||||||
#else
|
#else
|
||||||
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() \
|
#define SOPT_SIZE_CMSG_RECVIF_IPV4() \
|
||||||
__CMSG_ALIGN((sizeof (struct sockaddr_dl)))
|
__CMSG_ALIGN((sizeof (struct sockaddr_dl)))
|
||||||
#endif /* SUNOS_5 */
|
#endif /* SUNOS_5 */
|
||||||
|
#endif /* IP_RECVIF */
|
||||||
|
|
||||||
#endif
|
/* SOPT_SIZE_CMSG_IFINDEX_IPV4 - portable type */
|
||||||
|
#if defined (SOPT_SIZE_CMSG_PKTINFO)
|
||||||
|
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() SOPT_SIZE_CMSG_PKTINFO_IPV4()
|
||||||
|
#elif defined (SOPT_SIZE_CMSG_RECVIF_IPV4)
|
||||||
|
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() SOPT_SIZE_CMSG_RECVIF_IPV4()
|
||||||
|
#elif /* Nothing available */
|
||||||
|
#define SOPT_SIZE_CMSG_IFINDEX_IPV4() (sizeof (char *))
|
||||||
|
#endif /* SOPT_SIZE_CMSG_IFINDEX_IPV4 */
|
||||||
|
|
||||||
/*
|
|
||||||
* AF-parameterized message size.
|
|
||||||
* XXX Why is this here? Is it used? The v6 case is not defined.
|
|
||||||
*/
|
|
||||||
#define SOPT_SIZE_CMSG_IFINDEX(af) \
|
#define SOPT_SIZE_CMSG_IFINDEX(af) \
|
||||||
((af == AF_INET) ? SOPT_SIZE_CMSG_IFINDEX_IPV4() \
|
(((af) == AF_INET) : SOPT_SIZE_CMSG_IFINDEX_IPV4() \
|
||||||
: SOPT_SIZE_CMSG_IFINDEX_IPV6()
|
? SOPT_SIZE_CMSG_PKTINFO_IPV6())
|
||||||
|
|
||||||
int setsockopt_multicast_ipv4(int sock,
|
int setsockopt_multicast_ipv4(int sock,
|
||||||
int optname,
|
int optname,
|
||||||
|
@ -83,12 +85,6 @@ int setsockopt_multicast_ipv4(int sock,
|
||||||
unsigned int mcast_addr,
|
unsigned int mcast_addr,
|
||||||
unsigned int ifindex);
|
unsigned int ifindex);
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX Exactly what is this an interface to? Specifically, what calls
|
|
||||||
* can be made after calling it?
|
|
||||||
*/
|
|
||||||
int setsockopt_pktinfo (int, int, int);
|
|
||||||
|
|
||||||
/* Ask for, and get, ifindex, by whatever method is supported. */
|
/* Ask for, and get, ifindex, by whatever method is supported. */
|
||||||
int setsockopt_ifindex (int, int, int);
|
int setsockopt_ifindex (int, int, int);
|
||||||
int getsockopt_ifindex (int, struct msghdr *);
|
int getsockopt_ifindex (int, struct msghdr *);
|
||||||
|
|
Loading…
Reference in a new issue