-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
dhcp protocol update #1254
Merged
+3,460
−286
Merged
dhcp protocol update #1254
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
f1a9a74
WIP: add an async dhcp client
etene 353efde
add StrEnum and async sock recv compat for python < 3.11
etene 3d009de
remove typing.Self to restore compat with older pythons
etene 3f34271
dnsmasq fixture: ensure consistent output language (LANG=C)
etene e2ce512
dhcp client: indent lease files
etene 14eaf41
dhcp client: split send/recv into separate tasks
etene 2176061
add ETHERTYPE_IP compat for python < 3.12
etene e1d2a4f
typing fixes and compat
etene 52937a2
dhcp client: replace match/case with if/else
etene b6b752a
dhcp client: use Optional everywhere for py39 compat
etene e0566b0
improve dnsmasq fixture & handling of timeouts in dhcp client tests
etene 2a45a26
dhcp client: add basic NAK support
etene ba3d62a
dhcp client: handle expired leases on loading
etene e941c98
dhcp client: fix coroutine warnings in timer callbacks
etene 091056d
dhcp client: fix logic error when loading lease
etene 1e195c4
dhcp client: add comments, improve waiting for state
etene 417a8d9
dhcp client: add a udhcpd fixture and a test with it
etene c5679a0
properly do unicast & broadcast for REQUESTs according to RFC
etene d9128e8
dhcp: Merge pull request #1250 from etene/async-dhcp-client
svinota 5994076
dhcp: fix & improve docstrings after review
etene ea56043
dhcp client: add randomized retransmission interval
etene 9144502
dhcp: fix lease loading logic, improve docstrings
etene e1f5810
dhcp: use an enum for dhcp options
etene 4b855c8
dhcp: typing + udhcpd fixture fixes
etene 5bf05f4
dhcp: fix logic error when sending REQUESTs after init-reboot
etene 298050e
dhcp: properly set bootp flags
etene 000963e
dhcp: fix DHCPRELEASE messages
etene 304e666
dhcp: add missing options
etene ce2da1e
dhcp: use enums instead of magic numbers in encoding/decoding code
etene 8512964
dhcp: make dnsmasq fixture more verbose
etene 93a777b
wip: dhcp: add unit test for packet decoding + small fixes
etene ca9d3ff
wip: move test_raw to test_dhcp
etene 2804a0d
dhcp: add --authoritative option to the dnsmasq fixture
etene a75b881
dhcp client: define mtu dhcp option
BrianBaboch c8b132a
dhcp: prevent the client from getting stuck
etene d5ff980
dhcp: improve & move some tests
etene 4447788
dhcp: add a decoding test for an android dhcp client request
etene 03178b5
dhcp: add a decoding test for a wii dhcp discover message
etene 7bfffdb
dhcp: fix string option parsing bug
etene b492168
dhcp: set 'secs' in messages, fix its endianness
etene ff80277
dhcp client: convert dotted decimal mask to CIDR
BrianBaboch 6ce20a4
dhcp client: routers property should return a list of routers
BrianBaboch b3a25ee
dhcp client: add a default gateway property
BrianBaboch 289aa80
dhcp client: add broadcast and mtu properties
BrianBaboch 50df3db
dhcp client: fix typing and use get to avoid exceptions
BrianBaboch 4c47a4b
dhcp client: implement hook to configure IP
BrianBaboch fb3d7db
dhcp client: we want unbound the hooks in reverse order
BrianBaboch b265592
dhcp client: implement a hook to add default route
BrianBaboch 4a9578c
dhcp client: define dhcp exceptions
BrianBaboch 2c658c6
dhcp client: raise DHCPOptionMissingError if subnet mask option is no…
BrianBaboch 7eeb28a
Merge pull request #1257 from BrianBaboch/add-hooks-and-other-improve…
etene 558a395
dhcp: small post-merge fixes & comments
etene 2dbd1be
dhcp: refactor Options & Parameters, add missing values
etene 68925d8
dhcp: add a unit test for lease renewing
etene b713e5c
dhcp: add EnumType compat for py311, linter fixes
etene bb030b5
dhcp: fix enum mess, try to find a workaround that's valid for all py…
etene 3fe4d5a
dhcp client: send queued messages before stopping
etene 062c1be
WIP: dhcp: refactor transaction id handling
etene 1939fd5
dhcp client: allow to specify xid
svinota d684cb4
format: fix linting
svinota 27e8cd0
dhcp xid: fix annotation for python < 3.10
svinota 634ee39
ci: fix dhcp unit test fixture for python < 3.10
svinota 1643463
dhcp: allow monkeypatching xids for tests
etene 4b9d731
dhcp: rewrite hooks to be more flexible
etene 1ca5815
ci: fast/offline nox sessions
svinota 26cd5f7
dhcp client: add an option to write a pidfile
etene 85a4bcc
dhcp client: allow trying once to get a lease then exiting, like dhcl…
etene d1862ae
dhcp: use pyroute2 instead of iproute2 calls in veth test fixture
etene ecb8bb1
dhcp: add a parser test for a washing machine REQUEST
etene 3254c13
dhcp: clean up stuff, add comments, FIXME & TODOs to prepare for firs…
etene 493f573
dhcp: add unit test for client hooks
etene 100679c
dhcp: add test for the default gw client hooks
etene 580b2e6
dhcp: fix (and skip) default gw hook test
etene a431a72
dhcp: add a unit test for NAK in init-reboot state
etene 36fc51b
dhcp client: make sending a RELEASE configurable
etene c09b762
dhcp client: handle interface state changes without crashing
etene 7d2bd75
dhcp: add unit test for request timeout, fix linter
etene 086ab1f
dhcp: use SystemRandom for xids
etene 12b4b64
dhcp: use time.time instead of datetime for lease timestamps
etene 65122d3
dhcp: improve option & parameter enum declarations
etene d6a7125
dhcp: add test, improve fixtures
etene aa0ff5f
dhcp: fix tests for older python versions
etene 8deea4a
dhcp: factorize dhcp option access in leases
etene 4c0be0b
dhcp: refactor cli main()/run_client()
etene 1828465
dhcp: fix python compat for cli.py
etene b036527
dhcp: add a test for a flapping interface + option to disable hooks
etene cae84a2
dhcp: add test for the client pidfile
etene a50a02c
dhcp: fix linter, more TimeoutError fixes (?) for older pythons
etene 073d67e
dhcp: add options to lease, add hook timeout, try to fix flaky test
etene deab017
dhcp: typing & style fixes
etene c5a8f20
dhcp: add wrong xid test, improve & test cli errors
etene 2f2976e
dhcp: add a test for unexpected DHCP message, some client refactoring
etene ea077f6
dhcp: add missing test pcaps
etene e7b5783
dhcp: don't crash ip addr hooks when server doesn't provide a broadca…
etene 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,5 @@ benchmark.log | |
venv | ||
.venv | ||
.nox* | ||
tests/*.db | ||
tests/*.json |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'''Compatibility with older but supported Python versions''' | ||
|
||
try: | ||
from enum import StrEnum # noqa: F401 | ||
except ImportError: | ||
from enum import Enum | ||
|
||
class StrEnum(str, Enum): | ||
'''Same as enum, but members are also strings.''' | ||
|
||
|
||
try: | ||
from socket import ETHERTYPE_IP | ||
except ImportError: | ||
# ETHERTYPE_* are new in python 3.12 | ||
ETHERTYPE_IP = 0x800 | ||
|
||
|
||
__all__ = ('StrEnum', 'ETHERTYPE_IP') |
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
In some coming PRs I have to change to parameter values from the enums
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.
I could do it but i'm starting to think maybe the parameter list should be left empty at this level by default, since there are already default parameters set at the client & cli levels, and one might very well want to send DHCP messages without parameters for testing purposes.