Paul Donald [Tue, 18 Nov 2025 00:26:51 +0000 (01:26 +0100)]
dhcpv6: refactor variable names
improve readability
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/123
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 18 Nov 2025 15:46:01 +0000 (16:46 +0100)]
dhcpv6: assign a new field for prefix exclusion length
re-using the priority field is very confusing, for the sake of saving a byte.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/123
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Thu, 20 Nov 2025 11:50:05 +0000 (12:50 +0100)]
dhcpv6: refactor variable names
for ia and pd entries
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/123
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Thu, 20 Nov 2025 11:48:20 +0000 (12:48 +0100)]
dhcpv6: refactor variable names
improve readability
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/123
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Fri, 21 Nov 2025 13:43:20 +0000 (14:43 +0100)]
odhcp6c: set environment script to its current location
The calling script which sets odhcp6c up is currently passed -s as routine,
but synchronize its current location with its calling script, which should make
cross-referencing easier.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/126
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Tue, 18 Nov 2025 07:41:30 +0000 (08:41 +0100)]
github: ci: add MIPS64, PowerPC64 and RISCV64
MIPS64, PowerPC64 and RISCV64 are popular OpenWrt archs.
Refactor the sizes build step to generate the table programatically.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 18 Nov 2025 01:07:58 +0000 (02:07 +0100)]
dhcpv6: restart DHCPv6 on receipt of RA containing a new prefix
When the upstream DHCPv6 server does not provide IA_NA or IA_PD options, odhcp6c
enters into stateless mode, which will not be exited from until SIGUSR2 signal
is received.
This change enforces DHCPv6 restart on receipt of a RA that:
a) advertises the presence of DHCPv6 server on the network, containing
either M or O flags
b) has a PI (prefix information) option that contains a new prefix
thus allowing the switch to DHCPv6 stateful mode when RA PI options suggest that
the upstream DHCPv6 server now manages a new prefix.
Restart is useful even when DHCPv6 client is already in stateful mode, so the
DHCPv6 server will be able to refresh the client's IA_NA and IA_PD options
before renewal timeout is triggered, hence avoiding the usage of potentially
deprecated addresses.
Signed-off-by: Alin Nastac <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/119
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Mon, 17 Nov 2025 03:18:26 +0000 (04:18 +0100)]
dhcpv6: fix processing PIO exclusion loop variable collision
An inner loop variable i potentially collides with the outer loop i, possibly
giving unexpected results.
Commit
b146f9adc80c introduced both the inner and outer loop.
Fixes: b146f9adc80c ("add support for multiple prefixes with distinct IAIDs")
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/124
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Jonas Lochmann [Mon, 3 Nov 2025 00:00:00 +0000 (01:00 +0100)]
odhcp6c: apply draft-ietf-6man-slaac-renum-11 lifetime rules
Instead of applying the complicated ruleset from RFC 4862,
just use the new address information as described in the draft
draft-ietf-6man-slaac-renum-11.
Signed-off-by: Jonas Lochmann <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/114
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Fri, 14 Nov 2025 07:19:17 +0000 (08:19 +0100)]
src: add fallthrough attribute
- Enable fallthrough warnings.
- Use fallthrough attribute instead of comments.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/120
Álvaro Fernández Rojas [Thu, 13 Nov 2025 10:46:51 +0000 (11:46 +0100)]
odhcp6c: properly guard attributes
Properly guard odhcp6c.h attributes with `#ifndef` to avoid redefining them
when including external headers.
Also convert the remaining __attribute__ usages to the custom declarations.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/120
Álvaro Fernández Rojas [Fri, 14 Nov 2025 13:19:31 +0000 (14:19 +0100)]
github: ci: add powerpc arch
PowerPC is another popular OpenWrt arch.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Fri, 14 Nov 2025 13:17:49 +0000 (14:17 +0100)]
github: ci: add cmake build and source directories
Add cmake build and source directories to suppress the following warning:
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Fri, 14 Nov 2025 07:36:51 +0000 (08:36 +0100)]
github: ci: disable json-c tests
Disable BUILD_TESTING to save time when building json-c.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Fri, 14 Nov 2025 07:35:18 +0000 (08:35 +0100)]
scripts: devel-build: disable json-c tests
Disable BUILD_TESTING to save time when building json-c.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Thu, 13 Nov 2025 00:13:51 +0000 (01:13 +0100)]
dhcpv6: DHCPV6_OPT_INFO_REFRESH contains a 4 byte option
we shall not expect data beyond 4 bytes. So the logic should be ==
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Thu, 13 Nov 2025 00:33:19 +0000 (01:33 +0100)]
dhcpv6: use compile time resolved sizeof(struct in6_addr) for IPv6 values
make it evident where 16 byte sizes come from, for the options that take IPv6
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Wed, 12 Nov 2025 23:59:13 +0000 (00:59 +0100)]
dhcpv6: set a static define for DUID max length
so the number 130 isn't so mysterious at first glance.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Thu, 13 Nov 2025 11:24:47 +0000 (12:24 +0100)]
dhcpv6: set static defines for DHCPv6 option header size
so the number 4 isn't so mysterious at first glance.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Thu, 13 Nov 2025 00:43:06 +0000 (01:43 +0100)]
odhcp6c: RFC comments
make spec easier to identify
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Wed, 12 Nov 2025 23:44:40 +0000 (00:44 +0100)]
all: spell fixes
spelling fixes
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Thu, 13 Nov 2025 10:37:25 +0000 (11:37 +0100)]
dhcpv6: dhcpv6_handle_reply switch case handling
shortens jumps and reduces branching.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 11 Nov 2025 14:27:43 +0000 (15:27 +0100)]
dhcpv6: dhcpv6_handle_advert; migrate if blocks to switch case
reduces branching
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 11 Nov 2025 16:40:02 +0000 (17:40 +0100)]
dhcpv6: migrate to switch case for dhcpv6_handle_reply
Indent the if blocks (squash with previous commit)
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 11 Nov 2025 16:57:36 +0000 (17:57 +0100)]
dhcpv6: migrate to switch case for dhcpv6_handle_reply
This cleans up the logic handling a bit, and accelerates the if compares to
jumps. Improves readability. Do not indent some if blocks to make diff easier
to compare.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 11 Nov 2025 14:09:26 +0000 (15:09 +0100)]
all: drop CER_ID
We have removed it from odhcpd since this never saw adoption. Remove here also.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/118
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Mon, 10 Nov 2025 17:26:16 +0000 (18:26 +0100)]
dhcpv6: refactor u8 and u16 to u32 to avoid boolean coercion
ubus coerces u8 to boolean, and one workaround suitable is to amend u8
values (despite them being and containing only a u8 int) to u32 values. ubus
coerces u8 to booleans due to historical reasons. Any calls to e.g.
ubus call odhcp6c.eth1 get_state
(and subsequently downstream dependencies which use this invocation)
return booleans(!) where there shall be a number.
Amended calls to blobmsg_add_u8 into blobmsg_add_u32 to resolve this.
Amended calls to blobmsg_add_u16 into blobmsg_add_u32 also.
Apparently u8 and u16 get padded to u32 anyway.
See @nbd168 https://github.com/openwrt/libubox/pull/25#issuecomment-
3512957433
"
I'd prefer to just deprecate treating u8 as integer and deprecate using u16 in
blobmsg entirely. That way we can avoid a lot of compatibility mess and JSON
conversion issues. Due to padding, u8, u16 and u32 attributes have the same
effective size anyway, so there isn't really a good reason to use them for
integer values.
"
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/117
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Hauke Mehrtens [Sun, 9 Nov 2025 12:26:21 +0000 (13:26 +0100)]
treewide: Replace _unused with _o_unused
A header file in the Linux kernel on powerpc uses the variable name
_unused. This causes the following compile error:
```
In file included from /staging_dir/toolchain-powerpc_8548_gcc-14.3.0_musl/include/signal.h:48,
from /staging_dir/target-powerpc_8548_musl/usr/include/libubox/uloop.h:25,
from /staging_dir/target-powerpc_8548_musl/usr/include/libubus.h:24,
from /build_dir/target-powerpc_8548_musl/odhcp6c-2025.11.04~
b3e1db42/src/ubus.h:67,
from /build_dir/target-powerpc_8548_musl/odhcp6c-2025.11.04~
b3e1db42/src/ubus.c:73:
/staging_dir/toolchain-powerpc_8548_gcc-14.3.0_musl/include/bits/signal.h:27:30: error: expected identifier or '(' before '[' token
27 | unsigned long _unused[4];
| ^
ninja: build stopped: subcommand failed.
make[3]: *** [Makefile:62: /build_dir/target-powerpc_8548_musl/odhcp6c-2025.11.04~
b3e1db42/.built] Error 1
```
Use _o_unused instead to avoid such conflicts.
Signed-off-by: Hauke Mehrtens <[email protected]>
Jerome Küttner [Mon, 20 Oct 2025 16:53:38 +0000 (18:53 +0200)]
dhcpv6: return early upon success
Once a "DHCPV6_Success" status is seen, don’t abort on subsequent
non-Success to prevent "No Address Available" errors.
Signed-off-by: Jerome Küttner <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/90
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 4 Nov 2025 20:36:43 +0000 (21:36 +0100)]
readme: fix description string
The original amendments to README in the prpl patchset contained the same,
but it should read: 'maximum'.
( kind of obvious what it is from the variable name though )
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/115
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 4 Nov 2025 18:30:58 +0000 (19:30 +0100)]
dhcpv6: potential bug fix for checking DHCPV6_OPT_STATUS
follow-up to
b65ff293a96924f9b19dff8855232bfb9054b976
The previous logic checked that the DHCPV6_OPT_STATUS was more than 2 bytes,
which meant that it would only be evaluated if the options *also* contained a
status message. We should handle this option being exactly 2 bytes, so that
DHCPV6_OPT_STATUS lacking a status message are correctly handled.
The relevant RFC section does not state that status message can be absent
https://www.rfc-editor.org/rfc/rfc8415#section-21.13
but the status message field is variable length and sets no mandates on its
size.
This ensures differing interpretations of this portion are handled adequately.
It's not uncommon that various options behave in this 'can be zero length' way,
so let's handle this option similarly.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/113
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Tue, 4 Nov 2025 13:52:00 +0000 (14:52 +0100)]
src: add missing if/else braces
The linux kernel coding style suggests using braces in all if/else blocks
if at least one of the blocks has multiple statements:
https://docs.kernel.org/process/coding-style.html
Let's follow that coding style since it makes the code easier to follow.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Tue, 4 Nov 2025 13:43:28 +0000 (14:43 +0100)]
treewide: remove whitespaces at EOL
Remove all whitespaces located at the end of the lines.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Tue, 4 Nov 2025 13:40:22 +0000 (14:40 +0100)]
src: remove pragma once in headers
Switch existing headers to defines instead of pragma once.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Tue, 4 Nov 2025 13:38:41 +0000 (14:38 +0100)]
src: reorder includes alphabetically
Reorder includes alphabetically which makes them easier to follow and find
duplicates.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Tue, 4 Nov 2025 13:23:11 +0000 (14:23 +0100)]
src: align SoftAtHome license headers format
This commit aligns the new SoftAtHome license headers from prpl foundation
with the existing ones.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 4 Nov 2025 13:34:15 +0000 (14:34 +0100)]
readme: update for prpl patch-set additions
Convert the prpl patch-set additions in markdown.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/111
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 4 Nov 2025 00:16:27 +0000 (01:16 +0100)]
readme: document all environment options
These options were previously undocumented.
Document also an OPTION_x example.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/111
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Tue, 4 Nov 2025 14:26:53 +0000 (15:26 +0100)]
readme: rewrite in markdown
Convert original README to markdown.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/111
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Jonas Lochmann [Mon, 27 Oct 2025 00:00:00 +0000 (01:00 +0100)]
odhcp6c: fix safe interval processing to follow RFC 4862
This resolves an issue occuring in combination with Fritz! upstream
routers that send old prefixes with a valid time of zero for a long
time. Before this change, they were with each received RA extended
to two hours if the prefix was already known before.
Signed-off-by: Jonas Lochmann <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/108
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Fri, 11 Apr 2025 09:40:27 +0000 (09:40 +0000)]
dhcpv6: always include IA_NA and IA_PD in Request message if requested
RFC7550 says that if you request both IA_NA and IA_PD and only one
option is offered in the Advertise, then the client must send a Request
message (and not a Solicit) and the message SHOULD still include both
IA_NA and IA_PD options.
Problem: A Request message is correctly sent instead of a Solicit but it
doesn't include both IA_NA and IA_PD options.
Solution: If IA_NA and IA_PD are requested, the Request message always
includes both options.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Fri, 11 Apr 2025 09:50:07 +0000 (09:50 +0000)]
dhcpv6: fix incorrect IA type being printed in syslog
Problem: If a status error code is received, "IA_NA" is always written
to syslog.
Cause: IA header type is not converted from network byte order to host
byte order.
Solution: Use ntohs() to convert to host byte order.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Thu, 10 Apr 2025 08:51:54 +0000 (08:51 +0000)]
odhcp6c: prevent RELEASE at shutdown when -k is set
Problem: Based on the README, if -k option is set, a RELEASE message
should not be sent when the process is stopped. RELEASE messages are
also not sent in case of a forced RELEASE or reconfiguration, however.
Solution: Stop the transmission of RELEASE messages when the process is
stopped but allow it for a forced RELEASE or reconfiguration.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Thu, 20 Feb 2025 13:07:05 +0000 (13:07 +0000)]
odhcp6c: fix client exiting if Renew and Rebind fails
Problem: odhcp6c exits when no reply is received from the server after
retransmission of Renew/Rebind messages.
Solution: restart the state machine instead of exiting on retransmission
failure.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Fri, 31 Jan 2025 13:44:14 +0000 (13:44 +0000)]
odhcp6c: implement RKAP: Reconfiguration Key Authentication Protocol
Problem: odhcp6c doesn't support authentication protocol other than
the Configuration Token protocol (RFC 3118).
https://www.ietf.org/archive/id/draft-ietf-dhc-rfc8415bis-12.html#name-reconfiguration-key-authent
Solution: implement Reconfiguration Key Authentication Protocol (RKAP)
and add the option to disable all authentication protocols (will discard
all reconfigure messages received).
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Thu, 23 Jan 2025 09:51:31 +0000 (09:51 +0000)]
dhcpv6: fix solicit loop when server has no address available
Problem: If Advertise with status 'noaddravail' is received while IA_NA
is requested, a new Solicit is sent creating an infinite loop.
Solution: Set IA_NA mode to none and send INFO-REQ message if no IA_NA
or IA_PD are available.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Wed, 22 Jan 2025 10:21:48 +0000 (10:21 +0000)]
ubus: implement ubus methods to force a Renew and Release
Problem: Renew/Information-Request or Release messages are sent when
odhcp6c receives signal SIGUSR1 or SIGUSR2.
It should also be possible to trigger these messages via a ubus methods.
Solution: Implement two new ubus methods : release() and renew().
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Mon, 20 Jan 2025 16:05:29 +0000 (16:05 +0000)]
ubus: implement retransmission configuration via ubus
Problem: odhcp6c uses static retransmission parameters defined in
RFC3315.
Solution: Make retransmission parameters configurable via ubus and
update the default values based on RFC8815.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Fri, 21 Feb 2025 08:58:17 +0000 (08:58 +0000)]
odhcp6c: add failure when -E option is used without ubus support enabled
Problem: The -E option disables the state script and relies only on ubus
to emit events on state changes. But if odhcp6c is compiled without ubus
support (ENABLE_UBUS flag omitted), odhcp6c has no way to signal state
changes.
Solution: Return an error when -E flag is used and ubus support is
absent.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Tue, 17 Dec 2024 15:28:15 +0000 (15:28 +0000)]
odhcp6c: add new argument option to disable script call
Problem: odhcp6c call user defined script (or /usr/sbin/odhcp6c-update
by default) on every state update. When using ubus event, this feature
is not needed.
Solution: add a new argument option to disable script call on state
update.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Fri, 6 Dec 2024 10:26:07 +0000 (10:26 +0000)]
reconfigure: move all configuration functions to a new file
Tidy up.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Tue, 26 Nov 2024 16:29:27 +0000 (16:29 +0000)]
reconfigure: implement DHCP reconfiguration
Problem: To update DHCP parameters/options, the process needed to be
restarted with the new arguments. It makes odhcp6c not very flexible,
making it impossible to keep track of the total packet statistics.
Solution: Add a new ubus method to reconfigure DHCP without restarting
the process.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Wed, 20 Nov 2024 16:34:30 +0000 (16:34 +0000)]
dhcpv6: implement statistics for DHCPv6
Problem:
odhcp6c does not provide any statistics.
Solution:
Count the number of packets transmitted or received by message type.
Add a UBus RPC method to get this information.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Tue, 19 Nov 2024 12:46:22 +0000 (12:46 +0000)]
ubus: implement UBus method to get state data immediately
Problem:
odhcp6c state data are transmitted when the DHCPv6 state changes.
If a process subscribes after the start of odhcp6c, then it has to
wait for the next update event.
Solution:
Add a new UBus method "get_state" to get the latest state data
immediately.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Tue, 19 Nov 2024 10:08:36 +0000 (10:08 +0000)]
ubus: emit UBus event on DHCP state changes
Problem:
Whenever the DHCPv6 state changes a custom shell script provided in
an argument on process start is called.
Solution:
In addition to the current script mechanism, emit a UBus event
whenever the DHCPv6 state changes.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Wed, 20 Nov 2024 13:20:49 +0000 (13:20 +0000)]
ubus: connect to UBus backend
Problem:
odhcp6c is not connected to UBus making communication with other
processes more difficult.
Solution:
Connect odhcp6c to UBus back-end when the WITH_UBUS build time
configuration option is set.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Tue, 29 Oct 2024 10:27:13 +0000 (10:27 +0000)]
odhcp6c: implement asynchronous handling for DHCPv6 State
Problem:
The DHCPv6 states were previously handled synchronously, meaning
that while waiting for a response from the server, no other actions
could be performed in odhcp6c.
The process would block inside a loop until a valid response was
received, limiting responsiveness and overall system performance.
Solution:
The new approach involves sending the requests and then
asynchronously monitoring the DHCPv6 socket using poll(). By reading
a response only when there is data available on the socket, the
system remains non-blocking.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Tue, 29 Oct 2024 10:06:15 +0000 (10:06 +0000)]
odhcp6c: enable Non-Blocking DHCPv6 Socket
Problem:
The DHCPv6 socket is currently set to blocking mode, which causes
the program to pause execution whenever it attempts to read from the
socket. This can lead to delays and hinder the overall
responsiveness of the application.
Solution:
Add the set_nonblocking() function, using fcntl() to set the
O_NONBLOCK flag, allowing the socket to operate in non-blocking
mode.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Mon, 28 Oct 2024 14:41:51 +0000 (14:41 +0000)]
dhcpv6: refactor dhcp_request Function
Problem:
The current implementation of the dhcp_request function handles both
sending and receiving messages within the same function. This makes
the function a blocking one, as it waits for a valid response before
proceeding, causing potential delays.
Solution:
The dhcp_request function is refactored into two functions:
one for sending DHCP messages and another for receiving them.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Fri, 25 Oct 2024 15:24:34 +0000 (17:24 +0200)]
dhcpv6: add t1 and t2 transmission
Problem: there was no way to get access to the t1 and t2 that the
dhcpv6 server sends to the client
Solution: add the timing in the Prefix and Address sent to the
environment.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Mon, 30 Sep 2024 09:58:35 +0000 (11:58 +0200)]
dscp: add option to set dscp value
Problem: odhcp6c doesn't support change of DSCP value.
Solution: Adapt odhcp6c to set socket option to change the DSCP value
for dhcpv6 packets.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Nicolas BESNARD [Tue, 14 May 2024 14:19:15 +0000 (16:19 +0200)]
dhcpv6: fix wrong retransmission of DHCPv6 Solicit
When the DHCPv6 client sends a DHCPv6 Solicit with both IA_NA and IA_PD
options, and if the server replies with a status code = NoAddrsAvailable
in the IA_NA option, then currently the DHCPv6 client sends a new
Solicit with only the IA_PD option despite the fact that a prefix was
sent by the server in the previous Advertise.
This behavior is described in
https://datatracker.ietf.org/doc/html/rfc7550#section-4.2
The client must handle the case of a server that does not offer both
valid IA_NA and IA_PD options when both are requested, according to
RFC 7550. It should not send a new Solicit, but a Request. The client
should, however, ignore the Advertise message if none of the IA_NA and
IA_PD options are offered by the server.
Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Mon, 3 Nov 2025 11:29:46 +0000 (12:29 +0100)]
odhcp6c: add a simple build script
Should make it a little bit easier for people who want to contribute.
Link: https://github.com/openwrt/odhcp6c/pull/110
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Mon, 3 Nov 2025 08:58:29 +0000 (09:58 +0100)]
cmake: make libubox mandatory
- Drop USE_LIBUBOX from cmake.
- Drop downstream MD5 implementation.
- Drop libubox variants from Github CI.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/109
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Mon, 3 Nov 2025 08:51:19 +0000 (09:51 +0100)]
cmake: drop EXT_PREFIX_CLASS
This compile definition isn't used.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/109
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Sat, 25 Oct 2025 16:24:35 +0000 (18:24 +0200)]
cmake: disable pedantic
This flag breaks compilation with ubus on aarch64/arm/x86.
The only platform which compiles successfully is mips.
/home/runner/work/odhcp6c/odhcp6c/build/include/libubox/utils.h:126:31: error: invalid application of ‘sizeof’ to a void type [-Werror=pointer-arith]
126 | (sizeof(int) == sizeof(*(1 ? ((void*)((long)(x) * 0l)) : (int*)1)))
| ^
/home/runner/work/odhcp6c/odhcp6c/build/include/libubox/utils.h:140:31: note: in expansion of macro ‘__is_constant’
140 | __builtin_choose_expr(__is_constant(x), \
| ^~~~~~~~~~~~~
/home/runner/work/odhcp6c/odhcp6c/build/include/libubox/utils.h:167:24: note: in expansion of macro ‘__eval_safe’
167 | #define be32_to_cpu(x) __eval_safe(__constant_swap32, x)
| ^~~~~~~~~~~
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/109
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Mon, 3 Nov 2025 06:38:52 +0000 (07:38 +0100)]
github: fix CI apt dependencies
We need to run 'apt update' before installing the APT packages.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Bert Goemans [Thu, 11 Jan 2024 16:17:42 +0000 (17:17 +0100)]
odhcp6c: set server address from Information-request reply
Update the environment variable STATE_SERVER_ADDR with the address
of the DHCPv6 server when a reply to an Information-request message
is received. Without this, there is no way of knowing which server
replied to the Information-request.
This is also consistent with the way that replies to Request and
Rebind messages are handled.
Signed-off-by: Bert Goemans <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/83
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
David Härdeman [Mon, 20 Oct 2025 16:29:36 +0000 (18:29 +0200)]
dhcpv6: use a per-interface IAID for IA_NA requests
This ensures that the same IAID isn't used when odhcpd is e.g. running
on different interfaces (RFC8415, §12). This is more important now that
global DUID support has landed [1], meaning that odhcp6c won't typically
use per-interface DUIDs.
[1] https://github.com/openwrt/openwrt/pull/20359
Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/105
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Sun, 19 Oct 2025 11:02:15 +0000 (13:02 +0200)]
github: improve CI
- Remove unneeded CMAKE_SYSTEM_PROCESSOR.
- Add summary table with sizes (in bytes) for each arch/variant.
- Upload generated binaries as artifacts.
- Add OpenWrt formalities.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Sat, 18 Oct 2025 20:22:41 +0000 (22:22 +0200)]
dhcpv6: Check status code for IA_ADDR operations
Check for error status code in the IA Address option in replies to RENEW
messages.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/103
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Luke Deller [Sun, 1 Dec 2024 02:46:28 +0000 (13:46 +1100)]
dhcpv6: Add error checking to handle renew failure for IA_PD operations
Check for error status code in the IA Prefix option in replies to RENEW
messages.
This fixes a problem where odhcp6c thinks that renewal succeeded, when
actually the upstream router is no longer routing this prefix for us.
See https://github.com/openwrt/odhcp6c/issues/61#issuecomment-
2509536512
Signed-off-by: Luke Deller <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/103
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Sat, 18 Oct 2025 20:48:07 +0000 (22:48 +0200)]
dhcpv6: dhcpv6_parse_ia refactor to switch case
Add RFC comments for certain operations.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/103
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
xuxb [Sun, 3 Dec 2023 07:11:21 +0000 (02:11 -0500)]
odhcp6c: fix deamon raw buffer inc
When starting odhcp6c as a daemon using the following command:
odhcp6c -s /etc/odhcp6c.script -p /var/run/eth0_odhcp6c.pid -P 0 \
-t 120 eth0"
The DHCPv6 server sends RA packets every 10 seconds.
However, it was observed that the raw socket's receive buffer keeps
increasing continuously. After investigating the code, an error was found:
the I/O signal was bound before starting the daemon, causing the daemon to
not receive the I/O signal. Consequently, the raw socket's recv queue kept
growing indefinitely.
The author of this patch is inactive and didn't include a proper SoB:
https://github.com/Horbivores
Link: https://github.com/openwrt/odhcp6c/pull/80
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Paul Donald [Wed, 1 Oct 2025 21:38:13 +0000 (23:38 +0200)]
dhcpv6c: fix illegal DHCPV6_OPT_FQDN
Some message types e.g. DHCPV6_MSG_INFO_REQ contained
DHCPV6_CLIENT_FQDN (39) which is illegal. See Client FQDN RFC4704:
https://www.rfc-editor.org/rfc/rfc4704#section-5
A client MUST only include the Client FQDN option in SOLICIT,
REQUEST, RENEW, or REBIND messages.
https://www.rfc-editor.org/rfc/rfc4704#section-6
Servers MUST only include a Client FQDN option in ADVERTISE and REPLY
messages...
Do not send it unless the message type is appropriate.
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/100
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Gasper Stukelj [Mon, 8 Apr 2024 09:48:09 +0000 (11:48 +0200)]
script: don't ignore RA with zero router lifetime
As per RFC 4861 (section 4.2), 0 is a valid value for
Router Lifetime field in Router Advertisement messages.
To quote from the RFC:
> A Lifetime of 0 indicates that the router is not a
> default router and SHOULD NOT appear on the default
> router list.
In fact, this is the mechanism by which a router,
previously advertising itself as a default router must
invalidate itself. From the RFC 7084 (4.1, G-5):
> By default, if the IPv6 CE router is an advertising
> router and loses its IPv6 default router(s) and/or
> detects loss of connectivity on the WAN interface,
> it MUST explicitly invalidate itself as an IPv6
> default router on each of its advertising interfaces
> by immediately transmitting one or more Router
> Advertisement messages with the "Router Lifetime"
> field set to zero [RFC4861].
Given that Router Lifetime is stored in the `valid`
field of the `struct odhcp6c_entry`, entries with
the field set to 0 shouldn't be ignored when entry
type is `ENTRY_ROUTE`.
Signed-off-by: Gasper Stukelj <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/84
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Alin Nastac [Wed, 3 Jan 2024 14:59:55 +0000 (15:59 +0100)]
odhcp6c: sync and accumulate RA & DHCPv6 events as fast as possible
This fixes commit
dc186d6d2b0d which introduced accumulation delay
differences between the 2 possible scenarios:
1. When DHCPv6 bound event precede RA receival, sync script is called
after 1 second since accumulation has been completed (i.e. RA has
been received).
2. When RA receival precedes DHCPv6 bound event, sync script is called
after a delay of 10 seconds since accumulation is done.
Fixes: dc186d6d2b0d ("odhcp6c: sync and accumulate RA & DHCPv6 events correctly")
Signed-off-by: Alin Nastac <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/82
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Sun, 12 Oct 2025 20:00:18 +0000 (22:00 +0200)]
odhcp6c: update cmake file
Now that the minimum cmake version has been bumped, the cmake file can be
modernized a bit. Although it might look like a lot of changes, most of them
are quite straightforward.
Every library is located in a consistent manner (allowing command-line
overrides of library locations, useful for local development, and also makes it
trivial to do static linking, if desired).
The compiler flags have been broken up to have one per line (making it easy in
the future to add/remove flags, which would create a simple one-line diff).
Although it might look like this bumps the C standard level, cmake is actually
smart enough to pick an earlier version if C11 isn't supported by the compiler
(quite unlikely on any versions of gcc currently in use in OpenWrt and even on
old distros).
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Álvaro Fernández Rojas [Sun, 12 Oct 2025 20:00:18 +0000 (22:00 +0200)]
github: add CI build
Add Github CI supporting different architectures and odhcp6c build options.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
Christian Marangi [Fri, 3 Oct 2025 21:40:21 +0000 (23:40 +0200)]
CMakeLists: update cmake minimum required version to 3.10
New cmake version 4.0 requires at least 3.5 version as the minimum
required version with it increased to 3.10 in to-be-released cmake
versions.
Set the minimum required version to 3.10 to future-proof for future
cmake version.
Suggested-by: Hannu Nyman <[email protected]>
Signed-off-by: Christian Marangi <[email protected]>
Juan Orti Alcaine [Wed, 5 Feb 2025 09:29:40 +0000 (10:29 +0100)]
Use GNUInstallDirs macros
Instead of installing to a hardcoded path, use the macros from GNUInstallDirs.
This allows proper override of the directories at build time.
This was discovered because the package failed to build in Fedora with the
bin-sbin merge change:
https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin
https://bugzilla.redhat.com/show_bug.cgi?id=
2340955
Signed-off-by: Juan Orti Alcaine <[email protected]>
Richard Patterson [Mon, 19 Aug 2024 16:26:52 +0000 (17:26 +0100)]
odhcp6c: Do not request S46 OROs by default
This prevents odhcp6c from requesting MAP-T/E, LW4o6, and DS-Lite options by default, as the required packages aren't installed by default.
This commit should be merged along with commits to the map and ds-lite packages, that add configuration to requests the OROs when the packages are install
Signed-off-by: Richard Patterson <[email protected]>
Vladislav Grishenko [Thu, 25 Jul 2024 19:51:09 +0000 (00:51 +0500)]
odhcp6c: allow to request specific ipv6 prefix
Expand -P option with optional exact ipv6 prefix format.
This allows to keep the IPv6 prefix in some cases, for example
if the prefix is issued dynamically on upstream.
Examples:
-P <length>
-P <prefix/length>
Based on https://github.com/openwrt/odhcp6c/pull/86
pacien [Sun, 9 Apr 2023 20:18:50 +0000 (22:18 +0200)]
odhcp6c: add -K option to set packet kernel priority
This adds a command line option (-K) to set the packet kernel
priority.
This makes it straightforward to set some VLAN priority for DHCP
requests through an egress qos map. (Avoiding the need for firewall
matching and marking through iptables, which prevents using flow
offloading).
(Such priority tag is a hard requirement for some ISPs, such as Orange
in France).
Signed-off-by: Pacien TRAN-GIRARD <[email protected]>
viktor.iarmola [Fri, 21 Jan 2022 12:33:02 +0000 (14:33 +0200)]
dhcpv6: add option to ignore stateless advertise
This change adds a new option to `odhcp6c` that makes it ignore any
advertisement without *both* IA_NA and IA_PD option.
Note that there is already an way to ignore advertisements without IA_NA
specifically (`-N force`) or without IA_PD specifically (`-F`), but there
is no way to express "advertisement MUST have either IA_NA or IA_PD
to be considered" - which is addressed by this change.
There are two primary use-cases for that.
First is to fix an issue with `odhcp6c` behavior when it encounters
a setup with both "stateful" (with IA_NA or IA_PD) and "stateless"
advertisements - and both coming with the same server DUID.
In that case, when the "stateless" advertisement comes last
during the RT window - it will overwrite the advertise entry for that
server DUID and effectively make it seem like we only received
one "stateless" advertisement on the link.
This, in turn, makes `odhcp6c` go into stateless mode
unless there was `-N force` or `-F` involved.
Second use case is as described in the initial part:
when we want to run in "stateful" mode, but would like to accept either
of IA_NA or IA_PD or both of them - and discard other advertisements.
Signed-off-by: Viktor Iarmola <[email protected]>
Dávid Benko [Wed, 13 Jul 2022 07:33:54 +0000 (09:33 +0200)]
odhcp6c: fix IA discard when T1 > 0 and T2 = 0
My ISP uses DHCPv6 advertisements where IA_PD T1 is non-zero (43200) and
T2 is zero. Current implementation of odhcp6c doesn't handle that and
just switches to stateless mode.
According to RFC 8415, section [21.21](https://datatracker.ietf.org/doc/html/rfc8415#section-21.21):
> If a client receives an IA_PD with T1 greater than T2 and both T1 and
T2 are greater than 0, the client discards the IA_PD option and
processes the remainder of the message as though the server had not
included the IA_PD option.
Currently odhcp6c discards IA_PD option if `t1 > t2`:
https://github.com/openwrt/odhcp6c/blob/
39b584bcac8770619b545d6ae344758f87028612/src/dhcpv6.c#L1346-L1347
The same applies for IA_NA.
Fix it by editing IA discard condition according to RFC.
Signed-off-by: Dávid Benko <[email protected]>
Hans Dedecker [Sun, 5 Dec 2021 17:27:07 +0000 (18:27 +0100)]
Revert "dhcpv6: add a minimum valid lifetime for IA_PD updates"
Reverts commit
ca43ea3f436c76fab0b8e3f170725c1d91ebdc36 as
gracefull handling of IA_PD options with valid_liftime 0
is supported in commit
c9578e10428d12c683ceb05e17970a616817f577
Alin Nastac [Wed, 10 Nov 2021 15:02:05 +0000 (16:02 +0100)]
dhcpv6: add support for null IA_PD valid lifetime
This allows immediate removal of the old PD assignments, triggered
by DHCPv6 server messages that contain both old and new IA_PD options:
- new IA_PD, with normal valid & preferred lifetimes
- old IA_PD, with valid & preffered lifetimes set to 0
Signed-off-by: Alin Nastac <[email protected]>
Alin Nastac [Fri, 29 Oct 2021 08:44:10 +0000 (10:44 +0200)]
dhcpv6: add a minimum valid lifetime for IA_PD updates
Prefix delegation is removed when valid lifetime is set to 0,
which will result in current prefix assignments to be preserved
in odhcpd as long as their previously configured valid lifetime
allows it. When IA_PD valid lifetime is set to a small value iso 0,
netifd will update old IA_PD assignments, thus allowing removal
of the old prefixes from downstream interfaces.
Signed-off-by: Alin Nastac <[email protected]>
Guilherme Janczak [Wed, 14 Jul 2021 09:32:45 +0000 (09:32 +0000)]
odhcp6c: use strpbrk to provide get_sep_pos
get_sep_pos is a reimplementation of strpbrk from the stdlib; this
patch removes it and replaces it with strpbrk in its callers.
Signed-off-by: Guilherme Janczak <[email protected]>
Hans Dedecker [Sat, 3 Apr 2021 18:28:11 +0000 (20:28 +0200)]
cmake: enable extra compiler checks
Let's catch enforced compiler errors during compilation
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Sat, 9 Jan 2021 20:17:48 +0000 (21:17 +0100)]
ra: fix routing loop on point to point links
For point-to-point links (e.g. PPP) don't create a link prefix route
when receiving a prefix information option with the on-link flag set.
Point-to-point links are non shared media and as such a destination
IPv6 address cannot be on-link.
If a link prefix route points to a point-to-point link it can trigger
a routing loop if the destination IPv6 address belongs to the prefix.
If such a packet is received and not directed to a local IPv6 address
it will be routed to the point-to-point link due to the link prefix route;
the upstream ISP router will route the IPv6 packet back due to the assigned
prefix route creating a "ping pong" effect
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Wed, 6 Jan 2021 20:15:49 +0000 (21:15 +0100)]
ra: align ifindex resolving
Use ioctl SIOCGIFINDEX to resolve ifindex similar as in init_dhcpv6
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Sat, 26 Dec 2020 20:41:38 +0000 (21:41 +0100)]
dhcpv6: fix displaying IA info
Fix using ntohl and make clear if the recieved IA is either an IA_PD or
IA_NA option
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Sat, 26 Dec 2020 20:38:49 +0000 (21:38 +0100)]
dhcpv6: display status code as a string
For better readibility display the returned status code from the DHCPv6
server as a string
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Tue, 8 Dec 2020 17:43:38 +0000 (18:43 +0100)]
dhcpv6: harden reconfigure logic
Check if a valid DHCPv6 message is returned by dhcpv6_request in
dhcpv6_poll_reconfigure as only RENEW/REBIND/INFORMATION REQUEST
messages can trigger the transmission of these messages in reply
to a RECONFIGURE
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Tue, 8 Dec 2020 17:31:25 +0000 (18:31 +0100)]
dhcpv6: rework DHCPv6 message to string implementation
As the DHCPv6 messages handled by odhcp6c are not numerical consecutive
drop the DHCPv6 message string array
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Mon, 7 Dec 2020 20:26:47 +0000 (21:26 +0100)]
dhcpv6: fix regression
Fixes regression introduced in commit
faed29a.
The DHCPv6 message type need to be returned by dhcpv6_handle_reconfigure
via dhcpv6_request when different from -1 so the correct message type
is passed to dhcpv6_request
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Mon, 7 Dec 2020 20:17:16 +0000 (21:17 +0100)]
dhcpv6: improve syslog tracing
Improve syslog tracing by displaying the DHCPv6 message type
in the received DHCPv6 message and requested DHCPv6 message type in
reply to a RECONFIGURE
Signed-off-by: Hans Dedecker <[email protected]>
Hans Dedecker [Thu, 3 Dec 2020 20:28:41 +0000 (21:28 +0100)]
dhcpv6: only refresh timers when reconfigure is valid
Refresh timers only when a valid DHCPv6 msg-type has been received
in the received DHCPv6 reconfigure
Signed-off-by: Hans Dedecker <[email protected]>