@conf.commands.register
def srp(x, promisc=None, iface=None, iface_hint=None, filter=None, nofilter=0, type=ETH_P_ALL, *args, **kargs):
 if (not kargs.has_key('timeout')):
  kargs['timeout'] = (-1)
 if ((iface is None) and (iface_hint is not None)):
  iface = conf.route.route(iface_hint)[0]
 s = conf.L2socket(promisc=promisc, iface=iface, filter=filter, nofilter=nofilter, type=type)
 (a, b) = sndrcv(s, x, *args, **kargs)
 s.close()
 return (a, b)

@ conf . commands . register def srp ( x , promisc = None , iface = None , iface_hint = None , filter = None , nofilter = 0 , type = ETH_P_ALL , * args , ** kargs ) : if ( not kargs . has_key ( 'timeout' ) ) : kargs [ 'timeout' ] = ( - 1 ) if ( ( iface is None ) and ( iface_hint is not None ) ) : iface = conf . route . route ( iface_hint ) [ 0 ] s = conf . L2socket ( promisc = promisc , iface = iface , filter = filter , nofilter = nofilter , type = type ) ( a , b ) = sndrcv ( s , x , * args , ** kargs ) s . close ( ) return ( a , b )
send and receive packets at layer 2 nofilter: put 1 to avoid use of bpf filters retry: if positive .