Send and receive packets at layer 3 This determines the interface (or L2 source to use) based on the routing table: conf.route / conf.route6
(x, # type: _PacketIterable
promisc=None, # type: Optional[bool]
filter=None, # type: Optional[str]
nofilter=0, # type: int
*args, # type: Any
**kargs # type: Any
)
| 690 | |
| 691 | @conf.commands.register |
| 692 | def sr(x, # type: _PacketIterable |
| 693 | promisc=None, # type: Optional[bool] |
| 694 | filter=None, # type: Optional[str] |
| 695 | nofilter=0, # type: int |
| 696 | *args, # type: Any |
| 697 | **kargs # type: Any |
| 698 | ): |
| 699 | # type: (...) -> Tuple[SndRcvList, PacketList] |
| 700 | """ |
| 701 | Send and receive packets at layer 3 |
| 702 | |
| 703 | This determines the interface (or L2 source to use) based on the routing |
| 704 | table: conf.route / conf.route6 |
| 705 | """ |
| 706 | if "iface" in kargs: |
| 707 | # Warn that it isn't used. |
| 708 | warnings.warn( |
| 709 | "'iface' has no effect on L3 I/O sr(). For multicast/link-local " |
| 710 | "see https://scapy.readthedocs.io/en/latest/usage.html#multicast", |
| 711 | SyntaxWarning, |
| 712 | ) |
| 713 | del kargs["iface"] |
| 714 | iface, ipv6 = _interface_selection(x) |
| 715 | s = iface.l3socket(ipv6)( |
| 716 | promisc=promisc, filter=filter, |
| 717 | iface=iface, nofilter=nofilter, |
| 718 | ) |
| 719 | result = sndrcv(s, x, *args, **kargs) |
| 720 | s.close() |
| 721 | return result |
| 722 | |
| 723 | |
| 724 | @conf.commands.register |
no test coverage detected