Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Fix sending broken RTM_DELADDR message in some o...



details:   https://anonhg.NetBSD.org/src/rev/6fc7abb445db
branches:  trunk
changeset: 372340:6fc7abb445db
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Nov 17 05:02:11 2022 +0000

description:
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.

diffstat:

 sys/netinet/in.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 087af4496bef -r 6fc7abb445db sys/netinet/in.c
--- a/sys/netinet/in.c  Wed Nov 16 19:38:08 2022 +0000
+++ b/sys/netinet/in.c  Thu Nov 17 05:02:11 2022 +0000
@@ -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 @@
                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);



Home | Main Index | Thread Index | Old Index