dhcpcd icon indicating copy to clipboard operation
dhcpcd copied to clipboard

WireGuard and TUN interfaces should be ignored by default

Open liweitianux opened this issue 1 year ago • 3 comments
trafficstars

According to the current code, TAP interfaces are ignored by default, but TUN interfaces are not. Why?

In addition, given the availability of WireGuard on various OSes, the WireGuard interfaces should also be ignored by default.

Regards.

liweitianux avatar Mar 02 '24 09:03 liweitianux

Currently, dhcpcd ignores an interface by checking its name. However, the interface can be renamed, at least on FreeBSD and DragonFly BSD. And then the ignoring rules would just not work.

I think an interface should be ignored by checking its type (e.g., IFT_BRIDGE). However, it seems broken for TAP interfaces (with type IF_ETHER) and TUN interfaces (with type IF_PPP). In addition, it seems that BSDs don't provide an ioctl command to retrieve the interface type.

Any ideas?

liweitianux avatar Mar 02 '24 09:03 liweitianux

IFT_BRIDGE and others are checked here: https://github.com/NetworkConfiguration/dhcpcd/blob/master/src/if.c#L604

I'll remove bridge and others with a note that we check the IFT equivalent where we can.

As on interface renaming, yeah it's a nasty problem. IMO if an interface can be renamed is MUST have a mechanism to get the original name.

rsmarples avatar Mar 02 '24 14:03 rsmarples

Hi @rsmarples, thank you for the prompt reply :smile:.

IFT_BRIDGE and others are checked here: https://github.com/NetworkConfiguration/dhcpcd/blob/master/src/if.c#L604

Cool. I didn't know that sdl_type was equivalent to if_type before.

I'll remove bridge and others with a note that we check the IFT equivalent where we can.

That would be better and avoid such confusions.

As on interface renaming, yeah it's a nasty problem. IMO if an interface can be renamed is MUST have a mechanism to get the original name.

Yes, I totally agree. There should be an ioctl command to get this basic information by giving the interface name, including the base name (e.g., em) and unit number.

Do you have any ideas ready? I think we can propose such a request to FreeBSD and DragonFly BSD. I'll certainly implement it in DragonFly :smiley:.

Regards.

liweitianux avatar Mar 02 '24 15:03 liweitianux