phaethon/kamene

getmacbyip6 final cases are broken

Closed this issue · 6 comments

dkg commented

in scapy/layers/inet6.py, the function getmacbyip6() ends with the following:

    res = neighsol(ip6, a, iff, chainCC=chainCC)

    if res is not None:
        if ICMPv6NDOptDstLLAddr in res:
            mac = res[ICMPv6NDOptDstLLAddr].lladdr
    else:
        mac = res.src
        conf.netcache.in6_neighbor[ip6] = mac
        return mac

    return None

This doesn't make sense. in the stanza following if statement, mac is set but never used (and None is returned). In the else stanza -- where res must be None -- it references a subfield of res , which is guaranteed to fail.

Hi !
This bug is fixed on the official scapy repo (secdev/scapy), which now supports Python 3.
I recommend you to have a look
https://github.com/secdev/scapy

Good day

@GhostofGoes To avoid "confuse emojis", I'll provide the proof.

Here's current secdev/scapy implementation of the getmacbyip6 function:
https://github.com/secdev/scapy/blob/0aeb049606bee9335e62afea58479915bd6e2344/scapy/layers/inet6.py#L116-L155

    res = neighsol(ip6, a, iff, chainCC=chainCC)

    if res is not None:
        if ICMPv6NDOptDstLLAddr in res:
            mac = res[ICMPv6NDOptDstLLAddr].lladdr
        else:
            mac = res.src
        conf.netcache.in6_neighbor[ip6] = mac
        return mac

    return None

What I'm saying is only the truth: this has INDEED been fixed on the main branch. Now please either contribute to scapy3k, or let me point out to users how outdated this fork is.

Thanks for clearing that up, and the link to the fix is appreciated. 😄

I just wasn't sure if the specific issues raised here were fixed in mainline scapy, due to the same message being used across issues.

Thanks for clarifying :)

Issue fixed in the latest commit.

@phaethon Good luck