X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=netlink.c;h=372645615a3af5bc223a5582d5c953515148da4c;hb=refs%2Ftags%2Fwip.frag.v1;hp=55eef5c8da38ce6139dc60e9e3d6d746f5919050;hpb=f3d69e414de7d941865f59723e45207bd1f8fc93;p=secnet.git diff --git a/netlink.c b/netlink.c index 55eef5c..3726456 100644 --- 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; } @@ -828,7 +831,7 @@ static void netlink_incoming(struct netlink *st, struct netlink_client *client, BUF_FREE(buf); return; } - assert(buf->size >= (int)sizeof(struct icmphdr)); + assert(buf->size >= (int)sizeof(struct iphdr)); iph=(struct iphdr *)buf->start; source=ntohl(iph->saddr); @@ -1025,12 +1028,16 @@ static void netlink_inst_set_mtu(void *sst, int32_t new_mtu) } static void netlink_inst_reg(void *sst, netlink_deliver_fn *deliver, - void *dst) + void *dst, uint32_t *localmtu_r) { struct netlink_client *c=sst; + struct netlink *st=c->nst; c->deliver=deliver; c->dst=dst; + + if (localmtu_r) + *localmtu_r=st->mtu; } static struct flagstr netlink_option_table[]={