scapy icon indicating copy to clipboard operation
scapy copied to clipboard

Fix Segment Routing Pad1 TLV definition

Open yiyuandao opened this issue 1 year ago • 3 comments

In RFC 8754, 2.1.1.1, Pad1 is a single byte.

   0 1 2 3 4 5 6 7
  +-+-+-+-+-+-+-+-+
  |     Type      |
  +-+-+-+-+-+-+-+-+

but in the current implementation, Pad1 are three bytes, b'\x00\x01\x00'

raw(IPv6ExtHdrSegmentRoutingTLVPad1())

This PR fixed it.

Hope it can help.

yiyuandao avatar Dec 16 '24 03:12 yiyuandao

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.04%. Comparing base (316945f) to head (1d2ada8). Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4611   +/-   ##
=======================================
  Coverage   81.04%   81.04%           
=======================================
  Files         365      365           
  Lines       88983    88983           
=======================================
+ Hits        72116    72120    +4     
+ Misses      16867    16863    -4     
Files with missing lines Coverage Δ
scapy/layers/inet6.py 88.57% <100.00%> (ø)

... and 3 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Dec 16 '24 03:12 codecov[bot]

That's kinda already the case: https://github.com/secdev/scapy/blob/53d006b864348dded306cbed9c4d240e733927fb/scapy/layers/inet6.py#L768-L770

I wonder if there isn't a duplicate here

gpotter2 avatar Dec 28 '24 12:12 gpotter2

That's kinda already the case:

https://github.com/secdev/scapy/blob/53d006b864348dded306cbed9c4d240e733927fb/scapy/layers/inet6.py#L768-L770

I wonder if there isn't a duplicate here

Indeed, they are identical functions.

but class Pad1 is for Destination Options and Hop-by-Hop Options. and class IPv6ExtHdrSegmentRoutingTLVPad1 is for Segment Routing Header TLVs.

In my opinion, it appears they are distinct. I think that Pv6ExtHdrSegmentRoutingTLVPad1 ought to have a unique definition of its own.

yiyuandao avatar Jan 07 '25 06:01 yiyuandao

Thanks for the PR & sorry for the huge delay !

gpotter2 avatar Jul 11 '25 11:07 gpotter2