Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv4 routing table is missing entries for additional addresses on the loopback interface #4201

Closed
jvgutierrez opened this issue Dec 4, 2023 · 1 comment · Fixed by #4352
Labels
Milestone

Comments

@jvgutierrez
Copy link

Brief description

Scapy IPv4 routing table is missing additional addresses configured on the lo interface.

Scapy version

2.5.0

Python version

3.11.2

Operating system

Debian bookworm 12.2 running kernel 6.1.52-1

Additional environment information

No response

How to reproduce

Given the following IPv4 and IPv6 addresses assigned to lo:

vgutierrez@ncredir4001:~$ ip addr show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 198.35.26.98/32 scope global lo:LVS
       valid_lft forever preferred_lft forever
    inet6 2620:0:863:ed1a::3/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever

scapy provides an IPv6 routing table that includes 2620:0:863:ed1a::3/128:

>>> conf.route6
Destination                     Next Hop  Iface   Src candidates              Metric
2620:0:863:101::/64             ::        ens13   2620:0:863:101:10:128:0:32  256   
fe80::/64                       ::        ens13   fe80::a800:ff:fe39:c6fc     256   
fe80::/64                       ::        ipip60  fe80::cbd:4aff:fe6b:a7c5    256   
::1/128                         ::        lo      ::1                         0     
2620:0:863:101:10:128:0:32/128  ::        ens13   2620:0:863:101:10:128:0:32  0     
2620:0:863:ed1a::3/128          ::        lo      ::1                         0     
fe80::cbd:4aff:fe6b:a7c5/128    ::        ipip60  fe80::cbd:4aff:fe6b:a7c5    0     
fe80::a800:ff:fe39:c6fc/128     ::        ens13   fe80::a800:ff:fe39:c6fc     0     
::/0                            fe80::1   ens13   2620:0:863:101:10:128:0:32  1024 

But the IPv4 route table is missing 198.35.26.98/32:

>>> conf.route
Network     Netmask        Gateway     Iface  Output IP    Metric
0.0.0.0     0.0.0.0        10.128.0.1  ens13  10.128.0.32  0     
10.128.0.0  255.255.255.0  0.0.0.0     ens13  10.128.0.32  0     
127.0.0.0   255.0.0.0      0.0.0.0     lo     127.0.0.1    1

In fact, if we compare scapy IPv4 route table against the kernel local routing table, quite some entries seem to be missing:

$ ip route show table local
local 10.128.0.32 dev ens13 proto kernel scope host src 10.128.0.32 
broadcast 10.128.0.255 dev ens13 proto kernel scope link src 10.128.0.32 
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1 
local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1 
local 127.0.0.42 dev ipip0 proto kernel scope host src 127.0.0.42 
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1 
local 198.35.26.98 dev lo proto kernel scope host src 198.35.26.98 

Actual result

No response

Expected result

No response

Related resources

No response

@gpotter2 gpotter2 added the bug label Jan 19, 2024
@gpotter2 gpotter2 added this to the 2.6.0 milestone Jan 30, 2024
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 14, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 14, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 14, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 19, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 20, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 20, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
evverx pushed a commit to evverx/scapy that referenced this issue Apr 20, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
evverx pushed a commit to evverx/scapy that referenced this issue Apr 20, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 20, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit to gpotter2/scapy that referenced this issue Apr 20, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
@gpotter2
Copy link
Member

This should be fixed in #4352. Feel free to try it out

evverx pushed a commit to evverx/scapy that referenced this issue Apr 21, 2024
This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes secdev#4201
gpotter2 added a commit that referenced this issue Apr 28, 2024
* Rewrite arch/linux: interfaces/routes loading

This rewrites much of the arch/linux code, in order to use a RTNETLINK
socket instead of reading /proc/net/XXX.

Among those:
- the read_routes(6) functions
- the linux interfaces provider
- arch/linux util functions

This adds support for multiple IPv4 addresses to interfaces, among with
a generally much better handling of routes.

fixes #4201

* Apply guedou suggestions

* Restrain routes to RT_TABLE_LOCAL and RT_TABLE_MAIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants