summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-dhcp-server.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* network/address: acquire address from DHCP server lease fileYu Watanabe2024-03-181-1/+3
| | | | | | | | | | | | If the DHCP server on an interface is configured with its server address is null, then let's reuse the previous server address if possible. Otherwise, if networkd is restarted or the host is rebooted, then possibly new subnet is picked, and clients that already have addresses in the previous subnet cannot access the server. Prompted by https://github.com/systemd/systemd/pull/30021#discussion_r1518478633.
* network: use link_start_dhcp4_server() at one more placeYu Watanabe2024-03-141-0/+1
| | | | | | | Otherwise, even if the persistent storage is not ready, the DHCP server may be started e.g. by unplugging and plugging cable. Follow-up for 5582b36c384fc522c23ef1ac032001882d033aff.
* network/dhcp-server: save leases in state directoryYu Watanabe2024-03-111-0/+3
| | | | | | | | | | | | Then, we can read the lease file on restart, and the DHCP server will be able to manage previously assigned addresses. To save leases in the state directory /var/lib/systemd/network/, this adds systemd-networkd-dhcp-server.service, and by default systemd-networkd does not start the DHCP server without the heler service started. Closes #29991.
* network/dhcp-server: allow to configure IPv6 only preferred optionSusant Sahani2023-10-111-0/+1
| | | | Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
* network: find DHCP server address only on loading .network fileYu Watanabe2023-09-081-2/+2
| | | | | | | | | | | | | | Previously, we periodically search suitable address for DHCP server, 1. when .network file is loaded, 2. when checking if we can configure sd_dhcp_server object, 3. when configuring sd_dhcp_server. Especially, the step 2 may be triggered several times. This makes, when .network file is loaded, find a corresponding Address object, add a new Address object if not found, then save the found or added Address object. So, it is not necessary to find address again on configuring sd_dhcp_server object.
* network: re-design request queueYu Watanabe2022-03-111-2/+0
| | | | | | | | This makes Request object takes hash, compare, free, and process functions. With this change, the logic in networkd-queue.c can be mostly independent of the type of the request or the object (e.g. Address) assigned to the request, and it becomes simpler.
* network: make request_process_address() and friends take Link and ↵Yu Watanabe2022-03-111-1/+1
| | | | | | | | | | | | | | | | | corresponding object This also renames e.g. request_process_address() -> address_process_request(). Also, this drops type checks such as `assert(req->type == REQUEST_TYPE_ADDRESS)`, as in the later commits, the function of processing request, e.g. `address_process_request()`, will be assigned to the Request object when it is created. And the request type will be used to distinguish and to avoid deduplicating requests which do not have any assigned objects, like REQUEST_TYPE_DHCP4_CLIENT. Hence, the type checks in process functions are mostly not necessary and redundant. This is mostly cleanups and preparation for later commits, and should not change any behavior.
* network: use NetworkConfigSource/State to manage addresses and routesYu Watanabe2021-09-241-0/+1
| | | | This also fixes #20146.
* network: introduce UplinkInterface= in [IPv6SendRA]Yu Watanabe2021-08-041-1/+0
|
* network: introduce UplinkInterface= setting for DHCP serverYu Watanabe2021-06-071-0/+1
|
* network: use request queue to configure DHCP serverYu Watanabe2021-06-071-1/+3
|
* network: dhcp-server: introduce ServerAddress= settingYu Watanabe2021-05-181-2/+4
| | | | | This may be useful when the link which DHCP server running on has multiple static addresses.
* network: use config_parse_in_addr_non_null()Yu Watanabe2021-05-181-1/+0
|
* rfc3046 implementationYegor Alexeyev2021-05-081-0/+1
|
* relay role implementationYegor Alexeyev2021-04-201-0/+1
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* network: clean-up DHCP lease server data configurationLennart Poettering2020-06-181-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is an attempt to clean up the POP3/SMTP/LPR/… DHCP lease server data logic in networkd. This reduces code duplication and fixes a number of bugs. This removes any support for collecting POP3/SMPT/LPR servers acquired via local DHCP client releases since noone uses that, and given how old these protocols are I doubt this will change. It keeps support for configuring them for the dhcp server however. The differences between the DNS/NTP/SIP/POP3/SMTP/LPR configuration logics are minimized. This removes the relevant symbols from sd-network.h (which is an internal API only at this point after all). This is unfortunately not well test, given the old code for this had barely any tests. But the new code should not perform worse at least, and allow us to release, since it corrects some interfaces visible in the .network configuration format. Fixes: #15943
* network: Add support send and receive LPR serversSusant Sahani2020-04-221-0/+1
|
* network: DHCP - add support to emit and receive SMTP server informationSusant Sahani2020-03-291-0/+1
|
* DHCP: Add support to emit and retrieve POP3 serverSusant Sahani2020-03-281-0/+1
|
* network: unify config_parse_dhcp_server_option_data() and ↵Yu Watanabe2019-11-181-1/+0
| | | | config_parse_dhcp_send_option()
* network: rename SendRawOption= to SendOption=Yu Watanabe2019-11-181-1/+1
| | | | | As DHCPv4.SendOption= and DHCPServer.SendRawOption= take the same format.
* network: rename DHCPRawOption to DHCPOptionDataTypeYu Watanabe2019-11-171-13/+0
| | | | And moves the definition from networkd-dhcp-server.[ch] to networkd-dhcp-common.[ch].
* networkd: dhcp server Support Vendor specific 43Susant Sahani2019-10-311-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementes https://tools.ietf.org/html/rfc2132 ``` [DHCPServer] SendRawOption=26:uint32:1400 SendRawOption=23:uint8:10 ``` Frame 448: 350 bytes on wire (2800 bits), 350 bytes captured (2800 bits) on interface 0 Linux cooked capture Internet Protocol Version 4, Src: 192.168.5.1, Dst: 192.168.5.11 User Datagram Protocol, Src Port: 67, Dst Port: 68 Dynamic Host Configuration Protocol (ACK) Message type: Boot Reply (2) Hardware type: Ethernet (0x01) Hardware address length: 6 Hops: 0 Transaction ID: 0x71f8de9d Seconds elapsed: 0 Bootp flags: 0x0000 (Unicast) Client IP address: 0.0.0.0 Your (client) IP address: 192.168.5.11 Next server IP address: 0.0.0.0 Relay agent IP address: 0.0.0.0 Client MAC address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4) Client hardware address padding: 00000000000000000000 Server host name not given Boot file name not given Magic cookie: DHCP Option: (53) DHCP Message Type (ACK) Length: 1 DHCP: ACK (5) Option: (51) IP Address Lease Time Length: 4 IP Address Lease Time: (3600s) 1 hour Option: (1) Subnet Mask (255.255.255.0) Length: 4 Subnet Mask: 255.255.255.0 Option: (3) Router Length: 4 Router: 192.168.5.1 Option: (6) Domain Name Server Length: 4 Domain Name Server: 192.168.5.1 Option: (42) Network Time Protocol Servers Length: 4 Network Time Protocol Server: 192.168.5.1 Option: (101) TCode Length: 13 TZ TCode: Europe/Berlin Option: (43) Vendor-Specific Information Length: 9 Value: 1701311a0431343030 Option: (54) DHCP Server Identifier (192.168.5.1) Length: 4 DHCP Server Identifier: 192.168.5.1 Option: (255) End Option End: 255 ```
* network: DHCP server Add support to transmit SIP serverSusant Sahani2019-09-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. DHCP server trasmit 2. Client parses and saves in leases Implements http://www.rfc-editor.org/rfc/rfc3361.txt ``` Frame 134: 348 bytes on wire (2784 bits), 348 bytes captured (2784 bits) on interface 0 Ethernet II, Src: 42:65:85:d6:4e:32 (42:65:85:d6:4e:32), Dst: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4) Internet Protocol Version 4, Src: 192.168.5.1, Dst: 192.168.5.11 User Datagram Protocol, Src Port: 67, Dst Port: 68 Dynamic Host Configuration Protocol (ACK) Message type: Boot Reply (2) Hardware type: Ethernet (0x01) Hardware address length: 6 Hops: 0 Transaction ID: 0x7cc87cb4 Seconds elapsed: 0 Bootp flags: 0x0000 (Unicast) Client IP address: 0.0.0.0 Your (client) IP address: 192.168.5.11 Next server IP address: 0.0.0.0 Relay agent IP address: 0.0.0.0 Client MAC address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4) Client hardware address padding: 00000000000000000000 Server host name not given Boot file name not given Magic cookie: DHCP Option: (53) DHCP Message Type (ACK) Length: 1 DHCP: ACK (5) Option: (51) IP Address Lease Time Length: 4 IP Address Lease Time: (3600s) 1 hour Option: (1) Subnet Mask (255.255.255.0) Length: 4 Subnet Mask: 255.255.255.0 Option: (3) Router Length: 4 Router: 192.168.5.1 Option: (6) Domain Name Server Length: 4 Domain Name Server: 192.168.5.1 Option: (42) Network Time Protocol Servers Length: 4 Network Time Protocol Server: 192.168.1.1 Option: (120) SIP Servers <=====here Length: 9 SIP Server Encoding: IPv4 Address (1) SIP Server Address: 192.168.1.1 SIP Server Address: 192.168.5.2 Option: (101) TCode Length: 13 TZ TCode: Europe/Berlin Option: (54) DHCP Server Identifier (192.168.5.1) Length: 4 DHCP Server Identifier: 192.168.5.1 Option: (255) End Option End: 255 ``` ``` cat /run/systemd/netif/state  ✔  ⚡  3148  16:40:51 OPER_STATE=routable CARRIER_STATE=carrier ADDRESS_STATE=routable DNS=192.168.94.2 192.168.5.1 NTP=192.168.5.1 SIP=192.168.1.1 192.168.5.2 ``` aa
* network: move DHCP server related functions to networkd-dhcp-server.cYu Watanabe2019-06-291-0/+11