oweals/odhcpd.git
9 years agodhcpv4: use ubus for ipv4 dhcp range calculation
Patrick Grimm [Sun, 14 Jun 2015 22:39:32 +0000 (00:39 +0200)]
dhcpv4: use ubus for ipv4 dhcp range calculation

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
9 years agodhcpv4: add for_each ipv4-address array in ubus_get_address4 ubus_get_mask4 function
Patrick Grimm [Sun, 14 Jun 2015 22:35:50 +0000 (00:35 +0200)]
dhcpv4: add for_each ipv4-address array in ubus_get_address4 ubus_get_mask4 function

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
9 years agodhcpv4: add ubus_get_address4 ubus_get_mask4 function
Patrick Grimm [Sun, 14 Jun 2015 20:55:50 +0000 (22:55 +0200)]
dhcpv4: add ubus_get_address4 ubus_get_mask4 function

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
9 years agodhcpv4: read ipv4-address from UBUS to ADDRESS4
Patrick Grimm [Sun, 14 Jun 2015 19:43:20 +0000 (21:43 +0200)]
dhcpv4: read ipv4-address from UBUS to ADDRESS4

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
9 years agodhcpv6: fix typo
Steven Barth [Thu, 21 May 2015 14:21:59 +0000 (16:21 +0200)]
dhcpv6: fix typo

9 years agodhcpv6-pd: ignore /64 on interface
Steven Barth [Wed, 13 May 2015 12:29:51 +0000 (14:29 +0200)]
dhcpv6-pd: ignore /64 on interface

9 years agodhcpv4: remove invalid free()
Steven Barth [Mon, 11 May 2015 19:49:13 +0000 (21:49 +0200)]
dhcpv4: remove invalid free()

Signed-off-by: Steven Barth <steven@midlink.org>
9 years agoconfig: fix typo in reload_cb
Steven Barth [Tue, 21 Apr 2015 07:42:17 +0000 (09:42 +0200)]
config: fix typo in reload_cb

9 years agodhcpv6: don't initialize IA-handing when turning down interface
Steven Barth [Mon, 20 Apr 2015 17:29:24 +0000 (19:29 +0200)]
dhcpv6: don't initialize IA-handing when turning down interface

9 years agoremove leftover fallout from prefix class support
Steven Barth [Mon, 20 Apr 2015 17:07:45 +0000 (19:07 +0200)]
remove leftover fallout from prefix class support

9 years agoFix logic inversion
Steven Barth [Tue, 14 Apr 2015 14:18:01 +0000 (16:18 +0200)]
Fix logic inversion

Signed-off-by: Steven Barth <steven@midlink.org>
9 years agoFix potential invalid memory access
Steven Barth [Tue, 14 Apr 2015 08:31:10 +0000 (10:31 +0200)]
Fix potential invalid memory access

9 years agora: always send current hop limit
Steven Barth [Fri, 10 Apr 2015 11:52:00 +0000 (13:52 +0200)]
ra: always send current hop limit

9 years agodhcpv6: fix handling of infinite lifetimes
Steven Barth [Mon, 6 Apr 2015 10:47:28 +0000 (12:47 +0200)]
dhcpv6: fix handling of infinite lifetimes

9 years agoproperly handle return codes
John Crispin [Sat, 28 Mar 2015 17:12:21 +0000 (18:12 +0100)]
properly handle return codes

Signed-off-by: John Crispin <blogic@openwrt.org>
9 years agodhcpv6: fix default assignment of non-64
Steven Barth [Mon, 30 Mar 2015 08:53:11 +0000 (10:53 +0200)]
dhcpv6: fix default assignment of non-64

Signed-off-by: Steven Barth <steven@midlink.org>
9 years agodhcpv6: prefer ula over other globals
Steven Barth [Mon, 30 Mar 2015 08:45:38 +0000 (10:45 +0200)]
dhcpv6: prefer ula over other globals

9 years agoReadd missing ubus function definitions
Steven Barth [Mon, 30 Mar 2015 08:08:51 +0000 (10:08 +0200)]
Readd missing ubus function definitions

9 years agoFix hostname export
Steven Barth [Sun, 29 Mar 2015 13:39:20 +0000 (15:39 +0200)]
Fix hostname export

9 years agoRemove prefix coloring support, refine hybrid management mode
Steven Barth [Sun, 29 Mar 2015 12:37:13 +0000 (14:37 +0200)]
Remove prefix coloring support, refine hybrid management mode

9 years agoodhcpd: use proper struct msghdr initializers to fix build error on musl
Felix Fietkau [Sun, 29 Mar 2015 02:31:19 +0000 (04:31 +0200)]
odhcpd: use proper struct msghdr initializers to fix build error on musl

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agoMerge pull request #36 from fingon/compile-fix
Steven Barth [Mon, 2 Mar 2015 15:31:27 +0000 (16:31 +0100)]
Merge pull request #36 from fingon/compile-fix

DHCPv4: Compile fix on 64bit Debian.

9 years agoDHCPv4: Compile fix on 64bit Debian.
Markus Stenberg [Mon, 23 Feb 2015 11:13:36 +0000 (13:13 +0200)]
DHCPv4: Compile fix on 64bit Debian.

9 years agoMerge pull request #29 from mehlis/rework-dhcpv4_assign
Steven Barth [Thu, 19 Feb 2015 14:56:35 +0000 (15:56 +0100)]
Merge pull request #29 from mehlis/rework-dhcpv4_assign

dhcpv4_assign: rework the assignment logic

10 years agoDHCPv6: enable flash-renumbering hack only for /64 prefixes
Steven Barth [Thu, 6 Nov 2014 13:36:19 +0000 (14:36 +0100)]
DHCPv6: enable flash-renumbering hack only for /64 prefixes

10 years agoMerge pull request #30 from dedeckeh/bugfixes
sbyx [Thu, 30 Oct 2014 13:23:35 +0000 (14:23 +0100)]
Merge pull request #30 from dedeckeh/bugfixes

Fix IPv6 DNS server adddress selection

10 years agoFix IPv6 DNS server adddress selection
Hans Dedecker [Thu, 30 Oct 2014 11:30:32 +0000 (12:30 +0100)]
Fix IPv6 DNS server adddress selection

Fix selection of IPv6 DNS address in DHCPv6 and RA overwrite as an address could be selected
with preferred lifetime zero while IPv6 addresses are in use with non zero preferred
lifetimes.
Fix tries to pick the IPv6 address with the longest preferred lifetime now.
Fixes also the issue an IPv6 address with preferred lifetime zero could be returned in DHCPv6
DNS server option while an IPv6 address with non zero preferred lifetime is returned as DNS
recursive RA option for the same set of available IPv6 addresses.

10 years agodhcpv4_assign: rework the assignment logic
Christian Mehlis [Tue, 21 Oct 2014 16:30:46 +0000 (18:30 +0200)]
dhcpv4_assign: rework the assignment logic

10 years agoMerge pull request #28 from mehlis/dhcpv4_assign-clarify
sbyx [Tue, 21 Oct 2014 15:39:48 +0000 (17:39 +0200)]
Merge pull request #28 from mehlis/dhcpv4_assign-clarify

dhcpv4_assign: try 100 times to find a IP

10 years agodhcpv4_assign: try 100 times to find a IP
Christian Mehlis [Tue, 21 Oct 2014 15:34:24 +0000 (17:34 +0200)]
dhcpv4_assign: try 100 times to find a IP

This is what the comment on the loop is saying.
Also change the srand comment to match to the actual code.

10 years agodhcpv6: fix calculation of T1 and T2
Steven Barth [Sat, 18 Oct 2014 15:46:34 +0000 (17:46 +0200)]
dhcpv6: fix calculation of T1 and T2

10 years agondp: more fixes
Steven Barth [Fri, 17 Oct 2014 11:14:47 +0000 (13:14 +0200)]
ndp: more fixes

10 years agondp: fix proxying behavior
Steven Barth [Fri, 17 Oct 2014 10:20:33 +0000 (12:20 +0200)]
ndp: fix proxying behavior

10 years agondp: fix proc-setting
Steven Barth [Fri, 17 Oct 2014 08:04:10 +0000 (10:04 +0200)]
ndp: fix proc-setting

10 years agodhcpv6: allow flash renumbering in hybrid management mode
Steven Barth [Thu, 16 Oct 2014 15:29:19 +0000 (17:29 +0200)]
dhcpv6: allow flash renumbering in hybrid management mode

10 years agoBegin rewrite of NDP-relay
Steven Barth [Thu, 16 Oct 2014 15:19:05 +0000 (17:19 +0200)]
Begin rewrite of NDP-relay

10 years agorouter: add support for router address
Steven Barth [Thu, 16 Oct 2014 15:12:26 +0000 (17:12 +0200)]
router: add support for router address

10 years agorouter: unicast RAs to RS senders by default
Steven Barth [Thu, 16 Oct 2014 09:19:53 +0000 (11:19 +0200)]
router: unicast RAs to RS senders by default

10 years agoconfig: remove spurious free() call
Steven Barth [Thu, 25 Sep 2014 11:52:41 +0000 (13:52 +0200)]
config: remove spurious free() call

10 years agoodhcpd: don't kill static lease entries
Steven Barth [Sat, 23 Aug 2014 12:32:00 +0000 (14:32 +0200)]
odhcpd: don't kill static lease entries

10 years agodhcpv4: fix manual dhcp-ranges
Steven Barth [Tue, 19 Aug 2014 05:37:17 +0000 (07:37 +0200)]
dhcpv4: fix manual dhcp-ranges

10 years agoFix compilation errors in last commit
Steven Barth [Tue, 19 Aug 2014 05:22:29 +0000 (07:22 +0200)]
Fix compilation errors in last commit

10 years agodhcpv6-ia: add logging
Steven Barth [Tue, 19 Aug 2014 05:14:15 +0000 (07:14 +0200)]
dhcpv6-ia: add logging

10 years agoMerge pull request #23 from mehlis/nak-to-broadcast
sbyx [Tue, 19 Aug 2014 04:21:09 +0000 (06:21 +0200)]
Merge pull request #23 from mehlis/nak-to-broadcast

dhcpv4: send Nak to broadcast address

10 years agodhcpv4: log reply in a more precise way
Christian Mehlis [Mon, 18 Aug 2014 11:37:03 +0000 (13:37 +0200)]
dhcpv4: log reply in a more precise way

10 years agodhcpv4: send NAK to broacast address
Christian Mehlis [Mon, 18 Aug 2014 11:36:18 +0000 (13:36 +0200)]
dhcpv4: send NAK to broacast address

10 years agodhcpv4: added more comments
Christian Mehlis [Mon, 18 Aug 2014 11:35:16 +0000 (13:35 +0200)]
dhcpv4: added more comments

10 years agoPD: don't consider deprecated assigned prefixes when calculating avilable PD size
Steven Barth [Wed, 13 Aug 2014 14:53:06 +0000 (16:53 +0200)]
PD: don't consider deprecated assigned prefixes when calculating avilable PD size

10 years agoMerge pull request #22 from mehlis/log-dhcp4-events
sbyx [Tue, 12 Aug 2014 13:10:27 +0000 (15:10 +0200)]
Merge pull request #22 from mehlis/log-dhcp4-events

dhcpv4: log requests and replies to syslog

10 years agoMerge pull request #21 from mehlis/fix-nak-by-doing-valid-reply
sbyx [Tue, 12 Aug 2014 13:05:17 +0000 (15:05 +0200)]
Merge pull request #21 from mehlis/fix-nak-by-doing-valid-reply

dhcpv4: offer a valid configuration with DHCP NAK

10 years agodhcpv4: offer a valid configuration with DHCP NAK
Christian Mehlis [Tue, 12 Aug 2014 12:25:33 +0000 (14:25 +0200)]
dhcpv4: offer a valid configuration with DHCP NAK

On network change the client requests a non valid
configuration. In this case we have to reply with
a DHCP NAK. But this NAK can include a valid
configuration like an ACK does.

With this change iDevices and Androids can finish
DHCP even with wrong configuration in first
REQUEST with two packets and without any additional
timeouts and round trips.

10 years agoMerge pull request #20 from mehlis/implement-dhcp4-router-config
sbyx [Tue, 12 Aug 2014 12:59:36 +0000 (14:59 +0200)]
Merge pull request #20 from mehlis/implement-dhcp4-router-config

dhcpv4: implement router configuration option

10 years agodhcpv4: implement router configuration option
Christian Mehlis [Tue, 12 Aug 2014 12:58:06 +0000 (14:58 +0200)]
dhcpv4: implement router configuration option

RFC 2132 defines:

3.5. Router Option

   The router option specifies a list of IP addresses for routers on the
   client's subnet.  Routers SHOULD be listed in order of preference.

   The code for the router option is 3.  The minimum length for the
   router option is 4 octets, and the length MUST always be a multiple
   of 4.

    Code   Len         Address 1               Address 2
   +-----+-----+-----+-----+-----+-----+-----+-----+--
   |  3  |  n  |  a1 |  a2 |  a3 |  a4 |  a1 |  a2 |  ...
   +-----+-----+-----+-----+-----+-----+-----+-----+--

10 years agodhcpv4: log requests and replies to syslog
Christian Mehlis [Tue, 12 Aug 2014 12:30:02 +0000 (14:30 +0200)]
dhcpv4: log requests and replies to syslog

This change let odhcpd print dhcpv4 events
to syslog.

10 years agoMake failed to send a notice instead of a warning
Steven Barth [Fri, 8 Aug 2014 08:46:39 +0000 (10:46 +0200)]
Make failed to send a notice instead of a warning

10 years agoAdd host-entries for all IPv6 addresses
Steven Barth [Fri, 8 Aug 2014 05:30:34 +0000 (07:30 +0200)]
Add host-entries for all IPv6 addresses

10 years agosync hostfile more often
Steven Barth [Thu, 7 Aug 2014 18:08:31 +0000 (20:08 +0200)]
sync hostfile more often

10 years agora: don't send MSR for /64 prefix if DP is /64 as well
Steven Barth [Thu, 7 Aug 2014 05:51:29 +0000 (07:51 +0200)]
ra: don't send MSR for /64 prefix if DP is /64 as well

10 years agoDon't loose routes in managed PD
Steven Barth [Wed, 23 Jul 2014 21:15:28 +0000 (23:15 +0200)]
Don't loose routes in managed PD

10 years agoRevert "rewrite of NDP proxy" for now
Steven Barth [Tue, 22 Jul 2014 21:35:52 +0000 (23:35 +0200)]
Revert "rewrite of NDP proxy" for now

10 years agoFix typo in ubus integration
Steven Barth [Mon, 21 Jul 2014 21:58:07 +0000 (23:58 +0200)]
Fix typo in ubus integration

10 years agoFix compilation
Steven Barth [Thu, 17 Jul 2014 17:48:14 +0000 (19:48 +0200)]
Fix compilation

10 years agoAdd missing NDP sync features
Steven Barth [Thu, 17 Jul 2014 15:53:40 +0000 (17:53 +0200)]
Add missing NDP sync features

10 years agoInitial rewrite of NDP proxy
Steven Barth [Wed, 16 Jul 2014 12:54:34 +0000 (14:54 +0200)]
Initial rewrite of NDP proxy

10 years agoodhcpd: only enable packet socket if really needed
Steven Barth [Mon, 14 Jul 2014 13:39:12 +0000 (15:39 +0200)]
odhcpd: only enable packet socket if really needed

10 years agoMerge pull request #18 from dedeckeh/bugfixes
sbyx [Wed, 2 Jul 2014 07:28:10 +0000 (09:28 +0200)]
Merge pull request #18 from dedeckeh/bugfixes

Improved compliance with RFC3315

10 years agoReplace option sol_max_rt by inf_max_rt in reply response to information request
Hans Dedecker [Tue, 1 Jul 2014 19:38:01 +0000 (21:38 +0200)]
Replace option sol_max_rt by inf_max_rt in reply response to information request

10 years agoDHCPv6 destination address check
Hans Dedecker [Tue, 1 Jul 2014 19:26:34 +0000 (21:26 +0200)]
DHCPv6 destination address check

As described in RFC3315 §15 any solicit, confirm, rebind or information request message is discarded if the destination address is unicast
Likewise any request (§18.2.1), renew (§18.2.3), release (§18.2.6) or decline (§18.2.7) message is discarded and the server replies with the status code use multicast.

10 years agoDHCPv4: send DHCPNAK if requested addr != leased addr
Steven Barth [Tue, 1 Jul 2014 08:05:30 +0000 (10:05 +0200)]
DHCPv4: send DHCPNAK if requested addr != leased addr

10 years agoMerge pull request #17 from mar-kolya/master
sbyx [Tue, 1 Jul 2014 07:07:02 +0000 (09:07 +0200)]
Merge pull request #17 from mar-kolya/master

leasefile: do not output expired dhcpv6 leases

10 years agoleasefile: do not output expired dhcpv6 leases
Nikolay Martynov [Tue, 1 Jul 2014 02:42:55 +0000 (22:42 -0400)]
leasefile: do not output expired dhcpv6 leases

Sometimes ip that is assigned to a host changes, old ip is still kept aroung as 'expired'.
This expired ip gets dumped into leasefile and is read by dnsmasq.
The result is that hotsname is resolved into expired ip and that confuses clients.
This patch prevents expired leases from being written into leasefile.

10 years agoFixes compile error with musl
Steven Barth [Mon, 30 Jun 2014 07:57:01 +0000 (09:57 +0200)]
Fixes compile error with musl

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoFix DHCPv4 static leases (thanks arnd)
Steven Barth [Wed, 18 Jun 2014 12:05:42 +0000 (14:05 +0200)]
Fix DHCPv4 static leases (thanks arnd)

10 years agouse leaetime as base for T1 and T2 upper bound
Steven Barth [Tue, 17 Jun 2014 07:59:57 +0000 (09:59 +0200)]
use leaetime as base for T1 and T2 upper bound

10 years agobackup for notonlink
Steven Barth [Tue, 17 Jun 2014 07:37:55 +0000 (09:37 +0200)]
backup for notonlink

10 years agoMake hostid more convenient
Steven Barth [Tue, 17 Jun 2014 07:28:37 +0000 (09:28 +0200)]
Make hostid more convenient

10 years agodhcpv6: send NotOnLink status on global level
Steven Barth [Tue, 17 Jun 2014 06:20:53 +0000 (08:20 +0200)]
dhcpv6: send NotOnLink status on global level

10 years agoadd more consistency to host file writing
Steven Barth [Mon, 16 Jun 2014 16:25:56 +0000 (18:25 +0200)]
add more consistency to host file writing

10 years agodhcpv4: update hostfile more often
Steven Barth [Mon, 16 Jun 2014 09:05:03 +0000 (11:05 +0200)]
dhcpv4: update hostfile more often

10 years agoFix option id for hostnames
Steven Barth [Mon, 16 Jun 2014 08:11:12 +0000 (10:11 +0200)]
Fix option id for hostnames

10 years agoconfig: accept domains with trailing .
Steven Barth [Sun, 15 Jun 2014 22:50:17 +0000 (00:50 +0200)]
config: accept domains with trailing .

10 years agodhcpv4: use search domain instead of domain option
Steven Barth [Thu, 12 Jun 2014 08:01:06 +0000 (10:01 +0200)]
dhcpv4: use search domain instead of domain option

10 years agoFix DHCP settings for /28
Steven Barth [Tue, 10 Jun 2014 08:40:14 +0000 (10:40 +0200)]
Fix DHCP settings for /28

10 years agoMerge pull request #14 from dedeckeh/bugfixes
sbyx [Tue, 10 Jun 2014 03:38:14 +0000 (05:38 +0200)]
Merge pull request #14 from dedeckeh/bugfixes

Fix DHCPv6 relay reply message in case raw DHCPv6 attributes are present

10 years agoFix DHCPv6 relay reply message in case raw DHCPv6 attributes are present
Hans Dedecker [Mon, 9 Jun 2014 19:31:40 +0000 (21:31 +0200)]
Fix DHCPv6 relay reply message in case raw DHCPv6 attributes are present

Use enum to index iov struct

10 years agoAdd default DHCPv4 range for prefixes down to /28
Steven Barth [Sat, 7 Jun 2014 10:34:48 +0000 (12:34 +0200)]
Add default DHCPv4 range for prefixes down to /28

10 years agoMake filtering customizable
Steven Barth [Fri, 30 May 2014 14:59:53 +0000 (16:59 +0200)]
Make filtering customizable

10 years agoMove dhcpv6 raw attributes to correct place
Steven Barth [Thu, 29 May 2014 21:00:16 +0000 (23:00 +0200)]
Move dhcpv6 raw attributes to correct place

10 years agoAdd support for raw DHCPv6 attributes
Steven Barth [Sun, 25 May 2014 12:14:52 +0000 (14:14 +0200)]
Add support for raw DHCPv6 attributes

10 years agoMerge pull request #13 from dedeckeh/bugfixes
sbyx [Thu, 24 Apr 2014 09:07:19 +0000 (11:07 +0200)]
Merge pull request #13 from dedeckeh/bugfixes

Bugfixes

10 years agoAdd status code ok option in reply to a decline message
Hans Dedecker [Wed, 16 Apr 2014 14:39:05 +0000 (16:39 +0200)]
Add status code ok option in reply to a decline message

RFC3315 Section 18.2.7 states a status code OK needs to be returned by the server :
After all the addresses have been processed, the server generates a  Reply message and
includes a Status Code option with the value Success, a Server Identifier option with
the server's DUID, and a Client Identifier option with the client's DUID.

10 years agoDon't return a DHCPv6 reply in response to a confirm without address(es)
Hans Dedecker [Wed, 16 Apr 2014 09:53:32 +0000 (11:53 +0200)]
Don't return a DHCPv6 reply in response to a confirm without address(es)

RFC3315 Section 18.2.2 states no reply must returned by the server in case no address(es) are present :
If the server is unable to perform this test (for example, the server does not have information about prefixes on the link to which the client is connected),
or there were no addresses in any of the IAs sent by the client, the server MUST NOT send a reply to the client.

10 years agoconfig: use correct defaults if interface is not in UCI
Steven Barth [Wed, 9 Apr 2014 12:24:31 +0000 (14:24 +0200)]
config: use correct defaults if interface is not in UCI

10 years agoodhcpd: managed PD wait for 250ms initial period
Steven Barth [Sun, 6 Apr 2014 14:27:27 +0000 (16:27 +0200)]
odhcpd: managed PD wait for 250ms initial period

10 years agoMake clang happy
Steven Barth [Thu, 3 Apr 2014 09:53:26 +0000 (11:53 +0200)]
Make clang happy

10 years agoKeep managed PD for at least 150 seconds
Steven Barth [Tue, 1 Apr 2014 16:39:38 +0000 (18:39 +0200)]
Keep managed PD for at least 150 seconds

10 years agoWait at least 15 seconds for managed PD to be acknowledged
Steven Barth [Tue, 1 Apr 2014 16:16:27 +0000 (18:16 +0200)]
Wait at least 15 seconds for managed PD to be acknowledged

10 years agodon't kill of managed PD too early
Steven Barth [Tue, 1 Apr 2014 16:02:37 +0000 (18:02 +0200)]
don't kill of managed PD too early

10 years agoComplete managed PD/CER-ID support
Steven Barth [Tue, 1 Apr 2014 09:19:31 +0000 (11:19 +0200)]
Complete managed PD/CER-ID support

10 years agoManaged PD: initial support
Steven Barth [Mon, 24 Mar 2014 09:01:54 +0000 (10:01 +0100)]
Managed PD: initial support