bug-zebra
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solaris 2.X support


From: James Carlson
Subject: Solaris 2.X support
Date: Wed, 28 Mar 2001 17:15:05 -0500 (EST)

The following patch fixes two problems on Solaris.

    zebra/if_ioctl.c
        The interfaces learned through SIOCGIFCONF are never added, so
        they always show up as "inactive."  They thus never work for
        any routing protocol.  Adding a call to if_add_update(ifp)
        fixes this.

    ospfd/ospf_packet.c
        Solaris uses the same raw IP interface semantics as BSD (IP
        header length is updated so that it doesn't include the length
        of the IP header itself).  It's only Linux that's different in
        this regard.  Also replaced unusual checksum logic with
        standard procedure from IP (don't modify packet; just do sum
        and check for plus/minus zero in one's complement).

I've tested it out and RIP, OSPF, and BGP are now working fine on
Solaris, both SPARC and x86 variants.

-- 
James Carlson, Internet Engineering       <address@hidden>
SUN Microsystems / 1 Network Drive         71.234W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.497N   Fax +1 781 442 1677
Second Edition now available - http://people.ne.mediaone.net/carlson/ppp

diff -ru ../zebra-0.91a-orig/ospfd/ospf_packet.c ./ospfd/ospf_packet.c
--- ../zebra-0.91a-orig/ospfd/ospf_packet.c     Wed Jan 31 21:54:42 2001
+++ ./ospfd/ospf_packet.c       Wed Mar 28 17:09:01 2001
@@ -1552,10 +1552,13 @@
       return -1;
     }
 
-#if defined(GNU_LINUX) || defined(SOLARIS_X86)
+#if defined(GNU_LINUX)
   ip_len = ntohs (iph.ip_len);
-#else
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#else /* !GNU_LINUX */
+#if defined(SUNOS_5)
+  ip_len = ntohs(iph.ip_len) + (iph.ip_hl << 2);
+#else /* !GNU_LINUX && !SUNOS_5 */
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) ||
   /*
    * Kernel network code touches incoming IP header parameters,
    * before protocol specific processing.
@@ -1573,8 +1576,9 @@
   ip_len = iph.ip_len + (iph.ip_hl << 2);
 #else /* ! __NetBSD__ && ! __FreeBSD__ && ! __OpenBSD__ */
   ip_len = iph.ip_len;
-#endif /* __FreeBSD__ */
-#endif /* GNU_LINUX || SOLARIS_X86 */
+#endif /* __NetBSD__ && __FreeBSD__ && __OpenBSD__ */
+#endif /* SUNOS_5 */
+#endif /* GNU_LINUX */
 
   oi->ibuf = stream_new (ip_len);
   ret = recvfrom (oi->fd, STREAM_DATA (oi->ibuf), ip_len, 0, NULL, 0);
@@ -1725,23 +1729,18 @@
 ospf_check_sum (struct ospf_header *ospfh)
 {
   u_int32_t ret;
-  u_int16_t sum;
   int in_cksum (void *ptr, int nbytes);
 
   /* clear auth_data for checksum. */
   bzero (ospfh->u.auth_data, OSPF_AUTH_SIMPLE_SIZE);
 
-  /* keep checksum and clear. */
-  sum = ospfh->checksum;
-  bzero (&ospfh->checksum, sizeof (u_int16_t));
-
   /* calculate checksum. */
   ret = in_cksum (ospfh, ntohs (ospfh->length));
 
-  if (ret != sum)
+  if (ret != 0 && ret != 0xFFFF)
     {
-      zlog_info ("ospf_check_sum(): checksum mismatch, my %lX, his %X",
-                ret, sum);
+      zlog_info ("ospf_check_sum(): checksum mismatch; result %lX not zero",
+                ret);
       return 0;
     }
 
diff -ru ../zebra-0.91a-orig/zebra/if_ioctl.c ./zebra/if_ioctl.c
--- ../zebra-0.91a-orig/zebra/if_ioctl.c        Tue Jan 23 03:16:46 2001
+++ ./zebra/if_ioctl.c  Wed Mar 28 10:25:31 2001
@@ -110,6 +110,7 @@
   for (n = 0; n < ifconf.ifc_len; n += sizeof(struct ifreq))
     {
       ifp = if_get_by_name (ifreq->ifr_name);
+      if_add_update (ifp);
       ifreq++;
     }
 #endif /* OPEN_BSD */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]