History log of /src/sys/netipsec/ipsecif.c |
Revision | | Date | Author | Comments |
1.24 |
| 11-Jun-2025 |
ozaki-r | in: get rid of unused argument from ip_newid() and ip_newid_range()
|
1.23 |
| 19-May-2025 |
andvar | spelling and grammar fixes in comments.
|
1.22 |
| 01-Sep-2023 |
andvar | fix typos in comments, mainly s/innner/inner/.
|
1.21 |
| 08-Dec-2022 |
knakahara | Fix: update lastused of ipsecif(4) IPv6 out SP.
|
1.20 |
| 07-Dec-2022 |
knakahara | gif(4), ipsec(4) and l2tp(4) use encap_attach_addr().
|
1.19 |
| 31-Jan-2020 |
knakahara | Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wrongly. Pointed out by ohishi@IIJ.
XXX pullup-8, pullup-9
|
1.18 |
| 01-Nov-2019 |
knakahara | branches: 1.18.2; Make global and per-interface ipsecif(4) pmtu tunable like gif(4).
And make hop limit tunable same as gif(4).
See http://mail-index.netbsd.org/source-changes/2019/10/30/msg110426.html
|
1.17 |
| 19-Sep-2019 |
knakahara | Avoid having a rtcache directly in a percpu storage for tunnel protocols.
percpu(9) has a certain memory storage for each CPU and provides it by the piece to users. If the storages went short, percpu(9) enlarges them by allocating new larger memory areas, replacing old ones with them and destroying the old ones. A percpu storage referenced by a pointer gotten via percpu_getref can be destroyed by the mechanism after a running thread sleeps even if percpu_putref has not been called.
Using rtcache, i.e., packet processing, typically involves sleepable operations such as rwlock so we must avoid dereferencing a rtcache that is directly stored in a percpu storage during packet processing. Address this situation by having just a pointer to a rtcache in a percpu storage instead.
Reviewed by ozaki-r@ and yamaguchi@
|
1.16 |
| 17-May-2019 |
knakahara | branches: 1.16.2; Don't clear calculated Tx tos value for IPv[46] over IPv6.
|
1.15 |
| 12-Apr-2019 |
knakahara | remove a variable which is no longer used.
|
1.14 |
| 18-Mar-2019 |
msaitoh | s/pakcet/packet/ in comment.
|
1.13 |
| 26-Dec-2018 |
knakahara | ipsecif(4) supports multiple peers in the same NAPT.
E.g. ipsec0 connects between NetBSD_A and NetBSD_B, ipsec1 connects NetBSD_A and NetBSD_C at the following figure.
+----------+ +----| NetBSD_B | +----------+ +------+ | +----------+ | NetBSD_A |--- ... ---| NAPT |---+ +----------+ +------+ | +----------+ +----| NetBSD_C | +----------+
Add ATF later.
|
1.12 |
| 07-Dec-2018 |
knakahara | ipsecif(4) should not increment drop counter by errors not related to if_snd. Pointed out by ozaki-r@n.o, thanks.
|
1.11 |
| 15-Nov-2018 |
maxv | Remove the 't' argument from m_tag_find().
|
1.10 |
| 31-May-2018 |
maxv | branches: 1.10.2; Remove support for non-IKE markers in the kernel. Discussed on tech-net@, and now in PR/53334. Basically non-IKE markers come from a deprecated draft, and our kernel code for them has never worked.
Setsockopt will now reject UDP_ENCAP_ESPINUDP_NON_IKE.
Perhaps we should also add a check in key_handle_natt_info(), to make sure we also reject UDP_ENCAP_ESPINUDP_NON_IKE in the SADB.
|
1.9 |
| 09-May-2018 |
maxv | static const on ipsecif4_encapsw
|
1.8 |
| 27-Apr-2018 |
knakahara | Fix LOCKDEBUG kernel panic when many(about 200) tunnel interfaces is created.
The tunnel interfaces are gif(4), l2tp(4), and ipsecif(4). They use mutex itself in percpu area. When percpu_cpu_enlarge() run, the address of the mutex in percpu area becomes different from the address which lockdebug saved. That can cause "already initialized" false detection.
|
1.7 |
| 06-Apr-2018 |
knakahara | Fix unexpected failure when ipsecif(4) over IPv6 is changed port number only.
Here is an example of the operation which causes this problem. # ifconfig ipsec0 create link0 # ifconfig ipsec0 tunnel fc00:1001::2,4500 fc00:1001::1,4501 # ifconfig ipsec0 tunnel fc00:1001::2,4500 fc00:1001::1,4502
|
1.6 |
| 06-Apr-2018 |
knakahara | 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
|
1.5 |
| 13-Mar-2018 |
knakahara | comment out confusing (and incorrect) code and add comment. Pointed out by maxv@n.o, thanks.
|
1.4 |
| 09-Mar-2018 |
knakahara | Fix ipsec(4) I/F esp_frag support.
|
1.3 |
| 06-Mar-2018 |
knakahara | Fix fragment processing in ipsec4_fragout(). Pointed out by maxv@n.o, thanks.
XXX need pullup-8
|
1.2 |
| 26-Feb-2018 |
maxv | branches: 1.2.2; Merge some minor (mostly stylistic) changes from last week.
|
1.1 |
| 10-Jan-2018 |
knakahara | branches: 1.1.2; add ipsec(4) interface, which is used for route-based VPN.
man and ATF are added later, please see man for details.
reviewed by christos@n.o, joerg@n.o and ozaki-r@n.o, thanks. https://mail-index.netbsd.org/tech-net/2017/12/18/msg006557.html
|
1.1.2.10 |
| 31-Jan-2020 |
martin | Pull up following revision(s) (requested by knakahara in ticket #1497):
sys/netipsec/ipsecif.c: revision 1.19
Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wrongly. Pointed out by ohishi@IIJ. XXX pullup-8, pullup-9
|
1.1.2.9 |
| 24-Sep-2019 |
martin | Pull up following revision(s) (requested by knakahara in ticket #1385):
sys/net/if.c 1.461 sys/net/if.h 1.277 sys/net/if_gif.c 1.149 sys/net/if_gif.h 1.33 sys/net/if_ipsec.c 1.19,1.20,1.24 sys/net/if_ipsec.h 1.5 sys/net/if_l2tp.c 1.33,1.36-1.39 sys/net/if_l2tp.h 1.7,1.8 sys/net/route.c 1.220,1.221 sys/net/route.h 1.125 sys/netinet/in_gif.c 1.95 sys/netinet/in_l2tp.c 1.17 sys/netinet/ip_input.c 1.391,1.392 sys/netinet/wqinput.c 1.6 sys/netinet6/in6_gif.c 1.94 sys/netinet6/in6_l2tp.c 1.18 sys/netinet6/ip6_forward.c 1.97 sys/netinet6/ip6_input.c 1.210,1.211 sys/netipsec/ipsec_output.c 1.82,1.83 (patched) sys/netipsec/ipsecif.c 1.12,1.13,1.15,1.17 (patched) sys/netipsec/key.c 1.259,1.260
ipsecif(4) support input drop packet counter.
ipsecif(4) should not increment drop counter by errors not related to if_snd. Pointed out by ozaki-r@n.o, thanks. Remove unnecessary addresses in PF_KEY message.
MOBIKE Extensions for PF_KEY draft-schilcher-mobike-pfkey-extension-01.txt says
|
1.1.2.8 |
| 29-May-2019 |
martin | Pull up following revision(s) (requested by knakahara in ticket #1273):
sys/netipsec/ipsecif.c: revision 1.16
Don't clear calculated Tx tos value for IPv[46] over IPv6.
|
1.1.2.7 |
| 17-May-2018 |
martin | Pull up following revision(s) (requested by knakahara in ticket #829):
sys/net/if_l2tp.c: revision 1.24 sys/net/if_ipsec.c: revision 1.13 sys/net/if_gif.h: revision 1.31 sys/netipsec/ipsecif.c: revision 1.8 sys/net/if_gif.c: revision 1.140 sys/netinet6/in6_l2tp.c: revision 1.15 sys/net/if_ipsec.h: revision 1.3 sys/netinet6/in6_gif.c: revision 1.92 sys/net/if_l2tp.h: revision 1.5 sys/netinet/in_l2tp.c: revision 1.13 sys/netinet/in_gif.c: revision 1.93
Fix LOCKDEBUG kernel panic when many(about 200) tunnel interfaces is created.
The tunnel interfaces are gif(4), l2tp(4), and ipsecif(4). They use mutex itself in percpu area. When percpu_cpu_enlarge() run, the address of the mutex in percpu area becomes different from the address which lockdebug saved. That can cause "already initialized" false detection.
|
1.1.2.6 |
| 09-Apr-2018 |
martin | Pull up following revision(s) (requested by knakahara in ticket #714):
sys/net/if_ipsec.c: revision 1.8 - 1.11 sys/netipsec/ipsecif.h: revision 1.2 sys/netipsec/ipsecif.c: revision 1.6,1.7
fix ipsec(4) encap_lock leak.
fix ipsecif(4) unmatch curlwp_bind.
fix ipsecif(4) stack overflow.
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.
Fix unexpected failure when ipsecif(4) over IPv6 is changed port number only. Here is an example of the operation which causes this problem. # ifconfig ipsec0 create link0 # ifconfig ipsec0 tunnel fc00:1001::2,4500 fc00:1001::1,4501 # ifconfig ipsec0 tunnel fc00:1001::2,4500 fc00:1001::1,4502
|
1.1.2.5 |
| 13-Mar-2018 |
martin | Pull up following revision(s) (requested by knakahara in ticket #627): sys/netipsec/ipsecif.c: revision 1.5 tests/net/if_ipsec/t_ipsec.sh: revision 1.4 sys/net/if_ipsec.c: revision 1.7 Fix IPv6 ipsecif(4) ATF regression, sorry. There must *not* be padding between the src sockaddr and the dst sockaddr after struct sadb_x_policy.
Comment out confusing (and incorrect) code and add comment. Pointed out by maxv@n.o, thanks.
Enhance assertion ipsecif(4) ATF to avoid confusing setkey(8) error message.
When setkey(8) says "syntax error at [-E]", it must mean get_if_ipsec_unique() failed.
|
1.1.2.4 |
| 13-Mar-2018 |
martin | Pull up following revision(s) (requested by knakahara in ticket #620): sys/netipsec/ipsecif.c: revision 1.4 sys/net/if_ipsec.c: revision 1.4 sys/net/if_ipsec.c: revision 1.5 sys/net/if_ipsec.c: revision 1.6 NAT-T src and dst port in ipsec_variant should be network byte order. Fix missing sadb_x_ipsecrequest informations for PF_KEY message. Functionalize duplicated code. No functional changes. Fix ipsec(4) I/F esp_frag support.
|
1.1.2.3 |
| 06-Mar-2018 |
martin | Pull up following revision(s) (requested by knakahara in ticket #607): sys/netipsec/ipsecif.c: revision 1.3 Fix fragment processing in ipsec4_fragout(). Pointed out by maxv@n.o, thanks. XXX need pullup-8
|
1.1.2.2 |
| 11-Feb-2018 |
snj | Pull up following revision(s) (requested by ozaki-r in ticket #536): distrib/sets/lists/base/shl.mi: 1.825 distrib/sets/lists/comp/mi: 1.2168-1.2169 distrib/sets/lists/comp/shl.mi: 1.310 distrib/sets/lists/debug/mi: 1.234 distrib/sets/lists/debug/shl.mi: 1.188 distrib/sets/lists/man/mi: 1.1570 distrib/sets/lists/tests/mi: 1.772 etc/mtree/NetBSD.dist.tests: 1.150 share/man/man4/Makefile: 1.650 share/man/man4/ipsec.4: 1.42-1.43 share/man/man4/ipsecif.4: 1.1-1.5 sys/arch/amd64/conf/ALL: 1.77 sys/arch/amd64/conf/GENERIC: 1.480 sys/conf/files: 1.1191 sys/net/Makefile: 1.34 sys/net/files.net: 1.14 sys/net/if.c: 1.404 sys/net/if.h: 1.248 sys/net/if_gif.c: 1.135 sys/net/if_ipsec.c: 1.1-1.3 sys/net/if_ipsec.h: 1.1 sys/net/if_l2tp.c: 1.16 sys/net/if_types.h: 1.28 sys/netinet/in.c: 1.214 sys/netinet/in.h: 1.103 sys/netinet/in_gif.c: 1.92 sys/netinet/ip_var.h: 1.122 sys/netinet6/in6.c: 1.257 sys/netinet6/in6.h: 1.88 sys/netinet6/in6_gif.c: 1.90 sys/netinet6/ip6_var.h: 1.75 sys/netipsec/Makefile: 1.6 sys/netipsec/files.netipsec: 1.13 sys/netipsec/ipsec.h: 1.62 sys/netipsec/ipsecif.c: 1.1 sys/netipsec/ipsecif.h: 1.1 sys/netipsec/key.c: 1.246-1.247 sys/netipsec/key.h: 1.34 sys/rump/net/Makefile.rumpnetcomp: 1.20 sys/rump/net/lib/libipsec/IPSEC.ioconf: 1.1 sys/rump/net/lib/libipsec/Makefile: 1.1 sys/rump/net/lib/libipsec/ipsec_component.c: 1.1 tests/net/Makefile: 1.34 tests/net/if_ipsec/Makefile: 1.1 tests/net/if_ipsec/t_ipsec.sh: 1.1-1.2 Don't touch an SP without a reference to it unify processing to check nesting count for some tunnel protocols. add ipsec(4) interface, which is used for route-based VPN. man and ATF are added later, please see man for details. reviewed by christos@n.o, joerg@n.o and ozaki-r@n.o, thanks. https://mail-index.netbsd.org/tech-net/2017/12/18/msg006557.html ipsec(4) interface supports rump now. add ipsec(4) interface ATF. add ipsec(4) interface man as ipsecif.4. add ipsec(4) interface to amd64/GENERIC and amd64/ALL configs. apply in{,6}_tunnel_validate() to gif(4). Spell IPsec that way. Simplify macro usage. Sort SEE ALSO. Bump date for previous. Improve wording and macro use. Some parts are not clear to me, so someone with knowledge of ipsecif(4) should improve this some more. Improve ipsecif.4. Default port ipsec(4) NAT-T is tested now. pointed out by wiz@n.o and suggested by ozaki-r@n.o, thanks. Change the prefix of test names to ipsecif_ to distinguish from tests for ipsec(4) New sentence, new line. Remove empty macro. Fix PR kern/52920. Pointed out by David Binderman, thanks. Improve wording, and put a new drawing, from me and Kengo Nakahara. apply a little more #ifdef INET/INET6. fixes !INET6 builds.
|
1.1.2.1 |
| 10-Jan-2018 |
snj | file ipsecif.c was added on branch netbsd-8 on 2018-02-11 21:17:34 +0000
|
1.2.2.8 |
| 18-Jan-2019 |
pgoyette | Synch with HEAD
|
1.2.2.7 |
| 26-Dec-2018 |
pgoyette | Sync with HEAD, resolve a few conflicts
|
1.2.2.6 |
| 26-Nov-2018 |
pgoyette | Sync with HEAD, resolve a couple of conflicts
|
1.2.2.5 |
| 25-Jun-2018 |
pgoyette | Sync with HEAD
|
1.2.2.4 |
| 21-May-2018 |
pgoyette | Sync with HEAD
|
1.2.2.3 |
| 02-May-2018 |
pgoyette | Synch with HEAD
|
1.2.2.2 |
| 07-Apr-2018 |
pgoyette | Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
|
1.2.2.1 |
| 15-Mar-2018 |
pgoyette | Synch with HEAD
|
1.10.2.3 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.10.2.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.10.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.16.2.2 |
| 31-Jan-2020 |
martin | Pull up following revision(s) (requested by knakahara in ticket #679):
sys/netipsec/ipsecif.c: revision 1.19
Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wrongly. Pointed out by ohishi@IIJ. XXX pullup-8, pullup-9
|
1.16.2.1 |
| 24-Sep-2019 |
martin | Pull up following revision(s) (requested by ozaki-r in ticket #238):
sys/netipsec/ipsec_output.c: revision 1.83 sys/net/route.h: revision 1.125 sys/netinet6/ip6_input.c: revision 1.210 sys/netinet6/ip6_input.c: revision 1.211 sys/net/if.c: revision 1.461 sys/net/if_gif.h: revision 1.33 sys/net/route.c: revision 1.220 sys/net/route.c: revision 1.221 sys/net/if.h: revision 1.277 sys/netinet6/ip6_forward.c: revision 1.97 sys/netinet/wqinput.c: revision 1.6 sys/net/if_ipsec.h: revision 1.5 sys/netinet6/in6_l2tp.c: revision 1.18 sys/netinet6/in6_gif.c: revision 1.94 sys/net/if_l2tp.h: revision 1.7 sys/net/if_gif.c: revision 1.149 sys/net/if_l2tp.h: revision 1.8 sys/netinet/in_gif.c: revision 1.95 sys/netinet/in_l2tp.c: revision 1.17 sys/netipsec/ipsecif.c: revision 1.17 sys/net/if_ipsec.c: revision 1.24 sys/net/if_l2tp.c: revision 1.37 sys/netinet/ip_input.c: revision 1.391 sys/net/if_l2tp.c: revision 1.38 sys/netinet/ip_input.c: revision 1.392 sys/net/if_l2tp.c: revision 1.39
Avoid having a rtcache directly in a percpu storage
percpu(9) has a certain memory storage for each CPU and provides it by the piece to users. If the storages went short, percpu(9) enlarges them by allocating new larger memory areas, replacing old ones with them and destroying the old ones.
A percpu storage referenced by a pointer gotten via percpu_getref can be destroyed by the mechanism after a running thread sleeps even if percpu_putref has not been called.
Using rtcache, i.e., packet processing, typically involves sleepable operations such as rwlock so we must avoid dereferencing a rtcache that is directly stored in a percpu storage during packet processing. Address this situation by having just a pointer to a rtcache in a percpu storage instead. Reviewed by knakahara@ and yamaguchi@
-
wqinput: avoid having struct wqinput_worklist directly in a percpu storage
percpu(9) has a certain memory storage for each CPU and provides it by the piece to users. If the storages went short, percpu(9) enlarges them by allocating new larger memory areas, replacing old ones with them and destroying the old ones.
A percpu storage referenced by a pointer gotten via percpu_getref can be destroyed by the mechanism after a running thread sleeps even if percpu_putref has not been called.
Input handlers of wqinput normally involves sleepable operations so we must avoid dereferencing a percpu data (struct wqinput_worklist) after executing an input handler. Address this situation by having just a pointer to the data in a percpu storage instead. Reviewed by knakahara@ and yamaguchi@
-
Add missing #include <sys/kmem.h>
-
Divide Tx context of l2tp(4) to improve performance.
It seems l2tp(4) call path is too long for instruction cache. So, dividing l2tp(4) Tx context improves CPU use efficiency.
After this commit, l2tp(4) throughput gains 10% on my machine(Atom C3000).
-
Apply some missing changes lost on the previous commit
-
Avoid having a rtcache directly in a percpu storage for tunnel protocols. percpu(9) has a certain memory storage for each CPU and provides it by the piece to users. If the storages went short, percpu(9) enlarges them by allocating new larger memory areas, replacing old ones with them and destroying the old ones.
A percpu storage referenced by a pointer gotten via percpu_getref can be destroyed by the mechanism after a running thread sleeps even if percpu_putref has not been called.
Using rtcache, i.e., packet processing, typically involves sleepable operations such as rwlock so we must avoid dereferencing a rtcache that is directly stored in a percpu storage during packet processing. Address this situation by having just a pointer to a rtcache in a percpu storage instead.
Reviewed by ozaki-r@ and yamaguchi@
-
l2tp(4): avoid having struct ifqueue directly in a percpu storage. percpu(9) has a certain memory storage for each CPU and provides it by the piece to users. If the storages went short, percpu(9) enlarges them by allocating new larger memory areas, replacing old ones with them and destroying the old ones.
A percpu storage referenced by a pointer gotten via percpu_getref can be destroyed by the mechanism after a running thread sleeps even if percpu_putref has not been called.
Tx processing of l2tp(4) uses normally involves sleepable operations so we must avoid dereferencing a percpu data (struct ifqueue) after executing Tx processing. Address this situation by having just a pointer to the data in a percpu storage instead.
Reviewed by ozaki-r@ and yamaguchi@
|
1.18.2.1 |
| 29-Feb-2020 |
ad | Sync with head.
|