The DHCPv4 server doesn't need CAP_NET_ADMIN if always broadcasting.

CAP_NET_ADMIN is needed in the DHCPv4 code to place entries into
the ARP cache. If it's configured to unconditionally broadcast
to unconfigured clients, it never touches the ARP cache and
doesn't need CAP_NET_ADMIN.

Thanks to Martin Ivičič <max.enhanced@gmail.com> for prompting this.
This commit is contained in:
Simon Kelley
2024-02-21 00:46:25 +00:00
parent ccff85ad72
commit 9adbf009a6

View File

@@ -313,8 +313,11 @@ int main (int argc, char **argv)
{
dhcp_init();
# ifdef HAVE_LINUX_NETWORK
/* Need NET_RAW to send ping. */
if (!option_bool(OPT_NO_PING))
need_cap_net_raw = 1;
/* Need NET_ADMIN to change ARP cache if not always broadcasting. */
if (daemon->force_broadcast == NULL || daemon->force_broadcast->list != NULL)
need_cap_net_admin = 1;
# endif
}