]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: use IPPROTO_IP (not SOL_IP) for IP_PKTINFO
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 15 Sep 2015 09:18:23 +0000 (02:18 -0700)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Thu, 26 May 2016 00:38:33 +0000 (20:38 -0400)
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>
pimd/pim_sock.c
pimd/pim_ssmpingd.c

index 4816c567e2412f495cb5b7655b0459ba39c1112c..4e6bf7e0a66a0cb072ae638ac8bc78ae761c9122 100644 (file)
@@ -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;
index 82e0722a7410fa0ce1d1df08af8950c10de40a53..d564bf57bcec6885402d43437f3ad2ce6f121f3a 100644 (file)
@@ -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));
     }