-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Brief description
For point-to-point links (eg VPN), when scapy populates conf.ifaces with interface IP addresses, it uses the peer address rather than the local interface address; thus calls such as get_if_addr will give a wrong IP.
Scapy version
2.6.1
Python version
3.11.0
Operating system
Ubuntu 24.04.2
Additional environment information
I enabled VPN.
How to reproduce
- get on a VPN. It will create a virtual interface like
tun0, which is a point-to-point link. - the command
ip awill show something like
tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1350 qdisc fq_codel state UNKNOWN group default qlen 500
link/none
inet 100.64.100.6 peer 100.64.100.5/32 scope global tun0
indicating that the tunnel has a local interface IP address 100.64.100.6 and peer address 100.64.100.5.
3. scapy's conf.ifaces will erroneously show the peer address 100.64.100.5 as the tun0 interface IP address. Similarly, calls like get_if_addr('tun0') will give that incorrect address.
Actual result
>>> conf.ifaces
Source Index Name MAC IPv4 IPv6
sys 4 tun0 00:00:00:00:00:00 100.64.100.5 fe80::2803:ec2d:7b7d:cdf5
>>> get_if_addr('tun0')
'100.64.100.5'
In contrast:
$ ip a
4: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1350 qdisc fq_codel state UNKNOWN group default qlen 500
link/none
inet 100.64.100.6 peer 100.64.100.5/32 scope global tun0
valid_lft forever preferred_lft forever
Expected result
>>> conf.ifaces
Source Index Name MAC IPv4 IPv6
sys 4 tun0 00:00:00:00:00:00 100.64.100.6 fe80::2803:ec2d:7b7d:cdf5
>>> get_if_addr('tun0')
'100.64.100.6'
Related resources
No response
Metadata
Metadata
Assignees
Labels
No labels