summaryrefslogtreecommitdiffstats
path: root/lib/sockopt.h
diff options
context:
space:
mode:
authorpaul <paul>2004-08-19 06:13:29 +0200
committerpaul <paul>2004-08-19 06:13:29 +0200
commite6822768a281a5d46d497c0bbfe5ffd2a10c78c8 (patch)
treec42184d3e7312a6e635a583d3beab4069a637b27 /lib/sockopt.h
parent2004-08-19 Paul Jakma <paul@dishone.st> (diff)
downloadfrr-e6822768a281a5d46d497c0bbfe5ffd2a10c78c8.tar.xz
frr-e6822768a281a5d46d497c0bbfe5ffd2a10c78c8.zip
2004-08-19 Paul Jakma <paul@dishone.st>
2004-08-19 Paul Jakma <paul@dishone.st> * sockopt.c: include sockopt.h rename some of the _pktinfo_ functions to _ifindex, where that is their purpose. (getsockopt_ipv6_pktinfo_ifindex) renamed to getsockopt_ipv6_ifindex. (setsockopt_ipv4_pktinfo) renamed to setsockopt_ipv4_ifindex (setsockopt_pktinfo) update with previous and add comment re AF_INET portability. (setsockopt_ifindex) generic ifindex function ala setsockopt_pktinfo. (getsockopt_ipv4_pktinfo_ifindex) renamed to getsockopt_ipv4_ifindex. (getsockopt_ipv4_ifindex) rejiggling to reduce repeated ifdef/elses. pktinfo case forgot to set ifindex. (getsockopt_pktinfo_ifindex) renamed to getsockopt_ifindex. update some calls to renamed functions. * sockopt.h: Update renamed exported functions Rename the CMSG_SIZE macros to IFINDEX. Guard IPv4 PKTINFO in a conditional define.
Diffstat (limited to 'lib/sockopt.h')
-rw-r--r--lib/sockopt.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/sockopt.h b/lib/sockopt.h
index c5d171c25..b7aa1b3ac 100644
--- a/lib/sockopt.h
+++ b/lib/sockopt.h
@@ -32,26 +32,37 @@ int setsockopt_ipv6_multicast_loop (int, int);
#endif /* HAVE_IPV6 */
#if defined (IP_PKTINFO)
+
#define SOPT_SIZE_CMSG_PKTINFO_IPV4() (sizeof (struct in_pktinfo))
+#define SOPT_SIZE_CMSG_IFINDEX_IPV4 SOPT_SIZE_CMSG_PKTINFO_IPV4
+#define SOPT_SIZE_CMSG_PKTINFO(af) \
+ ((af == AF_INET) ? SOPT_SIZE_CMSG_PKTINFO_IPV4() \
+ : SOPT_SIZE_CMSG_PKTINFO_IPV6()
+
#elif defined (IP_RECVIF)
#if defined (SUNOS_5)
-#define SOPT_SIZE_CMSG_PKTINFO_IPV4() (sizeof (uint_t))
+#define SOPT_SIZE_CMSG_IFINDEX_IPV4() (sizeof (uint_t))
#else
-#define SOPT_SIZE_CMSG_PKTINFO_IPV4() (sizeof (struct sockaddr_dl))
+#define SOPT_SIZE_CMSG_IFINDEX_IPV4() (sizeof (struct sockaddr_dl))
#endif /* SUNOS_5 */
+
#endif
#define SOPT_SIZE_CMSG_PKTINFO_IPV6() (sizeof (struct in6_pktinfo));
-#define SOPT_SIZE_CMSG_PKTINFO(af) \
- ((af == AF_INET) ? SOPT_SIZE_CMSG_PKTINFO_IPV4() \
- : SOPT_SIZE_CMSG_PKTINFO_IPV6()
+#define SOPT_SIZE_CMSG_IFINDEX(af) \
+ ((af == AF_INET) ? SOPT_SIZE_CMSG_IFINDEX_IPV4() \
+ : SOPT_SIZE_CMSG_IFINDEX_IPV6()
int setsockopt_multicast_ipv4(int sock,
int optname,
struct in_addr if_addr,
unsigned int mcast_addr,
unsigned int ifindex);
+
+#if defined (IP_PKTINFO)
int setsockopt_pktinfo (int, int, int);
-int getsockopt_pktinfo_ifindex (int, struct msghdr *);
+#endif
+int setsockopt_ifindex (int, int, int);
+int getsockopt_ifindex (int, struct msghdr *);
#endif /*_ZEBRA_SOCKOPT_H */