

def _server_network_relay(self):
    try:
        (self.ext_sock, self.ext_addr) = self._open_dhcp_ext_socket()
    except Exception:
        LOG.exception(_LE('Failed to open dhcp external socket in global ns'))
        return
    recvbuf = bytearray(RECV_BUFFER_SIZE)
    while True:
        try:
            size = self.ext_sock.recv_into(recvbuf)
            pkt = DhcpPacket.parse(recvbuf)
            vpnid = pkt.get_relay_option(151)
            ciaddr = pkt.get_ciaddr()
            if (vpnid not in self.int_sockets_by_vpn):
                continue
            int_sock = self.int_sockets_by_vpn[vpnid]
            self.debug_stats.increment_pkts_from_server(vpnid)
            if (ciaddr == '0.0.0.0'):
                ciaddr = '255.255.255.255'
            LOG.debug('Forwarding DHCP response for vpn %s', vpnid)
            int_sock.sendto(recvbuf[:size], (ciaddr, DHCP_CLIENT_PORT))
            self.debug_stats.increment_pkts_to_client(vpnid)
        except Exception:
            LOG.exception(_LE('Failed to forward dhcp response'))

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