def tun_callback(rawpkt): """ Callback when pkts arrive from the TUN Figure out which client should receive the packet, and forward it along along that client connection. """ msg = VpnMsgWrapper.pkt_msg(rawpkt) pkt = Packet(rawpkt, read_only=True) des_ip = pkt.get_dst() # Lookup the client to which this pkt should be sent. # try: point = VpnServerState.CLIENTS[des_ip] point.transport.write(msg.pack()) except KeyError: logging.getLogger('cb.vpn_dp').debug('no client, dropping') print 'no client, dropping'
def ip_attrib_test(): p = Packet(tlspkt) assert (p.get_src() == '\x48\x0E\xCC\x67') assert (p.get_dst() == '\x80\x59\x50\xF8') assert (p.get_ip_cksum() == 0xc3a7) assert (p.protocol == 6)