Commit Graph

3162 Commits

Author SHA1 Message Date
andvar e4ebea9efd fix recently committed typos by msaitoh in few more places, as well as few more.
mainly s/contigous/contiguous/ and s/miliseconds/milliseconds/ in comments.
2024-05-14 19:00:43 +00:00
msaitoh 51508882aa s/unitialized/uninitialized/ 2024-05-12 23:55:57 +00:00
andvar cec4798ac1 s/force_comile_error/force_compile_error/ 2024-04-14 18:02:55 +00:00
knakahara 5a9ce3a7bf Fix invalid IPv6 route when ipsecif(4) is deleted tunnel. Pointed out by ohishi@IIJ.
The pointed bug is fixed by modification in nd6_need_cache().
Others are similar bugs.

XXX pullup-9, 10
2024-04-11 07:34:37 +00:00
andvar a5c0af2445 Add missing "e" in few words, in comments and one log message. 2024-03-17 21:48:01 +00:00
mlelstv 217bab0335 Attribute debug message.
Fixes PR 57959
2024-02-24 21:39:05 +00:00
andvar 100a3398b8 fix spelling mistakes, mainly in comments and log messages. 2024-02-09 22:08:30 +00:00
andvar fef573ec12 s/anthing/anything/ and s/be to/too/ in comments. 2024-02-09 18:20:00 +00:00
andvar 34908c4889 fix various typos in comments. 2024-02-02 22:39:09 +00:00
andvar f22ed7e5e6 fix various typos in comments. 2024-02-02 22:00:32 +00:00
andvar 915340d5d2 Fix few typos in comments, mainly s/argment/argument/. 2024-01-15 19:44:06 +00:00
andvar 5e4abe6a3f fix triple s typos in comments. 2023-12-08 21:46:02 +00:00
bouyer 736e71f64a handle EHOSTDOWN the same way as EHOSTUNREACH in sctp_med_chunk_output().
Compile-tested only (I don't have a sctp setup); proposed in
http://mail-index.netbsd.org/tech-net/2023/09/11/msg008611.html
LGTM from Greg Troxel and Robert Swindells
2023-09-13 15:58:13 +00:00
bouyer 798dd6983f Handle EHOSTDOWN the same way as EHOSTUNREACH and ENETDOWN for established
connections. Avoid premature end of tcp connection with "Host is down" error
in case of transient link-layer failure.
Discussed and patch proposed in
http://mail-index.netbsd.org/tech-net/2023/09/11/msg008610.html
and followups.
2023-09-13 15:54:28 +00:00
andvar c01d8fb5f9 fix typos in comments, mainly s/innner/inner/. 2023-09-01 11:23:39 +00:00
mrg 514f9297ef avoid uninitialised variable use.
found by GCC 12.
2023-08-14 03:03:48 +00:00
andvar f0dcd50e0e fix typos in comments s/iton/tion/ or s/ton/tion/. 2023-08-10 06:44:11 +00:00
mrg 1417562b0b fix indentation issues.
found by GCC 12.
2023-08-07 23:28:58 +00:00
mrg f8570f8a97 fix simple mis-matched function prototype and definitions.
most of these are like, eg

   void foo(int[2]);

with either of these

   void foo(int*) { ... }
   void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
2023-08-01 07:04:14 +00:00
msaitoh d1b93bab8c Fix typo in comment. 2023-06-24 05:27:13 +00:00
rin ef6905b23e White space fixes. No binary changes. 2023-06-16 03:02:30 +00:00
andvar cb40c69b16 follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
also s/beyound/beyond/ and few others along the way, mainly in comments.
2023-06-02 08:51:46 +00:00
mlelstv 2f2ca7363b Again allow multicast packets to be sent from unnumbered interfaces. 2023-04-19 22:00:18 +00:00
ozaki-r 60500579e3 Revert "Fix panic on packet sending via a route with rt_ifa of AF_LINK."
The fix is mistakenly upstreamed.
2023-04-19 02:43:40 +00:00
mlelstv eafba8f7a7 Select virtual address as sender if backing interface is anonymous.
Use correct scope for IPv6.
2023-04-07 06:44:08 +00:00
andvar e31f1e950f remove some double ee typos in comments. 2023-04-05 21:53:56 +00:00
mlelstv 42ae1deb69 Use backing device to send advertisements. Otherwise the packets originate
from the virtual MAC address, which confuses switches.
2023-03-26 10:32:38 +00:00
mlelstv eec672a55c Need larger fat pointers for 128bit cache lines. 2022-12-11 08:09:20 +00:00
knakahara 77d6f5872b Refactor ip_encap.[ch]
- remove encap_attach() which is no longer used
    - remove USE_RADIX code in ip_encap.c, which is used for
      encap_attach() only
    - remove mask members in encaptab
2022-12-07 08:33:02 +00:00
knakahara 45ca136d96 gif(4), ipsec(4) and l2tp(4) use encap_attach_addr(). 2022-12-07 08:30:15 +00:00
knakahara 38a7d4891d Implement encap_attach_addr() which is used by IP-encaped tunnels.
The tunnels attached by encap_attach() can process receiving packets
fastly as the softc is searched by radix-tree.  However, the tunnels
cannot use priority function which decides tunnel's softc by not only
source and destination but also other informations.
On the other hand, the tunnels attached by encap_attach_func() can
use priority function. However, the tunnels can be slow receiving
processing as the softc is searched by linear search (and uses each
priority function).

encap_attach_addr() can be used for tunnels which is fixed tunnel
source address and tunnel destination address.  The tunnels attached
by encap_attach_addr() is searched by thmap(9), so the receiving processing
can be fast.  Moreover, the tunnels can use priority function.
2022-12-07 08:28:46 +00:00
knakahara 0d7c1673ff refactor: use typedef for ip_encap priority function 2022-12-07 08:27:03 +00:00
knakahara 7cb557b6cc Support explicit unnumbered interface.
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-25 08:39:32 +00:00
knakahara 3f61a78cde Fix panic on packet sending via a route with rt_ifa of AF_LINK.
A route with rt_ifa of AF_LINK can be set by some routing daemons when
it adds a route that has a gateway of AF_LINK.  If there is no address on
a target interface, the kernel sets an AF_LINK address of the interface to
rt_ifa of the route.  In that case, a variable of a local address in
ip_output (ia) can be NULL and we need more NULL-checks of it.
2022-11-21 09:51:13 +00:00
yamt 34172d955e Make arp have its own mowner
This helped me to debug mbuf leaks in arp.
(if_arp.c rev. 1.298)
2022-11-19 08:00:51 +00:00
knakahara 77dab346ef Fix sending broken RTM_DELADDR message in some operations.
Here is mininum reproduction operation.
====================
# ifconfig ixg0 172.16.0.1/29
# route monitor &
# ifconfig pppoe0 172.16.0.1/32 0.0.0.1
====================

The broken RTM_DELADDR is the following.
====================
got message of size 72 on Thu Nov 17 12:50:42 2022
#13: len 72, got message of size 80 on Thu Nov 17 12:50:42 2022
RTM_DELADDR: address being removed from iface: len 80, pid 3552, metric 0, addrflags: 0
sockaddrs: 0xb4<NETMASK,IFP,IFA,BRD>
 Q00.00.ff.ff.ff.ff.00.00.00.00.00.00.00.00 pppoe0 default default
====================

This problem is related to the following two commit.

(1) b021021468
    that is, sys/netinet/in.c:r1.183

(2) 61bad33c44
    that is, sys/netinet/in.c:r1.185

(1) adds in_scrubaddr() for old addresses to in_ifinit() without checking
IFA_ROUTE.
And then, (2) removes in_ifscrub() for POINTTOPOINT interface in in_control0.
The removed in_ifscrub() is called with checking IFA_ROUTE.
It seems these modifications about checking IFA_ROUTE logic causes this
problem, however the real reason is calling in_ifscrub() for the interface
which does not have IPv4 address.  So, scrubbing old address processing
should be done only if the interface already has IPv4 address.
2022-11-17 05:02:11 +00:00
roy d66a17fc6d arp: Validate ARP source hardware address matches Ethernet source
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-15 10:47:39 +00:00
roy 7f8cc08460 Revert prior. 2022-11-15 09:13:43 +00:00
roy ef5ec13dab arp: Validate L2 sender hardware address matches ARP probe
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 packet header.

This fixes an obsure issue where an old router was sending out bogus
ARP probes.
2022-11-14 09:32:21 +00:00
ozaki-r 2356928239 ipcb: add/update the description of functions
From rmind-smpnet patches
2022-11-04 09:05:41 +00:00
ozaki-r c8425e7779 inpcb: replace leading white spaces with tabs 2022-11-04 09:05:04 +00:00
ozaki-r 0ead264d2f inpcb: get rid of parentheses for return value 2022-11-04 09:04:27 +00:00
ozaki-r 72d12810d3 inpcb: use NULL 2022-11-04 09:03:56 +00:00
ozaki-r 0fa740c7db inpcb: use in_port_t for port numbers 2022-11-04 09:03:20 +00:00
ozaki-r eb441dc743 inpcb: use pool_cache instead of pool 2022-11-04 09:02:38 +00:00
ozaki-r b000e63f05 inpcb: rename functions to in6pcb_* 2022-11-04 09:01:53 +00:00
ozaki-r 2ba9f052f6 inpcb: rename functions to inpcb_*
Inspired by rmind-smpnet patches.
2022-11-04 09:00:58 +00:00
ozaki-r 24c607fd3f tcp: fix wrong logic in tcp_drop
Pointed out by mlelstv@
2022-10-31 00:56:33 +00:00
ozaki-r 72e94eff7b tcp: restore NULL check for inp in tcp_ctloutput 2022-10-30 08:45:46 +00:00
ozaki-r 20dda336f5 tcp: restore NULL checks for inp 2022-10-29 15:35:16 +00:00