]> git.puffer.fish Git - mirror/frr.git/commitdiff
2004-05-05 Paul Jakma <paul@dishone.st>
authorpaul <paul>
Wed, 5 May 2004 17:29:24 +0000 (17:29 +0000)
committerpaul <paul>
Wed, 5 May 2004 17:29:24 +0000 (17:29 +0000)
        * ospf_network.c: (ospf_sock_init) Check whether IP_HDRINCL is
          defined. Warn at compile and runtime. Use
          IPTOS_PREC_INTERNETCONTROL otherwise.

ospfd/ChangeLog
ospfd/ospf_network.c

index 7bff0a366eb1379415b0d7004d686263618bc826..ebeaa5bce6ddfaadeae8db37ca15a0fa429b60d7 100644 (file)
@@ -1,5 +1,8 @@
 2004-05-05 Paul Jakma <paul@dishone.st>
 
+       * ospf_network.c: (ospf_sock_init) Check whether IP_HDRINCL is
+         defined. Warn at compile and runtime. Use 
+         IPTOS_PREC_INTERNETCONTROL otherwise.
        * ospf_packet.c:  (ospf_associate_packet_vl) cleanup, move 
          some of the checks up to ospf_read, return either a 
          virtual link oi, or NULL. 
index 87dfb60acafc07024a7c62d9e82d645a5229dc4a..2766abd5444df136384620fc8c4d063fc8ac33c5 100644 (file)
@@ -170,9 +170,20 @@ ospf_sock_init (void)
       exit(-1);
     }
     
-
+#ifdef IP_HDRINCL
+  /* we will include IP header with packet */
+  ret = setsockopt (ospf_sock, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof (hincl));
+  if (ret < 0)
+    {
+      if ( ospfd_privs.change (ZPRIVS_LOWER) )
+        zlog_err ("ospf_sock_init: could not lower privs, %s",
+                   strerror (errno) );
+      zlog_warn ("Can't set IP_HDRINCL option");
+    }
+#elif defined (IPTOS_PREC_INTERNETCONTROL)
+#warning "IP_HDRINCL not available on this system"
+#warning "using IPTOS_PREC_INTERNETCONTROL"
   /* Set precedence field. */
-#ifdef IPTOS_PREC_INTERNETCONTROL
   tos = IPTOS_PREC_INTERNETCONTROL;
   ret = setsockopt (ospf_sock, IPPROTO_IP, IP_TOS,
                    (char *) &tos, sizeof (int));
@@ -185,17 +196,10 @@ ospf_sock_init (void)
       close (ospf_sock);       /* Prevent sd leak. */
       return ret;
     }
-#endif /* IPTOS_PREC_INTERNETCONTROL */
-
-  /* we will include IP header with packet */
-  ret = setsockopt (ospf_sock, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof (hincl));
-  if (ret < 0)
-    {
-      if ( ospfd_privs.change (ZPRIVS_LOWER) )
-        zlog_err ("ospf_sock_init: could not lower privs, %s",
-                   strerror (errno) );
-      zlog_warn ("Can't set IP_HDRINCL option");
-    }
+#else /* !IPTOS_PREC_INTERNETCONTROL */
+#warning "IP_HDRINCL not available, nor is IPTOS_PREC_INTERNETCONTROL"
+  zlog_warn ("IP_HDRINCL option not available");
+#endif /* IP_HDRINCL */
 
 #if defined (IP_PKTINFO)
   ret = setsockopt (ospf_sock, IPPROTO_IP, IP_PKTINFO, &hincl, sizeof (hincl));