scapy icon indicating copy to clipboard operation
scapy copied to clipboard

support rfc8950 nexthop in Linux routing table

Open jkldgoefgkljefogeg opened this issue 4 years ago • 5 comments

Brief description

An IPv6 only link can transparently transport IPv4 packets (no IPv4 configured on link) using a IPv6 nexthop's MAC

example setup https://ungleich.ch/u/blog/how-to-route-ipv4-via-ipv6/

$ ip route
default via inet6 fe80::21b:21ff:febb:6934 dev wlp0s20f3 src 169.265.0.30

Environment

  • Scapy version: 2.4.4
  • Python version: 3.8.6
  • Operating System: Centos 8

How to reproduce

send IPv4 packet at L3 with sr()

Actual result

scapy doesn't properly set up L2, packets never got sent (silent failure)

Expected result

based on routing table, scapy automatically sets Ether()

Related resources

https://tools.ietf.org/html/rfc8950 https://ungleich.ch/u/blog/how-to-route-ipv4-via-ipv6/

jkldgoefgkljefogeg avatar Mar 05 '21 21:03 jkldgoefgkljefogeg

I was able to make it work using sendp() with correct Ether(). This issue is about having L3 send to automatically populate the correct L2 encapsulation for IPv4 with a IPv6 nexthop.

jkldgoefgkljefogeg avatar Mar 06 '21 00:03 jkldgoefgkljefogeg

That's interesting!

Quick question: how would the IPv4 stack chose a source IP address when no route exists? Based on the interfaces's address?

Thanks!

p-l- avatar Mar 06 '21 18:03 p-l-

IPv4 addresses are bound to lo interface, and IPv4 default route can include a src like default via inet6 fe80::21b:21ff:febb:6934 dev wlp0s20f3 src 169.265.0.30

jkldgoefgkljefogeg avatar Mar 07 '21 00:03 jkldgoefgkljefogeg

Thanks for your answer!

p-l- avatar Mar 08 '21 10:03 p-l-

That is something that we could support once #3275 is merged.

guedou avatar Jul 11 '21 11:07 guedou