Commit Graph

27 Commits

Author SHA1 Message Date
Alexandra Sandulescu d14d238422 fuzz: DHCP header parser 2021-10-28 10:37:57 +02:00
Dario Nieuwenhuis 6d37633353 wire/dhcp: use bitflags for the FLAGS field. 2021-10-14 14:02:27 +02:00
Dario Nieuwenhuis fc5559069c wire/dhcp: BROADCAST flag is MSB (0x8000), not LSB (0x0001).
This fixes DHCP on Linksys WRT1900AC. With 0x0001, it would not reply to
DISCOVERs at all, probably because seeing an unknown reserved flag being set.
With 0x8000, it works fine.
2021-10-14 13:59:16 +02:00
Anton Romanov 7a83e7d69b dhcpv4: Emit DNS servers in repr 2021-06-28 20:03:39 +02:00
Dario Nieuwenhuis 98fe17890a rustfmt 2021-06-27 09:31:59 +02:00
Dario Nieuwenhuis b9477f25bc wire/dhcp: Simplify how options are emitted. 2021-05-29 01:44:27 +02:00
Dario Nieuwenhuis ea8d2ae7f4 Fix u32::MAX 2021-05-29 01:32:17 +02:00
Anton Romanov 7b6b70d058 Account for lease time, router and subnet options in DhcpRepr::buffer_len 2021-05-29 01:32:17 +02:00
Dario Nieuwenhuis 53b62cfbad dhcp: remove 0.0.0.0s from the DNS serevr list.
tp-link routers pad the DNS server list with 0.0.0.0 to a fixed size :(
2021-04-13 18:43:23 +02:00
Dario Nieuwenhuis 0d53163c55 dhcp: convert to socket 2021-04-07 19:00:36 +02:00
Dario Nieuwenhuis d64c8593f0 Add defmt logging support 2021-04-01 01:30:47 +02:00
Ryan Summers 2851a135df Adding parsing test with lease time 2021-03-12 17:36:43 +01:00
Ryan Summers 39c3e7ef1f Updating control logic 2021-03-12 17:28:00 +01:00
Ryan Summers 647e27ed2b Adding DHCP lease management 2021-03-12 14:03:51 +01:00
Alex Crawford 8a961b7d7c Use iterators instead of manually looping
These were flagged by `cargo clippy`:

    warning: the loop variable is used to index

I've verified that this doesn't increase the size of consuming binaries.
Pretty impressive. I tested this with a project that uses the following
features: ethernet, proto-dhcpv4, socket-tcp.
2020-12-28 22:28:07 -08:00
Alex Crawford 752e81489e Dereference match expressions to clean up patterns
These were flagged by `cargo clippy`:

    warning: you don't need to add `&` to all patterns

This should have happened in ac830e8b, but I guess I missed it.
2020-12-27 15:20:16 -08:00
Alex Crawford b2c04416c2 Use is_empty instead of length comparison
These were flagged by `cargo clippy`:

    warning: length comparison to zero
2020-12-27 15:18:51 -08:00
Dario Nieuwenhuis 88256dbdcf Update to Rust 2018. Fixes #271 2020-12-27 17:54:56 +01:00
Scott Mabin 39462d24f4 Add suppor for DHCP maximum message size option. 2019-11-07 04:47:36 +00:00
Chris Ballance 0df7e51a9f Only use first 3 DHCP advertised DNS servers.
The OPT_DOMAIN_NAME_SERVER DHCP option field can advertise an unbounded
DNS servers, but we currently use a fixed length array to store these
servers. This commit ensures only the first 3 (highest priority) servers
are used.

Fixes #305.
2019-09-30 17:19:05 +00:00
Astro 49f638e2d2 Implement DHCPv4 client + example.
Closes: #186
Approved by: whitequark
2019-05-14 00:37:43 +08:00
Astro 633d89b78e Add a few DHCP options
Closes: #255
Approved by: whitequark
2018-07-31 19:26:47 +08:00
M@ Dunlap f3d34b09a2 fixed DHCP constants
Closes: #257
Approved by: whitequark
2018-07-30 22:32:15 +08:00
whitequark 5bcb358eb5 Rename `new` method on Packet types to `new_checked`.
Fixes #195.

Closes: #254
Approved by: dlrobertson
2018-07-11 12:59:05 +08:00
Astro 00b66231e3 Fix DhcpOption::Other serialization. 2018-04-10 20:25:51 +00:00
Corentin Henry 55e75fe85e document the dhcp packet representation (phil-opp/smoltcp#1)
Closes: #75
Approved by: whitequark
2018-03-12 02:29:21 +08:00
Philipp Oppermann 745df22709 Create a DHCP wire module
Closes: #75
Approved by: whitequark
2018-03-12 02:29:21 +08:00