summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/dhcp-server-internal.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* sd-dhcp-server: make sd_dhcp_server_set_lease_file() optionally take ↵Yu Watanabe2024-03-141-0/+1
| | | | | | | directory fd Currently, though, no valid directory fd is passed to the function call. Preparation for later commits.
* sd-dhcp-server: introduce sd_dhcp_server_set_lease_file() and ↵Yu Watanabe2024-03-111-0/+2
| | | | | | | dhcp_server_{save,load}_leases(). The functionality is not used networkd yet in this commit, but will be used in later commits.
* sd-dhcp-server: rename DHCPLease -> sd_dhcp_server_leaseYu Watanabe2024-01-031-19/+0
| | | | | | Then, move basic functions for the object to sd-dhcp-server-lease.[ch]. No effective funcional changes.
* sd-dhcp-server: use sd_dhcp_client_idYu Watanabe2024-01-031-10/+3
|
* sd-dhcp-client,-server: set timestamp based on the time when received a packetYu Watanabe2023-11-081-1/+2
| | | | | | | | | | | It seems that RFC does not say anything about the timestamp of lease we should use: time that the client sent a request or received a reply. In DHCPv6 client and NDisc, we use a timestamp that we receive a packet, rather than we sent something. So, let's consistently use the same logic for DHCPv4 client. By using the logic, we will hopefully not forget to set timestamp again, which is fixed by 089362976c2a653a77f942bfeb3f61d0e180f078.
* sd-dhcp-server: support rapid commit (RFC4039)Yu Watanabe2023-11-071-0/+2
| | | | https://datatracker.ietf.org/doc/html/rfc4039
* dhcp: split dhcp-internal.h into twoYu Watanabe2023-10-201-1/+1
|
* sd-dhcp-server: support IPv6 only modeSusant Sahani2023-10-111-0/+3
| | | | | | This makes sd-dhcp-server send IPv6 only preferred option (RFC 8925). Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
* sd-dhcp-server: store lifetime and friends in usec_tYu Watanabe2023-09-191-2/+3
|
* networkd/dhcpserver: Save and expose the client hostname sent when ↵Rene Hollander2023-05-311-0/+2
| | | | | | | | | | requesting a DHCP lease. DHCP clients often send their own hostname in option 12. It can be useful to store it with the lease so it can be shown to a human to easily identify which lease belongs to which device. RFC: https://www.rfc-editor.org/rfc/rfc2132#section-3.14
* sd-network: avoid leaking DHCPLeaseFrantisek Sumsal2023-05-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | If we fail any allocation prior adding the lease to the server lease hashmap. ==2103==ERROR: LeakSanitizer: detected memory leaks Direct leak of 128 byte(s) in 2 object(s) allocated from: #0 0x4a203e in __interceptor_calloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:77:3 #1 0x4f6341 in calloc (/build/fuzz-dhcp-server+0x4f6341) #2 0x4ec818 in add_lease /work/build/../../src/systemd/src/libsystemd-network/fuzz-dhcp-server.c:26:9 #3 0x4ec2bf in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/libsystemd-network/fuzz-dhcp-server.c:75:9 #4 0x4f68a8 in NaloFuzzerTestOneInput (/build/fuzz-dhcp-server+0x4f68a8) #5 0x5158b3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15 #6 0x51509a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3 #7 0x516769 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19 #8 0x517435 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5 #9 0x50679f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6 #10 0x507068 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10 #11 0x4f6b25 in main (/build/fuzz-dhcp-server+0x4f6b25) #12 0x7f16084e3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) DEDUP_TOKEN: __interceptor_calloc--calloc--add_lease SUMMARY: AddressSanitizer: 128 byte(s) leaked in 2 allocation(s). Found by Nallocufzz.
* network: dhcp: rename NextServer= and Filename= settingsYu Watanabe2022-03-111-2/+3
| | | | | | | And make the settings configures DHCP option 66 and 67. Follow-ups for #22615. Fixes #22661.
* sd-dhcp-server: add support to send next server and filename option for PXE ↵Yu Watanabe2022-02-241-0/+2
| | | | boot systems
* sd-dhcp-server: support packet from non-Ethernet interfaceYu Watanabe2022-01-231-0/+2
| | | | Fixes #22217.
* sd-dhcp-server: change the type of the client ID dataYu Watanabe2022-01-231-1/+1
|
* network: dhcp-server: introduce Router= setting to specify router addressYu Watanabe2021-11-021-0/+1
| | | | Closes #21202.
* libsystemd-network: make sd_dhcp_client_get_ifname() or friends return ↵Yu Watanabe2021-09-281-3/+3
| | | | negative errno on error
* sd-dhcp-server: support static lease outside of address poolYu Watanabe2021-08-111-3/+5
| | | | Closes #20341.
* sd-dhcp-server: use hashmap_ensure_put()Yu Watanabe2021-08-111-0/+2
|
* sd-dhcp-server: support static address to DHCPv4 offerborna-blazevic2021-05-271-0/+1
|
* rfc3046 implementationYegor Alexeyev2021-05-081-1/+6
|
* relay role implementationYegor Alexeyev2021-04-201-0/+1
|
* libsystemd-network: check that errno==0 is not passed to log functionsZbigniew Jędrzejewski-Szmek2021-04-141-2/+5
|
* libsystemd-network: use macro for definitions of log_{lldp,dhcp,…}_errnoZbigniew Jędrzejewski-Szmek2021-04-141-10/+5
| | | | No functional change.
* Check that errno passed log_{interface,link}_*_errno() is non-zeroZbigniew Jędrzejewski-Szmek2021-04-141-1/+1
|
* dhcp: Implemented BindToInterface= configuration optionYegor Alexeyev2021-04-141-0/+3
|
* libsystemd-network: make log_dhcp_client() or friends include interface nameYu Watanabe2021-03-031-4/+14
|
* libsystemd-network: introduce sd_xxx_{set,get}_ifname()Yu Watanabe2021-03-031-0/+1
|
* network: Use ordered_hashmap_ensure_put (#18233)Susant Sahani2021-01-171-3/+3
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* sd-dhcp-server: add sd_dhcp_server_set_callback()Marc-André Lureau2020-06-041-0/+3
|
* sd-dhcp: clean-up of DHCP lease server codeLennart Poettering2020-05-301-2/+1
| | | | | | | | | | | | | | | | | | This is an attempt to clean-up the DHCP lease server type code a bit. We now strictly use the same enum everywhere, and store server info in an array. Moreover, we use the same nomenclature everywhere. This only makes the changes in the sd-dhcp code. The networkd code is untouched so far (but should be fixed up like this too. But it's more complicated since this would then touch actual settings in .network files). Note that this also changes some field names in serialized lease files. But given that these field names have not been part of a released version of systemd yet, such a change should be ok. This is pure renaming/refactoring, shouldn't actually change any behaviour.
* sd-dhcp-server: some function prototype fix-upsLennart Poettering2020-05-141-1/+1
| | | | | | | | | Let's use size_t for numbers of entries in memory. Let's use const wherever appropriate. Drop `_server` suffix from function name where we don't have it for similar other cases.
* DHCP client: make SendOption work for DHCPv6 too.Andrew Doran2020-05-111-0/+1
|
* sd-network: DHCPv4 Add support to send and receive LPR servers.Susant Sahani2020-04-221-2/+2
|
* sd-dhcp: Add support to emit and retrieve SMTP serverSusant Sahani2020-03-281-2/+2
|
* libsystemd-network: DHCP add support to emit and retrive DHCP POP3 serverSusant Sahani2020-03-281-2/+2
|
* network: Fix split in `SendOption=` on client and serverDavid Wood2020-03-191-1/+2
| | | | | | | | | | | | | | | | | When specifying `DHCPv4.SendOption=`, it is used by systemd-networkd to set the value of that option within the DHCP request that is sent out. This differs to setting `DHCPServer.SendOption=`, which will place all the options together as suboptions into the vendor-specific information (code 43) option. This commit adds two new config options, `DHCPv4.SendVendorOption=` and `DHCPServer.SendVendorOption=`. These both have the behaviour of the old `DHCPServer.SendOption=` flag, and set the value of the suboption in the vendor-specific information option. The behaviour of `DHCPServer.SendOption=` is then changed to reflect that of `DHCPv4.SendOption=`. It will set the value of the corresponding option in the DHCP request.
* dhcp: remove struct sd_dhcp_raw_optionYu Watanabe2019-11-181-9/+0
| | | | sd_dhcp_raw_option and sd_dhcp_option are essentially equivalent.
* networkd: dhcp server Support Vendor specific 43Susant Sahani2019-10-311-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* tree-wide: use PROJECT_FILE instead of __FILE__Zbigniew Jędrzejewski-Szmek2019-07-041-2/+2
| | | | This replaces the internal uses of __FILE__ with the new macro.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-1/+1
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* tree-wide: make hash_ops typesafeYu Watanabe2018-12-021-2/+2
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-1/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-2/+2
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* dhcp-server: introduce log_dhcp_server_errno()Lennart Poettering2018-03-211-0/+1
| | | | | Sometimes we want to print the error number, hence do so properly, and avoid to use strerror() which is not reentrant.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.