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

Unable to set IP6_TNL_F_IGN_ENCAP_LIMIT on ip6tnl #1184

Open
spike77453 opened this issue Mar 2, 2024 · 1 comment
Open

Unable to set IP6_TNL_F_IGN_ENCAP_LIMIT on ip6tnl #1184

spike77453 opened this issue Mar 2, 2024 · 1 comment
Labels

Comments

@spike77453
Copy link

spike77453 commented Mar 2, 2024

Hi,

I'm trying to set up an ip6tnl interface (mode ipip6) with the IP6_TNL_F_IGN_ENCAP_LIMIT flag set. With ip link this can be done by running

ip link add mytunnel type ip6tnl mode ipip6 local <local_addr> remote <remote_addr> encaplimit none

(see https://github.com/iproute2/iproute2/blob/68eef949c29e02261063de641762e37fda7193d3/ip/link_ip6tnl.c#L193-L195)

When running the following snippet (ip6tnl_encap_limit='none' is obviously not a valid option):

    ipr = IPRoute()
    ipr.link('add',
        ifname='mytunnel',
        kind='ip6tnl',
        ip6tnl_local=ip6tnl_local,
        ip6tnl_remote=aftr_address,
        ip6tnl_encap_flags=0x1,
        ip6tnl_ttl=64,
        ip6tnl_proto=4
    )
    ipr.link('set', ifname='mytunnel', state='up')

the outgoing traffic still has a tunnel encapsulation limit set. The IPv6 headers look like this:

  • When doing ip link add ...:
    60 0d 19 00 00 54 04 40 src dest
    
  • When running the snippet mentioned above (notice the next header field 04 vs. 3c plus 8 extra payload bytes):
    60 09 47 32 00 5c 3c 40 src dest 04 00 04 01 04 01 01 00
    

This is due to the tunnel being created with encaplimit 0 instead of encaplimit none:

# ip -6 tunnel
mytunnel: ip/ipv6 remote <remote_addr> local <local_addr> encaplimit 0 hoplimit 64 tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000)

vs.

# ip -6 tunnel
mytunnel: ip/ipv6 remote <remote_addr> local <local_addr> encaplimit none hoplimit 64 tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000)

The IP6_TNL_F_IGN_ENCAP_LIMIT flag is defined here: ip6_tunnel.h#L13
ip6tnl_proto=4 is ipip6, see link_ip6tnl.c#L161-L165 and in.h#L36-L37

@svinota svinota added the bug label Mar 4, 2024
@svinota
Copy link
Owner

svinota commented Mar 4, 2024

Thanks for the detailed report, investigating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants