ah, the rollover times are always so fun! don't get confused during rollover. age those frags properly. Reference: /n/atom/patch/applied/49dayfrag Date: Fri Jun 20 02:54:05 CES 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/ip/ip.h Fri Jun 20 02:53:50 2014 +++ /sys/src/nix/ip/ip.h Fri Jun 20 02:53:51 2014 @@ -100,7 +100,7 @@ FragOKs, FragFails, FragCreates, - + FragSoftOvf, /* not a mib */ Nipstats, }; --- /sys/src/nix/ip/ip.c Fri Jun 20 02:53:55 2014 +++ /sys/src/nix/ip/ip.c Fri Jun 20 02:53:56 2014 @@ -30,6 +30,7 @@ [FragOKs] "FragOKs", [FragFails] "FragFails", [FragCreates] "FragCreates", +[FragSoftOvf] "FragSoftOvf", }; #define BLKIP(xp) ((Ip4hdr*)((xp)->rp)) @@ -44,6 +45,12 @@ void ipfragfree4(IP*, Fragment4*); Fragment4* ipfragallo4(IP*); +static long +agecmp(ulong a, ulong b) +{ + return (long)(a - b); +} + void ip_init_6(Fs *f) { @@ -502,9 +509,9 @@ fnext = f->next; /* because ipfragfree4 changes the list */ if(f->src == src && f->dst == dst && f->id == id) break; - if(f->age < NOW){ + if(agecmp(f->age, NOW) < 0){ ip->stats[ReasmTimeout]++; - /* supposed to icmp ttl exceeded here */ + /* supposed to: icmpttlexceeded(f, ifc->lifc->local, bp); */ ipfragfree4(ip, f); } } @@ -677,6 +684,7 @@ /* free last entry on fraglist */ for(f = ip->flisthead4; f->next; f = f->next) ; + ip->stats[FragSoftOvf]++; ipfragfree4(ip, f); } f = ip->fragfree4;