-
Notifications
You must be signed in to change notification settings - Fork 43
Exception when trying to parse an IPv6 address #53
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
Open
Jerome-PS
wants to merge
2
commits into
rshk:master
Choose a base branch
from
Jerome-PS:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't sound right, among other things because "B" cannot have endianness (it's a single byte) and it shouldn't unpack two bytes, but just one.
I would suggest changing this to just be
value[16]without the unpack then.This should be options valid for the interface description block: https://ietf-opsawg-wg.github.io/draft-ietf-opsawg-pcap/draft-ietf-opsawg-pcapng.html#name-interface-description-block (because it matches
python-pcapng/pcapng/blocks.py
Line 277 in 3e13e64
And that option is documented as:
since there's a single octect there's nothing to unpack at all there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Yes, sure, I am not the one who wrote the unpack. I just thought I'd change as little as possible, you should be able to return value[16]. What was faulty was to call unpack with an integer and not a byte array and that caused an exception. As long as there is not exception any more and the integer value is return properly, it's OK.
Oh by the way, you are wrong if you think value[16:17] creates a 2-byte array, it only creates a 1-byte array. value[16:16] creates a 0-byte array. (I know I myself also sometimes get confused about basic python although I use it quite a lot). See: https://docs.python.org/3/library/stdtypes.html#typesseq
4. The slice of s from i to j is defined as the sequence of items with index k such that i <= k < j.Cheers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gha I clearly need to have more coffee before reviewing code, sorry yes it's obvious now that I re-read them.
But yeah please change this to just return the octet, using the unpack on it will just throw the next person reading the code off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you see my new commit?