Search code examples
pythonscapy

Understanding the Scapy "Mac address to reach destination not found. Using broadcast." warning


If I generate an Ethernet frame without any upper layers payload and send it at layer two with sendp(), then I receive the "Mac address to reach destination not found. Using broadcast." warning and frame put to wire indeed uses ff:ff:ff:ff:ff:ff as a destination MAC address. Why is this so? Shouldn't the Scapy send exactly the frame I constructed?

My crafted package can be seen below:

>>> ls(x)
dst        : DestMACField         = '01:00:0c:cc:cc:cc' (None)
src        : SourceMACField       = '00:11:22:33:44:55' (None)
type       : XShortEnumField      = 0               (0)
>>> sendp(x, iface="eth0")
WARNING: Mac address to reach destination not found. Using broadcast.
.
Sent 1 packets.
>>> 

Solution

  • Most people encountering this issue are incorrectly using send() (or sr(), sr1(), srloop()) instead of sendp() (or srp(), srp1(), srploop()). For the record, the "without-p" functions like send() are for sending layer 3 packets (send(IP())) while the "with-p" variants are for sending layer 2 packets (sendp(Ether() / IP())).

    If you define x like I do below and use sendp() (and not send()) and you still have this issue, you should probably try with the latest version from the project's git repository (see https://github.com/secdev/scapy).

    I've tried:

    >>> x = Ether(src='01:00:0c:cc:cc:cc', dst='00:11:22:33:44:55')
    >>> ls(x)
    dst        : DestMACField         = '00:11:22:33:44:55' (None)
    src        : SourceMACField       = '01:00:0c:cc:cc:cc' (None)
    type       : XShortEnumField      = 0               (0)
    >>> sendp(x, iface='eth0')
    .
    Sent 1 packets.
    

    At the same time I was running tcpdump:

    # tcpdump -eni eth0 ether host 00:11:22:33:44:55
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
    12:33:47.774570 01:00:0c:cc:cc:cc > 00:11:22:33:44:55, 802.3, length 14: [|llc]