OK, the answer is no. It fails because:
“If the socket protocol supports broadcast and the specified address is a broadcast address for the socket protocol, sendmsg() will fail if the SO_BROADCAST option is not set for the socket.”
The socket set up by dhcpclient.c needs something like this :
int so_broadcast = 1;
status = setsockopt(sockfd,
SOL_SOCKET, SO_BROADCAST,
&so_broadcast, sizeof so_broadcast);
De : freeradius-users-bounces+nicolas.chaigneau=capgemini.com@lists.freeradius.org [mailto:freeradius-users-bounces+nicolas.chaigneau=capgemini.com@lists.freeradius.org]
De la part de Chaigneau, Nicolas
Envoyé : mercredi 9 juillet 2014 09:54
À : freeradius-users@lists.freeradius.org
Objet : Can dhcpclient handle broadcasting ?
Hello,
I’m trying to use dhcpclient to test broadcasting of a DHCP Discover.
I am root so I can use source port 68.
I’m sending the packet to the broadcast address.
I get the following error (returned by sendmsg, called from “sendfromto”): “Permission denied”.
Is it possible to use dhcpclient from FreeRADIUS in broadcast mode ?
Regards,
Nicolas.