Nacho Barrientos
081f44859a
Byte order to host before using the lifetime
...
I've seen this in `NetworkManager-1.34.0-0.3.el8.x86_64` (latest in CentOS
Stream 8 at the time of writing this message) which does not use the latest
Systemd but probably the code base is the same (see
https://github.com/NetworkManager/NetworkManager/commit/51f93e00a23fbd09f5ad96da6290bf4ca737d46a ).
Before the patch:
```
libsystemd: eth0: DHCPv6 client: T1 expires in 34y 3w 6d 45min 31s
libsystemd: eth0: DHCPv6 client: T2 expires in 54y 5month 3w 3d 23h 20min 35s
```
After the patch:
```
libsystemd: eth0: DHCPv6 client: T1 expires in 3d 7h 58min 3s
libsystemd: eth0: DHCPv6 client: T2 expires in 5d 2h 26min 50s
```
same box (x86_64 system) and same DHCPv6 server.
This regression has likely been introduced by 8a8955507a .
2021-11-30 03:05:02 +09:00
Yu Watanabe
5656ff9dd1
dhcp6: make sd_dhcp6_lease_get_dns() and friends accepts NULL
2021-11-26 20:20:05 +09:00
Yu Watanabe
ee5b48341e
dhcp: make sd_dhcp_lease_get_servers() accepts NULL
2021-11-26 20:20:05 +09:00
Zbigniew Jędrzejewski-Szmek
ed8ba68f3b
Merge pull request #21272 from yuwata/netif-util-split
...
netif-util: move several functions from network-util.c to netif-util.c
2021-11-09 10:01:07 +01:00
Yu Watanabe
b01895bf70
arp-util: drop redundant line
...
The client's IP address is already loaded to X.
(The comment of the dropped line is wrong, X instead of A.)
2021-11-09 09:32:09 +01:00
Yu Watanabe
043b193f6e
netif-util: rename net_get_name_persistent() -> net_get_persistent_name()
2021-11-09 08:24:10 +09:00
Yu Watanabe
b5cc5591fa
netif-util: move several functions from network-util.[ch] to shared/netif-util.[ch]
...
These functions are not relevant to sd-network, and only used by
networkd, networkctl, and udevd.
2021-11-09 08:24:10 +09:00
Yu Watanabe
59aa622013
network: dhcp-server: introduce Router= setting to specify router address
...
Closes #21202 .
2021-11-03 03:15:00 +09:00
Yu Watanabe
aa5a0f959c
sd-dhcp6-client: simplify code a bit
...
Also this adds a note.
2021-11-01 23:13:08 +09:00
Yu Watanabe
0936c189c9
sd-dhcp6-client: do not implicitly cast to boolean
2021-11-01 23:13:08 +09:00
Yu Watanabe
e79b4b8534
sd-dhcp6-client: introduce dhcp6_lease_{get,set}_clientid()
2021-11-01 23:13:08 +09:00
Yu Watanabe
65457c17e6
sd-dhcp6-client: shorten code a bit
2021-11-01 23:13:08 +09:00
Yu Watanabe
4f81f0d241
sd-dhcp6-client: prefix variables which store results with "ret_"
2021-11-01 23:13:08 +09:00
Yu Watanabe
d3aa9d6a80
sd-dhcp6-client: update log messages
2021-11-01 23:13:08 +09:00
Yu Watanabe
7e6abd25f4
Merge pull request #21200 from yuwata/sd-dhcp6-client-server-address
...
sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()
2021-11-01 21:04:48 +09:00
Yu Watanabe
3b73ebc08a
Merge pull request #21199 from yuwata/sd-dhcp6-client-trivial-cleanups
...
sd-dhcp6-client: trivial cleanups
2021-11-01 21:04:05 +09:00
Yu Watanabe
ef4edc1546
sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()
2021-11-01 18:22:49 +09:00
Yu Watanabe
2c269a4e2a
sd-lldp-tx: drop unused and useless function
...
sd-lldp-tx does not call any callback function. So, the function is
mostly useless.
2021-11-01 08:57:17 +00:00
Yu Watanabe
7f402e5b7b
sd-dhcp6: drop unused functions
2021-11-01 08:56:42 +00:00
Yu Watanabe
01b4e90f32
sd-dhcp6-client: request IA_PD by default
...
For consistency with 0f5ef9b62a .
2021-11-01 10:02:50 +09:00
Yu Watanabe
5e82251913
sd-dhcp6-client: always set suitable ARP type
...
Also, drops unnecessary comparisons.
2021-11-01 09:51:52 +09:00
Yu Watanabe
6db9b30066
Merge pull request #21175 from tohojo/dhcp-server-expire
...
sd-dhcp-server: clear out expired leases when finding new address
2021-10-30 04:13:40 +09:00
Toke Høiland-Jørgensen
cb3c06a02e
sd-dhcp-server: fix address availability checks
...
The checks for finding a new available address in the pool were broken in two
ways: not using UINT32_TO_PTR() on hashmap lookups resulted in false negatives,
and the check wasn't skipping the server address if that was part of the pool.
Move the check for available addresses to a small helper function and fix both
issues, and also add a check to the REQUEST code for the server address.
2021-10-29 15:29:05 +02:00
Toke Høiland-Jørgensen
d635a7f9e4
sd-dhcp-server: clear out expired leases when processing requests
...
The DHCP server configuration supports setting a maximum lease time, but old
leases are never actually cleared out if the client doesn't send a RELEASE.
This causes the pool to run out of addresses on networks where clients just
disappear, which is a fairly common occurrence on wireless networks.
Fix this by cleaning up expired leases before processing client requests, so
addresses can be reused for new clients.
2021-10-29 15:29:05 +02:00
Yu Watanabe
17347053cf
libsystemd-network: drop _public_ attribute
...
No function in libsystemd-network is exposed yet.
2021-10-29 22:13:23 +09:00
Yu Watanabe
41521417ab
sd-radv: fix implicit conversion to boolean
2021-10-29 22:10:43 +09:00
Yu Watanabe
9661d2e80c
sd-ndisc: drop unused functions
...
All received information is stored in sd_ndisc_router, and we have
sd_ndisc_router_get_mtu() and sd_ndisc_router_get_hop_limit().
2021-10-29 22:05:27 +09:00
Yu Watanabe
d951507d5d
sd-radv: shorten the default lifetime for prefix/route prefix
...
See draft-ietf-6man-slaac-renum-02 section 4.1.1.
2021-10-27 23:58:35 +09:00
Yu Watanabe
95e104e049
sd-radv: make prefix/route prefix lifetime can be specified with independently with valid_until
...
Previously, valid_until (or preferred_until for preferred lifetime) was
calculated from lifetime. So, when an upstream interface acquire a
dynamic prefix (e.g. through DHCPv6-PD) with long lifetime, then sd-radv
advertise the same lifetime. It may not be desired for some situations.
2021-10-27 23:58:28 +09:00
Yu Watanabe
eef5ebec97
Merge pull request #21143 from yuwata/sd-radv-router-lifetime
...
sd-radv: several cleanups for router lifetime
2021-10-27 22:14:35 +09:00
Yu Watanabe
804775577d
sd-radv: update how to calculate interval of sending advertisements
2021-10-27 19:27:23 +09:00
Yu Watanabe
0945767012
sd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds
...
See RFC 4861 section 6.2.1.
2021-10-27 19:27:07 +09:00
Yu Watanabe
72db0a714b
sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC
2021-10-27 19:05:55 +09:00
Yu Watanabe
e786c2e50f
sd-radv: add several notes about constants
2021-10-27 19:03:58 +09:00
Yu Watanabe
03ec10fdf4
sd-radv: make several constants not exposed
2021-10-27 19:03:35 +09:00
Yu Watanabe
d6fc0d674f
sd-radv: drop SD_ prefix for unexposed constants
2021-10-27 19:03:31 +09:00
Yu Watanabe
68cbac5bd4
sd-radv: use IPv6 specific functions
2021-10-27 16:41:04 +09:00
Yu Watanabe
acbb5500e2
sd-radv: use assert_return()
2021-10-27 16:41:04 +09:00
Yu Watanabe
7003b11487
sd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t)
2021-10-27 16:13:09 +09:00
Yu Watanabe
a84171ce6f
libsystemd-network: do not warn when log_dhcp_client() or friends with NULL
2021-10-26 08:09:40 +09:00
Yu Watanabe
113e124f9b
icmp6: shorten code a bit
2021-10-21 22:40:03 +09:00
Yu Watanabe
ea51deb188
dhcp: shorten BPF code a bit
...
- replace `A = k` and `X = A` with `X = k`,
- replace `A ^= X` and `A == 0` with `A == X`.
- use UINT32_MAX when accept a packet
2021-10-21 22:39:53 +09:00
Yu Watanabe
155943b259
dhcp: rebreak function arguments
2021-10-21 22:39:43 +09:00
Yu Watanabe
b8319d748f
dhcp: fix assertions
2021-10-21 22:39:43 +09:00
Yu Watanabe
d70c78131d
dhcp: shorten code a bit
2021-10-21 22:39:43 +09:00
Yu Watanabe
36f1955da8
lldp: shorten code a bit
2021-10-21 22:39:43 +09:00
Yu Watanabe
e2c7c38b74
arp-util: shorten BPF code a bit
...
- replace `A = k` and `X = A` with `X = k`,
- replace `A ^= X` and `A == 0` with `A == X`.
- use UINT32_MAX when accept a packet
2021-10-21 22:39:25 +09:00
Yu Watanabe
653ddc1d18
sd-dhcp6-client: introduce sd_dhcp6_lease_get_timestamp()
2021-10-20 02:36:20 +09:00
Yu Watanabe
7502812c92
sd-dhcp6-client: max_retransmit_time must be positive
...
Found by LGTM.com analysis.
2021-10-13 02:49:49 +09:00
Yu Watanabe
fea8c18085
sd-dhcp6-client: introduce dhcp6_option_can_request()
2021-10-13 02:49:49 +09:00