

def _open_dhcp_int_socket(self):
    interfaces = netns.iflist(ignore=('lo',))
    if (not interfaces):
        raise UnexpectedError(msg='failed to find single interface in dhcp ns')
    addr = interfaces[0][1]
    recv_s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    recv_s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
    recv_s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    recv_s.bind(('0.0.0.0', DHCP_SERVER_PORT))
    send_s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    send_s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
    send_s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    send_s.bind((addr, DHCP_SERVER_PORT))
    return (recv_s, send_s, addr)

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/cpnr/dhcp_relay.py DhcpRelayAgent._open_dhcp_int_socket/original