netlink: Only complain about initial frags for us
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 13 Apr 2014 14:43:15 +0000 (15:43 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Apr 2014 01:32:29 +0000 (02:32 +0100)
secnet has no reassembly code and logs whenever it receives fragments.
Change this to only log when receiving initial fragments; this reduces
noise in the log.

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

index 55eef5c..2c3d12d 100644 (file)
--- a/netlink.c
+++ b/netlink.c
@@ -775,9 +775,12 @@ static void netlink_packet_local(struct netlink *st,
     }
     h=(struct icmphdr *)buf->start;
 
-    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);
+    unsigned fraginfo = ntohs(h->iph.frag);
+    if ((fraginfo&(IPHDR_FRAG_OFF|IPHDR_FRAG_MORE))!=0) {
+       if (!(fraginfo & IPHDR_FRAG_OFF))
+           /* report only for first fragment */
+           Message(M_WARNING,"%s: fragmented packet addressed to secnet; "
+                   "ignoring it\n",st->name);
        BUF_FREE(buf);
        return;
     }