Page MenuHomeFreeBSD

linux: add sysctl to pass untranslated interface names
ClosedPublic

Authored by melifaro on Jan 8 2022, 3:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 27, 5:41 PM
Unknown Object (File)
Sun, Nov 24, 4:59 AM
Unknown Object (File)
Nov 19 2024, 12:58 PM
Unknown Object (File)
Nov 19 2024, 12:10 PM
Unknown Object (File)
Nov 19 2024, 11:10 AM
Unknown Object (File)
Nov 3 2024, 7:44 PM
Unknown Object (File)
Oct 9 2024, 7:19 PM
Unknown Object (File)
Oct 7 2024, 6:02 PM
Subscribers

Details

Summary

Currently, we convert all interfaces of type IFT_ETHER to eth%d format. This was done back in the days where all Linux network interfaces were named eth%d and lots of programs assumed the existence of eth0.

Nowadays, with a plethora of virtual interfaces and Predictable Network Interface Name widely used, we can consider using unmodified interface names.

The driving factor for this diff is the upcoming support for AF_NETLINK, where real interface names are highly desired.

Test Plan
15:39 [0] m@devel0 cat /compat/linux/proc/net/dev
Inter-|                                                   Receive|  Transmit
  face|bytes    packets errs drop fifo frame compressed multicast|  bytes    packets errs drop fifo colls carrier compressed
  eth0:   39068     388    0    0    0     0          0        43   231423     388    0    0    0     0       0          0
   lo0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

15:52 [0] m@devel2 ip route get 1.1.1.1
0.0.0.0/0 via 10.0.0.1 dev eth0 proto unspec

AFTER:

15:52 [0] m@devel2 s sysctl compat.linux.use_real_ifnames=1
compat.linux.use_real_ifnames: 0 -> 1
15:39 [0] m@devel0 cat /compat/linux/proc/net/dev
Inter-|                                                   Receive|  Transmit
  face|bytes    packets errs drop fifo frame compressed multicast|  bytes    packets errs drop fifo colls carrier compressed
vtnet0:   52902     527    0    0    0     0          0        55   245367     484    0    0    0     0       0          0
   lo0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
15:51 [0] m@devel2 ip route get 1.1.1.1
0.0.0.0/0 via 10.0.0.1 dev vtnet0 proto unspec

Diff Detail

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

Event Timeline

melifaro edited the test plan for this revision. (Show Details)
melifaro edited the test plan for this revision. (Show Details)
melifaro added reviewers: trasz, kib, mjg, network.
melifaro edited the summary of this revision. (Show Details)
melifaro edited the test plan for this revision. (Show Details)

remove if_dl.h

This revision is now accepted and ready to land.Jan 8 2022, 6:52 PM
sys/compat/linux/linux_ioctl.c
2124

If you swap then/else bodies, you can avoid using the negation in the condition.

sys/compat/linux/linux_util.c
92

Maybe be more descriptive?
Use FreeBSD interface names instead of generating ethN aliases

331

Inner expressions do not need () around them.

sys/compat/linux/linux_util.h
126

ifp should be put into parenthesis inside the macro body

This revision was automatically updated to reflect the committed changes.
melifaro marked 3 inline comments as done.