chiark / gitweb /
fragmentation: Rename "frag_off" field to "frag"
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 20 Mar 2014 02:00:59 +0000 (02:00 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Apr 2014 01:09:59 +0000 (02:09 +0100)
This 16-bit superfield contains all of the fragmentation info, not
just the offset.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
netlink.c

index 0dd4450..b8f22d3 100644 (file)
--- a/netlink.c
+++ b/netlink.c
@@ -192,7 +192,7 @@ struct iphdr {
     uint8_t    tos;
     uint16_t   tot_len;
     uint16_t   id;
-    uint16_t   frag_off;
+    uint16_t   frag;
 #define IPHDR_FRAG_OFF  ((uint16_t)0x1fff)
 #define IPHDR_FRAG_MORE ((uint16_t)0x2000)
 #define IPHDR_FRAG_DONT ((uint16_t)0x4000)
@@ -252,7 +252,7 @@ static struct icmphdr *netlink_icmp_tmpl(struct netlink *st,
     h->iph.tos=0;
     h->iph.tot_len=htons(len+(h->iph.ihl*4)+8);
     h->iph.id=0;
-    h->iph.frag_off=0;
+    h->iph.frag=0;
     h->iph.ttl=255; /* XXX should be configurable */
     h->iph.protocol=1;
     h->iph.saddr=htonl(st->secnet_address);
@@ -319,7 +319,7 @@ static bool_t netlink_icmp_may_reply(struct buffer_if *buf)
        }
     }
     /* How do we spot broadcast destination addresses? */
-    if (ntohs(iph->frag_off)&IPHDR_FRAG_OFF) return False;
+    if (ntohs(iph->frag)&IPHDR_FRAG_OFF) return False;
     source=ntohl(iph->saddr);
     if (source==0) return False;
     if ((source&0xff000000)==0x7f000000) return False;
@@ -616,7 +616,7 @@ static void netlink_packet_local(struct netlink *st,
     }
     h=(struct icmphdr *)buf->start;
 
-    if ((ntohs(h->iph.frag_off)&(IPHDR_FRAG_OFF|IPHDR_FRAG_MORE))!=0) {
+    if ((ntohs(h->iph.frag)&(IPHDR_FRAG_OFF|IPHDR_FRAG_MORE))!=0) {
        Message(M_WARNING,"%s: fragmented packet addressed to secnet; "
                "ignoring it\n",st->name);
        BUF_FREE(buf);