Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCP Proxy Does Not Report Option 12 (Hostname) #676

Open
apsoyka opened this issue Apr 19, 2023 · 9 comments
Open

DHCP Proxy Does Not Report Option 12 (Hostname) #676

apsoyka opened this issue Apr 19, 2023 · 9 comments
Labels

Comments

@apsoyka
Copy link
Contributor

apsoyka commented Apr 19, 2023

Currently, the DHCP proxy does not report option 12 (client hostname) to the DHCP server when requesting a DHCP lease. This means that routers which function also as a DNS server (most consumer routers), and use that information in order to create an A record pointing to the DHCP client, will not function.

This issue does not affect the core DHCP proxy functionality, but instead represents a quality-of-life issue.

I would be willing to submit a PR for this, but I'm not familiar with the codebase; could someone please point me in the direction of the necessary changes?

@Luap99
Copy link
Member

Luap99 commented Apr 20, 2023

It should not be that complicated, however as of of today netavark does not know the host name of a container so the first step would be to send the Hostname from podman to netavark.
The type for podman is defined here: https://github.com/containers/common/blob/536bbe5e7e21d8e2087eee9615f3b3c995955840/libnetwork/types/network.go#L233
Then you need to make podman set this new struct field with the correct value, likely here: https://github.com/containers/podman/blob/911be1cbcb0ad654a8e10666262bdcee50ee54e0/libpod/networking_common.go#L47

Change the type here in netavark to read the new field. Then add it to the grpc type so you can send it to the dhcp-proxy and then you need to figure out how to set this field in for the dhcp call. I checked at it seems the our DHCP library seems to support the Hostname option so it should be possible.

That said I definitely wouldn't call this easy which of course depends on your expertise. The proxy code is definitely not very "clean", so figuring out how it works is not as trivial as it should be.

@agorgl
Copy link
Contributor

agorgl commented Dec 2, 2023

Waiting for this too!

@SilverBut
Copy link
Contributor

Hi @Luap99, I have an implementation on my dev branch. Should I make a PR?

But I'm changing the proto, and maybe this feature should only be enabled if explicitly asked. Please suggest some idea.

@Luap99
Copy link
Member

Luap99 commented Dec 7, 2023

Hi @Luap99, I have an implementation on my dev branch. Should I make a PR?

But I'm changing the proto, and maybe this feature should only be enabled if explicitly asked. Please suggest some idea.

I don't think you need to change the proto at all, there is already a host_name field which should be used. What is missing right now is that podman does not send us the real container hostname so we would need to fix this first.

I have no problem sending the hostname to the dhcp server by default, a hostname is not a secret.

@SilverBut
Copy link
Contributor

@Luap99 Yes, missing container hostname is the problem. Actually the protobuf is changed to provide the container name, as a backup solution if hostname is missing.

Another problem is, DHCP server can actually send a hostname to client. What's worse(better?) is that popular implementations including systemd-networkd and dhcpcd will accept it. But I didn't find related structure about how (and when) to set hostname from netavark. Should this be implemented as well? Will someone want this feature?

@Aaron-Rumpler
Copy link

@Luap99 and @SilverBut Any updates on this?

@Luap99
Copy link
Member

Luap99 commented Apr 29, 2024

No, this is waiting for someone to propose a PR. I don't have time for it.

@SilverBut
Copy link
Contributor

Seems my dev branch have not updated for a while. Let me see what I can do.

@briankoco
Copy link

Using the container name as the dhcp_host_name seems like a reasonable default absent an explicit hostname request. From a podman perspective, interpreting the container name as a DNS hostname also seems reasonable, at least per this comment:
https://github.com/containers/common/blob/536bbe5e7e21d8e2087eee9615f3b3c995955840/libnetwork/types/network.go#L236

... as well as the fact that multiple containers in a podman network can DNS resolve each other via their container names by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants