summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2015-09-15 02:18:23 -0700
committerMartin Winter <mwinter@opensourcerouting.org>2015-10-16 23:50:46 -0700
commitcbc3f5232af5cacd6f88f2124c864bb91e851cde (patch)
treea786b63b29a006ab7b6120525c08791e89d99869
parenta4065069e6bdd0bc7475312530b0e9457f818e0d (diff)
downloadquagga-cbc3f5232af5cacd6f88f2124c864bb91e851cde.tar.bz2
quagga-cbc3f5232af5cacd6f88f2124c864bb91e851cde.tar.xz
pimd: use IPPROTO_IP (not SOL_IP) for IP_PKTINFO
Solaris uses the same socket API for IP_PKTINFO as Linux, but doesn't have a SOL_IP define. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--pimd/pim_sock.c6
-rw-r--r--pimd/pim_ssmpingd.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 09b66505..2bb48f75 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -80,9 +80,9 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int loop)
/* Needed to obtain destination address from recvmsg() */
{
#if defined(HAVE_IP_PKTINFO)
- /* Linux IP_PKTINFO */
+ /* Linux and Solaris IP_PKTINFO */
int opt = 1;
- if (setsockopt(fd, SOL_IP, IP_PKTINFO, &opt, sizeof(opt))) {
+ if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &opt, sizeof(opt))) {
zlog_warn("Could not set IP_PKTINFO on socket fd=%d: errno=%d: %s",
fd, errno, safe_strerror(errno));
}
@@ -306,7 +306,7 @@ int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
#ifdef HAVE_IP_PKTINFO
- if ((cmsg->cmsg_level == SOL_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
+ if ((cmsg->cmsg_level == IPPROTO_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
struct in_pktinfo *i = (struct in_pktinfo *) CMSG_DATA(cmsg);
if (to)
((struct sockaddr_in *) to)->sin_addr = i->ipi_addr;
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index 82e0722a..d564bf57 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -110,9 +110,9 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl)
/* Needed to obtain destination address from recvmsg() */
{
#if defined(HAVE_IP_PKTINFO)
- /* Linux IP_PKTINFO */
+ /* Linux and Solaris IP_PKTINFO */
int opt = 1;
- if (setsockopt(fd, SOL_IP, IP_PKTINFO, &opt, sizeof(opt))) {
+ if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &opt, sizeof(opt))) {
zlog_warn("%s: could not set IP_PKTINFO on socket fd=%d: errno=%d: %s",
__PRETTY_FUNCTION__, fd, errno, safe_strerror(errno));
}