MCPcopy Index your code
hub / github.com/secdev/scapy / _interface_selection

Function _interface_selection

scapy/sendrecv.py:672–688  ·  view source on GitHub ↗

Select the network interface according to the layer 3 destination

(packet: _PacketIterable)

Source from the content-addressed store, hash-verified

670
671
672def _interface_selection(packet: _PacketIterable) -> Tuple[NetworkInterface, bool]:
673 """
674 Select the network interface according to the layer 3 destination
675 """
676 _iff, src, _ = next(packet.__iter__()).route()
677 ipv6 = False
678 if src:
679 try:
680 inet_pton(socket.AF_INET6, src)
681 ipv6 = True
682 except (ValueError, OSError):
683 pass
684 try:
685 iff = resolve_iface(_iff or conf.iface)
686 except AttributeError:
687 iff = None
688 return iff or conf.iface, ipv6
689
690
691@conf.commands.register

Callers 4

sendFunction · 0.85
srFunction · 0.85
srfloodFunction · 0.85
sr1floodFunction · 0.85

Calls 4

inet_ptonFunction · 0.90
resolve_ifaceFunction · 0.90
routeMethod · 0.45
__iter__Method · 0.45

Tested by

no test coverage detected