summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp-internal.h
Commit message (Collapse)AuthorAgeFilesLines
* optionally set socket priority on DHCPv4 raw socketchris2023-01-121-1/+3
|
* dhcp: make dhcp_network_bind_raw_socket() take struct hw_addr_dataYu Watanabe2022-08-061-4/+9
|
* sd-dhcp-client,sd-dhcp-client-server: set chaddr in dhcp_message_init()Yu Watanabe2022-01-241-2/+2
| | | | | And also set chaddr and hlen for packets on non-Ethernet interfaces, except for InfiniBand.
* libsystemd-network: make sd_dhcp_client_get_ifname() or friends return ↵Yu Watanabe2021-09-291-3/+3
| | | | negative errno on error
* dhcp: do not use ifindex when generating iaid in testsYu Watanabe2021-06-121-0/+4
|
* rfc3046 implementationYegor Alexeyev2021-05-081-0/+2
|
* 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
|
* libsystemd-network: make log_dhcp_client() or friends include interface nameYu Watanabe2021-03-041-2/+13
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* dhcp4: fix DHCP on InfiniBand interfacesTimo Rothenpieler2020-10-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With these patches applied, networkd is successfully able to get an address from a DHCP server on an IPoIB interface. 1) Makes networkd pass the actual interface type to the dhcp client, instead of hardcoding it to Ethernet. 2) Fixes some issues in handling the larger (20 Byte) IB MAC addresses in the dhcp code. 3) Add a new field to networkds Link struct, which holds the interface broadcast address. 3.1) Modify the DHCP code to also expect the broadcast address as parameter. On an Ethernet-Interface the Broadcast address never changes and is always all 6 bytes set to 0xFF. On an IB one however it is not neccesarily always the same, thus fetching the actual address from the interface is neccesary. 4) Only the last 8 bytes of an IB MAC are stable, so when using an IB MAC to generate a client ID, only pass those 8 bytes.
* sd-dhcp: clean-up of DHCP lease server codeLennart Poettering2020-05-301-1/+5
| | | | | | | | | | | | | | | | | | 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.
* dhcp: remove struct sd_dhcp_raw_optionYu Watanabe2019-11-181-0/+10
| | | | sd_dhcp_raw_option and sd_dhcp_option are essentially equivalent.
* dhcp4: make IPServiceType configurableSiddharth Chandrasekara2019-09-261-2/+2
| | | | | | | | | | IPServiceType set to CS6 (network control) causes problems on some old network setups that continue to interpret the field as IP TOS. Make DHCP work on such networks by allowing this field to be set to CS4 (Realtime) instead, as this maps to IPTOS_LOWDELAY. Signed-off-by: Siddharth Chandrasekaran <csiddharth@vmware.com>
* tree-wide: use PROJECT_FILE instead of __FILE__Zbigniew Jędrzejewski-Szmek2019-07-041-1/+1
| | | | This replaces the internal uses of __FILE__ with the new macro.
* 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.
* 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.
* dhcp: bind udp sockets to interfaces (#4822)27o2016-12-071-2/+2
|
* networkd: support setting dhcp client listen port (#4631)Susant Sahani2016-11-101-2/+3
| | | | | | Allow setting custom port for the DHCP client to listen on in networkd. [DHCP] ListenPort=6677
* sd-network: unify packet processing logic a bitLennart Poettering2016-05-261-1/+2
| | | | | Let's always check for errno being EAGAIN/EINTR the same way, and always log if we receive weirdly short packets.
* libsystemd-network: don't abbreviate "callback" as "cb" needlesslyLennart Poettering2016-02-201-2/+2
| | | | | This isn't an excercise in creating APIs that are hard to understand, hence let's call a callback a callback.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
* sd-dhcp: parse error message in DECLINE or NAKTom Gundersen2015-11-251-2/+1
| | | | | | If a client sends a DECLINE or a server sends a NAK, they can include a string with a message to explain the error. Parse this and print it at debug level.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-4/+4
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* dhcp: generic data should be void*, not uint8_t*Lennart Poettering2015-08-261-1/+1
| | | | | If we handly arbitrary data we should use "void*" pointers, not "uint8_t*", how go intended C to be used.
* network: s/user_data/userdata/Lennart Poettering2015-08-261-2/+2
| | | | | Everywhere else we call the generic user data pointer just "userdata", rather than "user_data". Let's do this here, too.
* log: rearrange log function namingLennart Poettering2014-11-271-1/+1
| | | | | | | | | | - Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
* log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering2014-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
* sd-dhcp-client: support non-Ethernet hardware addressesDan Williams2014-10-111-3/+7
| | | | | | | Like Infiniband. See RFC 4390 section 2.1 for details on DHCP and Infiniband; chaddr is zeroed, hlen is set to 0, and htype is set to ARPHRD_INFINIBAND because IB hardware addresses are 20 bytes in length.
* dhcp-network: add check for DHCP.chaddrMichal Sekletar2014-07-071-1/+2
| | | | | | Check that received DHCP packets actually include our MAC address in chaddr field. BPF interpreter has 32 bit wide registers but MAC address is 48 bits long so we have to do check in two steps.
* sd-dhcp-client: return NULL from _unref() like the other sd-* librariesTom Gundersen2014-06-241-0/+10
| | | | | | | Let's keep this behavior consistent across our libraries. In order to keep the refcounting working, a DONT_DESTROY macro similar to the one in sd-bus was introduced.
* sd-dhcp: checksum - make endianess-neutralTom Gundersen2014-06-171-1/+1
| | | | | | | | | | | | | | For efficiency, we group bytes together before adding them up. This is guaranteed to always work (regardless of the byte order) as long as the i-th byte in each group lign up with the i-th byte in each other group. On big-endian machines this broke when handling the trailing few bytes which did not make up a full group of 4 bytes. This patch fixes the problem by explicitly creating a 4 byte zero-padded group out of the trailing bytes. Reported and tested by Thomas Ritter <th.ritter@gmx.at>.
* sd-dhcp: option_append - support falling back to 'sname' and 'file'Tom Gundersen2014-05-211-2/+2
|
* sd-dhcp: refactor dhcp_option_appendTom Gundersen2014-05-201-3/+3
| | | | | | | | | | | | | Store a pointer to the options in the DHCPMessage struct, and pass this together with an offset around, rather than a uint8_t**. This avoids us having to (re)compute the pointer; and changes dhcp_option_append from adjusting both the pointer to the next option and the remaining size of the options, to just adjusting the current offset. This makes the code a bit simpler to follow IMHO, but there should be no functional change.
* dhcp-network: don't pass ifindex to bind_udp_socketTom Gundersen2014-05-061-1/+1
| | | | | UDP sockets can anyway not be bound to specific netdev's. The packages would have to be filtered when received instead.
* sd-dhcp-client: include client id in debug messagesTom Gundersen2014-04-081-1/+1
|
* libsystemd-network: Speed up checksum computation using 64 bit integersTom Gundersen2014-04-071-1/+1
| | | | | | | | Improve the checksum computation by using 64 bit integers instead of the 16 bit integers in the existing implementation. This change speeds up the computation with approximately 78% both on 64 bit and 32 bit systems. Please see RFC 1071 for details.
* sd-dhcp-client: improve BPFTom Gundersen2014-04-061-1/+1
| | | | | | Try a bit harder to make the kernel drop packets not for us. This should reduce the number of wakeups from n^2 to n in the number of dhcp clients, which admittedly only makes a differenc in very extreme cases.
* libsystemd-network: Export checksum function to test casePatrik Flykt2014-03-191-0/+2
| | | | | Remove identical checksum function implementation from the test case code.
* sd-dhcp: generalise ip header generationTom Gundersen2014-03-111-1/+3
| | | | This will be needed for sd-dhcp-server.
* sd-network: add new libraryTom Gundersen2014-02-281-0/+55
This is similar to sd-login, but exposes the state of networkd rather than logind. Include it in libsystemd-dhcp and rename it to libsystemd-network.