preserve garbage byte on ip encapsulation.
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 3 Jul 1985 13:20:40 +0000 (05:20 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 3 Jul 1985 13:20:40 +0000 (05:20 -0800)
SCCS-vsn: sys/netns/ns_ip.c 6.3

usr/src/sys/netns/ns_ip.c

index 4699e80..b91cfea 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ns_ip.c     6.2 (Berkeley) %G%
+ *     @(#)ns_ip.c     6.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -144,6 +144,7 @@ idpip_input(m0)
        m->m_len -= sizeof (struct ip);
        idp = mtod(m, struct idp *);
        len = ntohs(idp->idp_len);
        m->m_len -= sizeof (struct ip);
        idp = mtod(m, struct idp *);
        len = ntohs(idp->idp_len);
+       if (len & 1) len++;             /* Preserve Garbage Byte */
        if (ip->ip_len != len) {
                if (len > ip->ip_len) {
                        nsipif.if_ierrors++;
        if (ip->ip_len != len) {
                if (len > ip->ip_len) {
                        nsipif.if_ierrors++;
@@ -200,6 +201,7 @@ nsipoutput(ifn, m0, dst)
         * for IP header.
         */
        len =  ntohs(idp->idp_len);
         * for IP header.
         */
        len =  ntohs(idp->idp_len);
+       if (len & 1) len++;             /* Preserve Garbage Byte */
        m = m0;
        if(m->m_off < MMINOFF + sizeof (struct ip)) {
                m = m_get(M_DONTWAIT, MT_HEADER);
        m = m0;
        if(m->m_off < MMINOFF + sizeof (struct ip)) {
                m = m_get(M_DONTWAIT, MT_HEADER);