Page MenuHomeFreeBSD

netlink: fix adding an interface route
ClosedPublic

Authored by takahiro.kurosawa_gmail.com on Aug 5 2023, 5:23 AM.
Tags
None
Referenced Files
F108572603: D41330.id130698.diff
Sun, Jan 26, 12:20 PM
F108566820: D41330.id125615.diff
Sun, Jan 26, 10:28 AM
Unknown Object (File)
Sat, Jan 25, 5:33 PM
Unknown Object (File)
Fri, Jan 24, 8:21 PM
Unknown Object (File)
Mon, Jan 20, 8:30 AM
Unknown Object (File)
Fri, Jan 10, 5:00 AM
Unknown Object (File)
Dec 27 2024, 5:04 AM
Unknown Object (File)
Dec 13 2024, 2:13 AM

Details

Summary

"route add <host> -iface <netif>" for a netif without an IPv4/IPv6 address
fails with EINVAL. Need to use a link-level ifaddr for gw if an ifaddr
for dst is not found as the rtsock-based implementation does.

Test Plan

ifconfig tun0 create
ifconfig tun0 up
route add 192.0.2.1 -iface tun0

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

@melifaro does this change seem correct to you?

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275341
Fixes:

# ifconfig wg1 create
# ifconfig wg1 up
# route -n add 10.2.0.0/24 -interface wg1

This looks good to me.

I have a separate patch that introduces v4 and v6 atf-sh test cases for sbin/route that I will land along with D41436 when it gets a v6 test case soon.

This revision is now accepted and ready to land.Nov 28 2023, 6:00 PM
This revision was automatically updated to reflect the committed changes.