Page MenuHomeFreeBSD

linux: add sysctl to pass untranslated interface names
ClosedPublic

Authored by melifaro on Jan 8 2022, 3:42 PM.

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
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; 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
91

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

330

Inner expressions do not need () around them.

sys/compat/linux/linux_util.h
125

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.