[dhcp-agent-commits] dhcp-agent/src dhcp-net.c,1.7,1.8
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2004-05-25 06:46:33
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27147 Modified Files: dhcp-net.c Log Message: now using SO_BINDTODEVICE if possible Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-net.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-net.c 5 Aug 2003 04:58:31 -0000 1.7 --- dhcp-net.c 25 May 2004 06:46:23 -0000 1.8 *************** *** 33,37 **** * * * * * * * * * * * * */ ! int udp_sock_create(uint16_t source_port, ip_addr_t local_addr) { struct sockaddr_in myaddr; --- 33,37 ---- * * * * * * * * * * * * */ ! int udp_sock_create(uint16_t source_port, ip_addr_t local_addr, const char *device) { struct sockaddr_in myaddr; *************** *** 57,60 **** --- 57,70 ---- } + #ifdef HAVE_SO_BINDTODEVICE + + len = (strlen(device) + 1); + if(setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, device, len) < 0) { + ERROR_MESSAGE("unable to set SO_BINDTODEVICE on socket: %s", strerror(errno)); + return -1; + } + + #endif /* HAVE_SO_BINDTODEVICE */ + if(fcntl(sd, F_SETFL, O_NONBLOCK) < 0) { ERROR_MESSAGE("unable to set O_NONBLOCK on socket: %s", strerror(errno)); |