Skip to content
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

Upstream development for prpl Foundation (asynchronous DHCPv6 handling, ubus backend, statistics, reconfiguration, ...) #96

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d24959d
dhcpv6: fix wrong retransmission of DHCPv6 Solicit
nicopaulb May 14, 2024
456b4c3
dscp: add option to set dscp value
nicopaulb Sep 30, 2024
77f65b2
dhcpv6: add t1 and t2 transmition
nicopaulb Oct 25, 2024
28ca1c1
dhcpv6: refactor dhcp_request Function
nicopaulb Oct 28, 2024
14ae41e
odhcp6c: enable Non-Blocking DHCPv6 Socket
nicopaulb Oct 29, 2024
27a32d8
odhcp6c: implement asynchronous handling for DHCPv6 State
nicopaulb Oct 29, 2024
ec5a9b1
ubus: connect to UBus backend
nicopaulb Nov 20, 2024
f053854
ubus: emit UBus event on DHCP state changes
nicopaulb Nov 19, 2024
286cd27
ubus: implement UBus method to get states data immediately
nicopaulb Nov 19, 2024
ba550e3
dhcpv6: implement statistics for DHCPv6
nicopaulb Nov 20, 2024
b11a497
reconfigure: implement DHCP reconfiguration
nicopaulb Nov 26, 2024
542ce96
dhcpv6: update server information when a reply to an Information Requ…
nicopaulb Dec 3, 2024
ec0c868
reconfigure: move all configuration functions to a new file
nicopaulb Dec 6, 2024
9c2afdf
odhcp6c: add new argument option to disable script call
nicopaulb Dec 17, 2024
807af87
ubus: implement retransmission configuration via ubus
nicopaulb Jan 20, 2025
e8389d7
ubus: implement ubus methods to force a Renew and Release
nicopaulb Jan 22, 2025
a9cac50
dhcpv6: fix solicit loop when server has no address available
nicopaulb Jan 23, 2025
b59545c
reconfigure: implement configuration token authentication
nicopaulb Jan 31, 2025
f0fbb9d
odhcp6c: fix client exiting if Renew and Rebind fails
nicopaulb Feb 20, 2025
3c815c0
odhcp6c: add failure when -E option is used without ubus support enabled
nicopaulb Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,22 @@ if(${EXT_CER_ID})
add_definitions(-DEXT_CER_ID=${EXT_CER_ID})
endif(${EXT_CER_ID})

set(SOURCES src/odhcp6c.c src/dhcpv6.c src/ra.c src/script.c)
set(SOURCES src/odhcp6c.c src/dhcpv6.c src/ra.c src/script.c src/config.c)

set(LIBRARIES resolv)

option(ENABLE_UBUS "Enable support for ubus" OFF)

if(ENABLE_UBUS)
set(USE_LIBUBOX 1)
add_definitions(-DHAVE_UBUS)
set(SOURCES ${SOURCES} src/ubus.c)
FIND_LIBRARY(ubus_lib NAMES ubus)
set(LIBRARIES ${LIBRARIES} ${ubus_lib})
FIND_PATH(ubus_include_dir NAMES libubus.h)
INCLUDE_DIRECTORIES(${ubus_include_dir})
endif()

if(USE_LIBUBOX)
add_definitions(-DUSE_LIBUBOX)
set(LIBRARIES ${LIBRARIES} ubox)
Expand Down
61 changes: 61 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,64 @@ Environment:
* RA_RETRANSMIT ND Retransmit time
* AFTR The DS-Lite AFTR domain name
* MAPE / MAPT / LW4O6 Softwire rules for MAPE, MAPT and LW4O6

** Ubus Integration **

Build with ENABLE_UBUS flag to connect odhcp6c to ubus. Object is registered at : "odhcp6c.{ifname}."

Events are emitted whenever the DHCPv6 state changes and can replace the use of a state script. The variables are the same as those defined in the State Script section.

The following RPC methods are available:

* *get_state()* : Returns the DHCPv6 state
- OUT : see State Script section
* *get_statistics()* : Returns the packet statistics
- OUT :
- *dhcp_solicit* : Total number of SOLICIT messages sent
- *dhcp_advertise* : Total number of ADVERTISE messages received
- *dhcp_request* : Total number of REQUEST messages sent
- *dhcp_confirm* : Total number of CONFIRM messages sent
- *dhcp_renew* : Total number of RENEW messages sent
- *dhcp_rebind* : Total number of REBIND messages sent
- *dhcp_reply* : Total number of REPLY messages received
- *dhcp_release* : Total number of RELEASE messages sent
- *dhcp_decline* : Total number of DECLINE messages sent
- *dhcp_reconfigure* : Total number of RECONFIGURE messages received
- *dhcp_information_request* : Total number of INFORMATION-REQUEST messages sent
- *dhcp_discarded_packets* : Total number of discarded DHCP packets
- *dhcp_transmit_failures* : Total number of DHCP messages that failed to be transmitted
* *reset_statistics()* : Reset packet statistics
* *reconfigure_dhcp(IN)* : Reconfigure DHCP settings
- IN (optional):
- *dscp* (int) : DSCP value used for DHCP packets
- *release* (bool) : Send a RELEASE message on exit/reset
- *sk_prio* (int) : Packet kernel priority
- *opt_requested* (int[]) : Options to be requested
- *opt_strict* (bool) : Do not request any options except those specified
- *opt_reconfigure* (bool) : Send Accept Reconfigure option
- *opt_fqdn* (bool) : Send Client FQDN option
- *opt_unicast* (bool) : Ignore Server Unicast option
- *opt_send* (string[]) : Options to be sent
- *req_addresses* (string{try|force|none}) : Request addresses
- *req_prefixes* (int) : Request Prefixes (0 = auto)
- *stateful_only* (bool) : Discard advertisements without any address or prefix proposed
- *irt_default* (int) : Default information refresh time (expressed in seconds)
- *irt_min* (int) : Minimum information refresh time (expressed in seconds)
- *rand_factor* (int) : Randomization factor for retransmission timeout
- *msg_solicit* (table) : Retransmission settings for SOLICIT
- *msg_request* (table) : Retransmission settings for REQUEST
- *msg_renew* (table) : Retransmission settings for RENEW
- *msg_rebind* (table) : Retransmission settings for REBIND
- *msg_release* (table) : Retransmission settings for RELEASE
- *msg_decline* (table) : Retransmission settings for DECLINE
- *msg_inforeq* (table) : Retransmission settings for INFORMATION-REQUEST
- *auth_protocol* (string) : Authentication protocol to be used ("None","ConfigurationToken", "ReconfigureKeyAuthentication")
- *auth_token* (string) : Authentication token to be used when AuthenticationProtocol is set to ConfigurationToken
* *renew()* : Force transmission of RENEW/INFORMATION-REQUEST messages
* *release()* : Force transmission of RELEASE message and start new cycle

Input arguments for retransmission settings :
- *delay_max* (int) : Maximum delay of first message (expressed in seconds)
- *timeout_init* (int) : Initial message timeout (expressed in seconds)
- *timeout_max* (int) : Initial message timeout (expressed in seconds)
- *rc_max* (int) : Maximum message retry attempts
Loading