summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp-internal.h
AgeCommit message (Collapse)Author
2016-05-26sd-network: unify packet processing logic a bitLennart Poettering
Let's always check for errno being EAGAIN/EINTR the same way, and always log if we receive weirdly short packets.
2016-02-20libsystemd-network: don't abbreviate "callback" as "cb" needlesslyLennart Poettering
This isn't an excercise in creating APIs that are hard to understand, hence let's call a callback a callback.
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2015-11-27tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering
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.
2015-11-25sd-dhcp: parse error message in DECLINE or NAKTom Gundersen
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.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
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.
2015-08-26dhcp: generic data should be void*, not uint8_t*Lennart Poettering
If we handly arbitrary data we should use "void*" pointers, not "uint8_t*", how go intended C to be used.
2015-08-26network: s/user_data/userdata/Lennart Poettering
Everywhere else we call the generic user data pointer just "userdata", rather than "user_data". Let's do this here, too.
2014-11-27log: rearrange log function namingLennart Poettering
- 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.
2014-11-27log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering
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");
2014-10-11sd-dhcp-client: support non-Ethernet hardware addressesDan Williams
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.
2014-07-07dhcp-network: add check for DHCP.chaddrMichal Sekletar
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.
2014-06-24sd-dhcp-client: return NULL from _unref() like the other sd-* librariesTom Gundersen
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.
2014-06-17sd-dhcp: checksum - make endianess-neutralTom Gundersen
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>.
2014-05-21sd-dhcp: option_append - support falling back to 'sname' and 'file'Tom Gundersen
2014-05-20sd-dhcp: refactor dhcp_option_appendTom Gundersen
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.
2014-05-06dhcp-network: don't pass ifindex to bind_udp_socketTom Gundersen
UDP sockets can anyway not be bound to specific netdev's. The packages would have to be filtered when received instead.
2014-04-08sd-dhcp-client: include client id in debug messagesTom Gundersen
2014-04-07libsystemd-network: Speed up checksum computation using 64 bit integersTom Gundersen
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.
2014-04-06sd-dhcp-client: improve BPFTom Gundersen
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.
2014-03-19libsystemd-network: Export checksum function to test casePatrik Flykt
Remove identical checksum function implementation from the test case code.
2014-03-11sd-dhcp: generalise ip header generationTom Gundersen
This will be needed for sd-dhcp-server.
2014-02-28sd-network: add new libraryTom Gundersen
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.