From owner-freebsd-bugs@freebsd.org Fri Sep 11 22:38:22 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DA553E88DE for ; Fri, 11 Sep 2020 22:38:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4Bp9dV3GFZz3ysF for ; Fri, 11 Sep 2020 22:38:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 6E0663E86FD; Fri, 11 Sep 2020 22:38:22 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DCB13E85F6 for ; Fri, 11 Sep 2020 22:38:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bp9dV2L2Sz3ykg for ; Fri, 11 Sep 2020 22:38:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F511AD62 for ; Fri, 11 Sep 2020 22:38:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 08BMcMrp018773 for ; Fri, 11 Sep 2020 22:38:22 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 08BMcMln018772 for bugs@FreeBSD.org; Fri, 11 Sep 2020 22:38:22 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 249261] Kernel ignores RTAX_IFP if an exact RTAX_IFA match is found Date: Fri, 11 Sep 2020 22:38:22 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: demiobenour@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2020 22:38:22 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249261 Bug ID: 249261 Summary: Kernel ignores RTAX_IFP if an exact RTAX_IFA match is found Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: demiobenour@gmail.com If an RTM_ADD command on a routing socket includes an RTA_IFA sockaddr, and that sockaddr is an exact match for one of the interfaces in the relevant routing domain, the RTA_IFP sockaddr is ignored. If there are multiple interfaces with the same IP address, this can cause packets to be sent out the wrong interface. I expected that an RTA_IFP sockaddr will always be honored. That is, the route will always use the interface supplied, regardless of what the other sockaddrs in the message are. If the kernel is not able to ensure this, it should return an error. I found this bug on OpenBSD. I don=E2=80=99t have access to a FreeBSD mach= ine, but a cursory look at the source code [1] indicates that FreeBSD likely has the s= ame bug, so I decided to report it just in case. I did manage to create a shell script that reproduces the bug: # replace these by any unused Ethernet pseudo-interfaces IF1=3Dtap0 IF2=3Dtap1 ifconfig "$IF1" destroy 2>/dev/null ifconfig "$IF2" destroy 2>/dev/null dummy_mac=3Dfe:ff:ff:ff:ff:ff dummy_ip=3D192.0.2.5 ifconfig vether0 create lladdr "$dummy_mac" ifconfig "$IF2" create lladdr "$dummy_mac" ifconfig vether0 inet "$dummy_ip" prefixlen 32 route -n delete "$dummy_ip/32" "$dummy_ip" ifconfig "$IF2" inet "$dummy_ip" prefixlen 32 route -n delete "$dummy_ip/32" "$dummy_ip" route -n add -inet 192.0.2.6 -static -iface -llinfo -link "$IF2" -i= fp vether1 -inet -ifa "$dummy_ip" route -n show -inet If the bug affects FreeBSD, the route to 192.0.2.6 will be via $IF2, wherea= s if the bug does not affect FreeBSD, it will be via $IF1. [1]: https://github.com/freebsd/freebsd/blob/9b858c384885d7431a5c82ec28d6142d142= c8bbd/sys/net/route.c#L644-L645 --=20 You are receiving this mail because: You are the assignee for the bug.=