Skip to content

Conversation

oryaacov
Copy link
Contributor

File "/home/zn-admin/.zn-internal/venv3/lib/python3.8/site-packages/iptc/easy.py", line 303, in encode_iptc_rule
    setattr(iptc_rule, name.replace('-', '_'), rule_d[name])
  File "/home/zn-admin/.zn-internal/venv3/lib/python3.8/site-packages/iptc/ip6tc.py", line 486, in set_out_interface
    raise ValueError("interface name %s too long" % (intf))
ValueError: interface name br-13786b5c3131\x00  too long

IPv4 and IPv6 code for getting in/out interface name is different, while IPv6 contained the following bug if the interface name is 15 characters:
for i in range(_IFNAMSIZ): will never run the else section which deletes the last null character using intf = intf[:-1]if the interface name is 15 chars.

I aligned the logic to use the same one as ipv4, since both function are doing the same thing, just in a different way

before the fix:
image
after the fix:
image

@ldx
Copy link
Owner

ldx commented Feb 19, 2025

File "/home/zn-admin/.zn-internal/venv3/lib/python3.8/site-packages/iptc/easy.py", line 303, in encode_iptc_rule
    setattr(iptc_rule, name.replace('-', '_'), rule_d[name])
  File "/home/zn-admin/.zn-internal/venv3/lib/python3.8/site-packages/iptc/ip6tc.py", line 486, in set_out_interface
    raise ValueError("interface name %s too long" % (intf))
ValueError: interface name br-13786b5c3131\x00  too long

IPv4 and IPv6 code for getting in/out interface name is different, while IPv6 contained the following bug if the interface name is 15 characters: for i in range(_IFNAMSIZ): will never run the else section which deletes the last null character using intf = intf[:-1]if the interface name is 15 chars.

I aligned the logic to use the same one as ipv4, since both function are doing the same thing, just in a different way

before the fix: image after the fix: image

This looks good, thank you! Can you also

  1. Add a test case for this
  2. Rebase on current master?

@oryaacov oryaacov force-pushed the fix-interface-name-is-too-big branch from 94d0a6d to e2bfdeb Compare February 22, 2025 19:07
@ldx ldx merged commit 9c9b4b7 into ldx:master Mar 4, 2025
6 checks passed
@ldx
Copy link
Owner

ldx commented Mar 4, 2025

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants