Commit Graph

2867 Commits

Author SHA1 Message Date
rjs ad7c64535c Enable SCTP sysctl nodes.
Rename auto asconf one to match FreeBSD.
2018-07-31 16:28:56 +00:00
rjs 3917a6f0d9 Change implementation of sctp_connectx() to use ioctl(2). 2018-07-31 13:36:31 +00:00
maxv 94924a7495 Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
2018-07-15 05:16:40 +00:00
martin ed45e7ba3d Add missing <netinet/in_offload.h> include. 2018-07-11 12:48:42 +00:00
kre c935a86e5e Fix build. pf_ioctl.c needs netinet/in_offload.h (after previous change).
Because this is in a module, apparently, that means that netinet_in_offload.h
needs to get installed in /usr/include, so do that as well.

Feel free to fix this in a better way...
2018-07-11 11:13:16 +00:00
maxv 168a93a1a2 Add KASSERTs in in_undefer_cksum_tcpudp. 2018-07-11 06:25:05 +00:00
maxv 494c795aff Style, rename 'iph' -> 'ip', and reduce the diff between
in_undefer_cksum_tcpudp and the last part of in_undefer_cksum.
2018-07-11 06:00:34 +00:00
maxv 8a353a21b4 Remove the callback, localify, and add a comment. 2018-07-11 05:38:55 +00:00
maxv 3574e9908d Rename
ip_undefer_csum  -> in_undefer_cksum
	in_delayed_cksum -> in_undefer_cksum_tcpudp

The two previous names were inconsistent and misleading.

Put the two functions into in_offload.c. Add comments to explain what
we're doing.

The same could be done for IPv6.
2018-07-11 05:25:45 +00:00
maxv 41fcd1f412 Remove the second argument from ip_reass_packet(). We want the IP header
on the mbuf, not elsewhere. Simplifies the NPF reassembly code a little.
No real functional change.
2018-07-10 15:46:58 +00:00
msaitoh 3cd62456f9 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
2018-06-26 06:47:57 +00:00
knakahara a1b205bf0e sbappendaddr() is required any lock. Currently, softnet_lock is appropriate.
When rip_input() is called as inetsw[].pr_input, rip_iput() is always called
with holding softnet_lock, that is, in case of !defined(NET_MPSAFE) it is
acquired in ipintr(), otherwise(defined(NET_MPSAFE)) it is acquire in
PR_WRAP_INPUT macro.
However, some function calls rip_input() directly without holding softnet_lock.
That causes assertion failure in sbappendaddr().
rip6_input() and icmp6_rip6_input() are also required softnet_lock for the same
reason.
2018-06-21 10:37:49 +00:00
yamaguchi ebf325ec6a Add the lock to refer the list included in ethercom for safety
The lock is already held while adding and deleting
ok ozaki-r@
2018-06-14 08:06:07 +00:00
yamaguchi 70db832747 Use ether_lookup_multi() instead of the macro
ok ozaki-r@
2018-06-14 07:54:57 +00:00
maxv 975c668a99 Copy more mbuf flags. 2018-06-02 11:56:57 +00:00
ozaki-r 28cab72f3d Fix _rt_free via rtrequest(RTM_DELETE) hangs in rt_timer handlers
A rt_timer handler is passed a rtentry with an extra reference that avoids the
rtentry is accidentally released.  So rt_timer handers must release the reference
of a passed rtentry by themselves (but they didn't).
2018-06-01 07:13:35 +00:00
maxv 767beb2240 Remove the non-IKE part of the computation, too. 2018-05-31 13:51:56 +00:00
maxv f645db7adb 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.
2018-05-31 07:03:57 +00:00
maxv 14fc7e2d6a Fix an XXX of mine, be clearer about what we're doing. Basically we want to
preserve the fragment offset and flags. That's necessary if the packet
we're fragmenting is itself a fragment.
2018-05-29 17:21:57 +00:00
maxv b4370c2b4c Add XXX. 2018-05-23 18:40:29 +00:00
maxv a1d8c752e7 IP6_EXTHDR_GET -> M_REGION_GET, no functional change. 2018-05-18 18:58:51 +00:00
maxv 9a3fc3b376 IP6_EXTHDR_GET performs a basic mbuf operation, which has nothing to do
with IPv6. So declare an IP-independent M_REGION_GET, and make
IP6_EXTHDR_GET an alias to it.
2018-05-18 18:52:17 +00:00
maxv 67d5d4e2eb Remove IP6_EXTHDR_GET0, remove pointless XXXs, and style. 2018-05-18 18:28:40 +00:00
maxv a127c0ebdb Add KASSERTs, related to PR/39794. 2018-05-17 11:59:36 +00:00
maxv 68981e0ca6 Remove reference to tcpiphdr in comment. 2018-05-17 07:30:13 +00:00
maxv fbb9ed35f8 When reassembling IPv4/IPv6 packets, ensure each fragment has been subject
to the same IPsec processing. That is to say, that all fragments are ESP,
or AH, or AH+ESP, or none.

The reassembly mechanism can be used both on the wire and inside an IPsec
tunnel, so we need to make sure all fragments of a packet were received
on only one side.

Even though I haven't tried, I believe there are configurations where it
would be possible for an attacker to inject an unencrypted fragment into a
legitimate stream of already-decrypted-and-authenticated fragments.

Typically on IPsec gateways with ESP tunnels, where we can encapsulate
fragments (as opposed to the general case, where we fragment encapsulated
data).

Note, for the record: a funnier thing, under IPv4, would be to send a
zero-sized !MFF fragment at the head of the packet, and manage to trigger
an ICMP error; M_DECRYPTED gets lost by the reassembly, and ICMP will reply
with the packet in clear (not encrypted).
2018-05-15 19:16:38 +00:00
maxv 00ff305a9c Merge ipsec4_input and ipsec6_input into ipsec_ip_input. Make the argument
a bool for clarity. Optimize the function: if M_CANFASTFWD is not there
(because already removed by the firewall) leave now.

Makes it easier to see that M_CANFASTFWD is not removed on IPv6.
2018-05-14 17:34:26 +00:00
maxv 0f358da4e7 Don't crash if there is no inner IP header. 2018-05-14 17:26:16 +00:00
khorben 0e64fed944 Fix spello in a comment 2018-05-13 22:42:51 +00:00
maxv c9afc618e9 Clarify ESP-in-UDP. 2018-05-13 18:39:06 +00:00
maxv 65f0aceba1 Retire ICMPPRINTFS, it's annoying and it doesn't build. 2018-05-11 14:38:28 +00:00
maxv fdef4a4ef3 Make sure we have at least an IP header, and remove pointless XXXs (there
is no issue).
2018-05-11 14:07:58 +00:00
maxv 2afab7aa0f static 2018-05-11 13:56:43 +00:00
maxv f813c44d31 Rename ipsec4_forward -> ipsec_mtu, and switch to void. 2018-05-10 05:08:53 +00:00
uwe 05df44f648 Fix unsigned wraparound on window size calculations.
This is another instance where tp->rcv_adv - tp->rcv_nxt can wrap
around after successful zero-window probe from the peer.  The first
one was fixed by chs@ in revision 1.112 on 2004-05-08.

While here, CSE and de-obfuscate the code a bit.
2018-05-07 23:42:13 +00:00
maxv 86243c5040 Fix possible buffer overflow. We need to make sure the inner IPv4 packet
doesn't have options, because we validate only an option-less header.
2018-05-07 19:34:03 +00:00
maxv 04b61f509d Rename m_pkthdr_remove -> m_remove_pkthdr, to match the existing naming
convention, eg m_copy_pkthdr and m_move_pkthdr.
2018-05-03 07:25:49 +00:00
maxv 5d73803e75 Remove now unused tcpip.h includes. Some were already unused before. 2018-05-03 07:13:48 +00:00
maxv 4a165b5280 Remove m_copy completely. 2018-05-03 07:01:08 +00:00
maxv aebb419bf1 Remove unused argument from udp4_espinudp, and remove unused includes. 2018-05-01 08:42:41 +00:00
maxv 86ac125b49 Remove now unused net_osdep.h includes, the other BSDs did the same. 2018-05-01 07:21:39 +00:00
maxv ba0005f35a Redefine the structure, not to rely on tcpiphdr. 2018-05-01 07:03:33 +00:00
maxv 24e9c1c9d0 Move struct tcpiphdr from tcpip.h to tcp_var.h, to match UDP (udpiphdr in
udp_var.h).

tcpip.h is now empty, and can be removed.
2018-04-29 12:12:42 +00:00
maxv d920327205 Remove unused and misleading argument from ipsec_set_policy. 2018-04-29 11:51:08 +00:00
maxv 2489795f85 Remove unused ipsec_var.h includes. 2018-04-28 13:26:57 +00:00
knakahara b0c61d654b 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.
2018-04-27 09:55:27 +00:00
maxv de9cefcf44 Remove unused mbuf argument from sbsavetimestamp. 2018-04-26 19:22:17 +00:00
maxv e64bc0451a Use M_UNWRITABLE, no functional change. 2018-04-26 07:28:21 +00:00
maxv b5d4b113f7 Add code 3 of paramprob, part of RFC7112: "IPv6 First Fragment has
incomplete IPv6 Header Chain". Handle this code in ping6.
2018-04-24 07:22:32 +00:00
knakahara 30b0741c40 Fix sys/netinet/in.c:r1.229 problem. I have missed FALLTHROUGH, sorry. 2018-04-24 01:32:30 +00:00