Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netipsec Add IPv4 ID when the ipsecif(4) packet can be f...



details:   https://anonhg.NetBSD.org/src/rev/bf3ef4b8c9ab
branches:  trunk
changeset: 831563:bf3ef4b8c9ab
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Apr 06 10:31:35 2018 +0000

description:
Add IPv4 ID when the ipsecif(4) packet can be fragmented. Implemented by hsuenaga@IIJ and ohishi@IIJ, thanks.

This modification reduces packet loss of fragmented packets on a
network where reordering occurs.

Alghough this modification has been applied, IPv4 ID is not set for
the packet smaller then IP_MINFRAGSIZE. According to RFC 6864, that
must not cause problems.

XXX pullup-8

diffstat:

 sys/netipsec/ipsecif.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 25c6d2a99421 -r bf3ef4b8c9ab sys/netipsec/ipsecif.c
--- a/sys/netipsec/ipsecif.c    Fri Apr 06 09:30:09 2018 +0000
+++ b/sys/netipsec/ipsecif.c    Fri Apr 06 10:31:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsecif.c,v 1.5 2018/03/13 03:05:12 knakahara Exp $  */
+/*     $NetBSD: ipsecif.c,v 1.6 2018/04/06 10:31:35 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.5 2018/03/13 03:05:12 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.6 2018/04/06 10:31:35 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -135,7 +135,10 @@
        ip = mtod(m, struct ip *);
        ip->ip_v = IPVERSION;
        ip->ip_off = htons(0);
-       ip->ip_id = 0;
+       if (m->m_pkthdr.len < IP_MINFRAGSIZE)
+               ip->ip_id = 0;
+       else
+               ip->ip_id = ip_newid(NULL);
        ip->ip_hl = sizeof(*ip) >> 2;
        if (ip_ipsec_copy_tos)
                ip->ip_tos = tos;



Home | Main Index | Thread Index | Old Index