Module Name: src
Committed By: knakahara
Date: Thu Nov 17 05:02:11 UTC 2022
Modified Files:
src/sys/netinet: in.c
Log Message:
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)
https://github.com/NetBSD/src/commit/b0210214689f17ec08988acd7ef8ae9cdc4c68bc
that is, sys/netinet/in.c:r1.183
(2)
https://github.com/NetBSD/src/commit/61bad33c44f2f6a01a030e8aa5840c015716792a
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.
To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/netinet/in.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.244 src/sys/netinet/in.c:1.245
--- src/sys/netinet/in.c:1.244 Fri Nov 4 09:03:20 2022
+++ src/sys/netinet/in.c Thu Nov 17 05:02:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $ */
+/* $NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $");
#include "arp.h"
@@ -1194,7 +1194,11 @@ in_ifinit(struct ifnet *ifp, struct in_i
return error;
}
- if (scrub || hostIsNew) {
+ /*
+ * The interface which does not have IPv4 address is not required
+ * to scrub old address. So, skip scrub such cases.
+ */
+ if (oldaddr.sin_family == AF_INET && (scrub || hostIsNew)) {
int newflags = ia->ia4_flags;
ia->ia_ifa.ifa_addr = sintosa(&oldaddr);