summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
2023-06-16Align function name in its declaration consistently.rin
No binary changes.
2023-06-16Consistently use __inline instead of inline, as done for rev. 1.119:rin
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/net/route.h#rev1.119
2023-06-05route: run workqueue kthreads with KERNEL_LOCK unless NET_MPSAFEozaki-r
Without KERNEL_LOCK, rt_timer_work and rt_free_work can run in parallel with other LWPs running in the network stack, which eventually results in say use-after-free of a deleted route.
2023-05-28s/explcit/explicit/ in comment.andvar
2023-04-11Give scope and additional details to wg(4) diagnostic messages.jakllsch
2023-04-05s/termintaed/terminated/ in comment.andvar
2023-03-26fix various typos in documentation, comments and sysctl device description.andvar
mainly aion -> ation and inlude -> include.
2023-03-25s/deteted/detected/ in log message.andvar
2023-02-24npf: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.riastradh
Discussed on tech-kern: https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html Requested by rmind@: https://github.com/rmind/npf/pull/127#issuecomment-1399573125
2023-02-24sys/net/if.c: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.riastradh
Discussed on tech-kern: https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html
2023-02-12PR kern/56052:kardel
allow block-return packets passed through without rule matching. Included up-stream as https://github.com/rmind/npf/pull/115
2023-02-12PR kern/55654:kardel
Switch default for parameter npf ip4.reassembly to 1. This makes the NPF default configuration comply with host requirements for IPv4.
2023-02-08bpf.c: support loopback writes when BIOCSHDRCMPLT is setgutteridge
Following changes in r. 1.249 "bpf: support sending packets on loopback interfaces", also allow for this to succeed when the "header complete" flag is set, which is the practice of some tools, e.g., tcpreplay and Scapy. With this change, both of those example tools now work, e.g., Scapy passes "L3bpfSocket - send and sniff on loopback" in its test suite. There are several ways of addressing this issue; this commit is intended to be the most conservative and consistent with the previous changes. (E.g., FreeBSD instead has special handling of this condition in its if_loop.c.)
2023-02-07bpf.c: fix a few typos and grammatical issues in commentsgutteridge
2023-01-23npf(9): Drop table lock around copyout.riastradh
It is forbidden to hold a spin lock around copyout, and t_lock is a spin lock. We need t_lock in order to iterate over the list of entries. However, during copyout itself, we only need to ensure that the object we're copying out isn't freed by npf_table_remove or npf_table_gc. Fortunately, the only caller of npf_table_list, npf_table_remove, and npf_table_gc is npfctl_table, and it serializes all of them by the npf config lock. So we can safely drop t_lock across copyout. PR kern/57136 PR kern/57181
2023-01-22npf(9): Another comment tweak to match upstream.riastradh
No functional change.
2023-01-22npf(9): Update comment to reduce diff from upstream.riastradh
No functional change.
2023-01-22npf(9): Use __HAVE_ATOMIC_AS_MEMBAR around refcnt consistently.riastradh
2023-01-06tap: link up an interface cloned from /dev/tapozaki-r
Fix PR 57155 (partially)
2023-01-05centralize the kauth ugliness.christos
2023-01-05wg(4): Allow non-root to retrieve information other than the privatejakllsch
key and the peer preshared key. Add kauth(9) enums for wg(4) and add use them in suser secmodel. Refines fix for PR 57161.
2023-01-05Check for authorization for SIOCSDRVSPEC and SIOCGDRVSPEC ioctls for wg(4).jakllsch
Addresses PR 57161.
2023-01-04Fix libreswan build failure. Pointed out by Andrew Cagney, thanks.knakahara
2022-12-22route(4): Work around deadlock in rt_free wait path.riastradh
PR kern/56844 XXX pullup-8 XXX pullup-9 XXX pullup-10
2022-12-21ppp: remove ioctls that never worked and crash the kernelchs
Remove vestigial bits of PPP HDLC support that never worked on netbsd. The TIOCRCVFRAME ioctl was apparently intended to be called only from within the kernel, but nothing prevents user code from calling this ioctl and crashing the kernel. Reported-by: syzbot+53e4620d0d17a4dd08fa@syzkaller.appspotmail.com Reported-by: syzbot+d3a8b784fed1e32e0768@syzkaller.appspotmail.com Reported-by: syzbot+375bab63345a6a7a3331@syzkaller.appspotmail.com Reported-by: syzbot+ba7ac85196274a20b54a@syzkaller.appspotmail.com Reported-by: syzbot+57ddb63a3d1d3299ef18@syzkaller.appspotmail.com
2022-11-30bpf: support sending packets on loopback interfacesozaki-r
Previously sending packets on a loopback interface via bpf failed because the packets are treated as AF_UNSPEC by bpf and the loopback interface couldn't handle such packets. This fix enables user programs to prepend a protocol family (AF_INET or AF_INET6) to a payload. bpf interprets it and treats a packet as so, not just AF_UNSPEC. The protocol family is encoded as 4 bytes, host byte order as per DLT_NULL in the specification(*). (*) https://www.tcpdump.org/linktypes.html Proposed on tech-net and tech-kern
2022-11-25Support explicit unnumbered interface.knakahara
Currently, NetBSD supports implicit unnumbered interface by setting the same IP address to two interfaces. However, such interface is not treated as unnumbered when one of the interfaces is being changed and has been changed IP address. That behavior can be harmful for some routing daemons.
2022-11-25KNF. No functional change.msaitoh
2022-11-19bpf: refresh bd_pid in a few more places as wellyamt
This made "netstat -B" show hostapd and wpa_supplicant for me. kingcrab# netstat -B Active BPF peers PID Int Recv Drop Capt Flags Bufsize Comm 433 urtwn0 102 0 2 I-RSH 524288 hostapd 211 urtwn0 102 0 4 I-RS- 32768 dhcpd 670 bwfm0 295 0 2 I-RSH 524288 wpa_supplicant kingcrab#
2022-11-19Make arp have its own mowneryamt
This helped me to debug mbuf leaks in arp. (if_arp.c rev. 1.298)
2022-11-15arp: Validate ARP source hardware address matches Ethernet sourceroy
RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware address must match the hardware address of the interface sending the packet. We can now verify this by checking the mbuf tag PACKET_TAG_ETHERNET_SRC. This fixes an obsure issue where an old router was sending out bogus ARP probes. Thanks to Ryo Shimizu <ryo@nerv.org> for the re-implementation.
2022-11-15Revert prior.roy
2022-11-14net: Store a pointer to the Layer 2 Sender Hardware address in mbufroy
The BSD networking stack is designed around passing a mbuf down the chain and each layer removes the part it's interested in before passing it to the next. This makes it easy for each layer to do it's work, but non trivial to work backwards. As such we now store a pointer to the Senders Hardware address in the mbuf packet header so that protocols can perform any required validation.
2022-11-07Increase sdl_data so that more then IFNAMSIZ bytes are available (again).msaitoh
COMPAT_9 is not required. - The getifaddrs(3) function has no problem. The routing message has no problem because struct rtm_msglen has rtm_msglen and we can get the next message using with it. There is no any kernel data structure which has struct sockaddr_dl foobadr[xxx] array. - A data passed from userland and a kernel data are compared with sockaddr_cmp(). The return value is used to check if the size is inadequate or not. - In the kernel, sdl_len is not directly used for the length of memcpy() but the sockaddr_dl_measure() is used for it.
2022-11-04inpcb: rename functions to inpcb_*ozaki-r
Inspired by rmind-smpnet patches.
2022-10-28Adjust pf, wg, dccp and sctp for struct inpcb integrationozaki-r
2022-10-27Revert if_dl.h change. It'll be commited with the COMPAT_9 code in future.msaitoh
2022-10-26ppp(4): Convert to ttylock/ttyunlock.riastradh
2022-10-26sl(4): Convert to ttylock/ttyunlock.riastradh
2022-10-24Make ifq_drops in struct ifqueue and struct ifaltq 64 bit.msaitoh
2022-10-24Increase sdl_data so that more then IFNAMSIZ bytes are available.msaitoh
- Increase the size of dl_data[] from 12 to 24. - Same as OpenBSD.
2022-10-11Add sadb_x_policy_flags to inform SP origination.knakahara
This extension(struct sadb_x_policy) is *not* defined by RFC2367. OpenBSD does not have reserved fields in struct sadb_x_policy. Linux does not use this field yet. FreeBSD uses this field as "sadb_x_policy_scope"; the value range is from 0x00 to 0x04. We use from most significant bit to avoid the above usage.
2022-10-06Fix overflow case detected by clang. Pointed out by wsh@IIJ, thanks.knakahara
2022-10-04Fix comment (!COMPAT_RTSOCK case). No functional change.msaitoh
2022-09-30ipsecif(4) can use fixed SP reqid based on ifindex, that can reduce number ↵knakahara
of reqid. If we want to use fixed SP reqid for ipsecif(4), set net.ipsecif.use_fixed_reqid=1 Default(=0) is the same as before. net.ipsecif.use_fixed_reqid can be changed only if there is no ipsecif(4) yet. If we want to change the range of ipseif(4) SP reqid, set net.ipsecif.reqid_base and net.ipsecif.reqid_last. These can also be changed only if there is no ipsecif(4) yet.
2022-09-20Remove routes on an address removal if the routes referencing to the ↵knakahara
address. Implemented by ozaki-r@n.o. A route that has a gateway is on a connected route can be invalid if the connected route is deleted, i.e., an associated address is removed. Traditionally NetBSD doesn't sweep such a route on the address removal. Sending packets over the route fails with "No route to host". Also the route holds an orphan ifaddr as rt_ifa that is destructed say by in_purgeaddr. If the same address is assgined again in such a state, there can be two different ifaddr objects with the same address. Until recently it's not a big problem because we can send packets anyway. However after MP-ification of the network stack, we can't send packets because we strictly check if rt_ifa (i.e., the (old) ifaddr) is valid. This change automatically removes such routes on a removal of an associated address to avoid keeping inconsistent routes.
2022-09-18Eliminate use of IFF_OACTIVE.thorpej
2022-09-18Typo in commentmartin
2022-09-04Fix "MPLS handled this" detection logic in the rump environment.thorpej
2022-09-04In pktq_flush():thorpej
- Run a dummy softint at IPL_SOFTNET on all CPUs to ensure that the ISR for this pktqueue is not running (addresses a pre-existing XXX). - Hold the barrier lock around the critical section to ensure that implicit pktq_barrier() calls via pktq_ifdetach() are held off during the critical section. - Ensure the critical section completes in minimal time by not freeing memory during the critical section; instead, just build a list of the packets pulled out of the per-CPU queues and free them after the critical section is over.