summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
AgeCommit message (Collapse)Author
2015-10-08lldp: rename publicly visible structureBeniamino Galvani
Rename struct 'tlv_packet' to 'sd_lldp_packet' and struct 'tlv_section' to 'sd_lldp_section' since the former is referenced in public header sd-lldp.h. Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
2015-10-06siphash24: unify APITom Gundersen
Make the API of the new helpers more similar to the old wrapper. In particular we now return the hash as a byte string to avoid any endianness problems.
2015-10-06Merge pull request #1465 from teg/siphash24Lennart Poettering
hashmap/siphash24: refactor hash functions
2015-10-05hashmap: hash_funcs - make inputs unambiguousTom Gundersen
Make sure all variable-length inputs are properly terminated or that their length is encoded in some way. This avoids ambiguity of adjacent inputs. E.g., in case of a hash function taking two strings, compressing "ab" followed by "c" is now distinct from "a" followed by "bc".
2015-10-05hashmap: refactor hash_funcTom Gundersen
All our hash functions are based on siphash24(), factor out siphash_init() and siphash24_finalize() and pass the siphash state to the hash functions rather than the hash key. This simplifies the hash functions, and in particular makes composition simpler as calling siphash24_compress() repeatedly on separate chunks of input has the same effect as first concatenating the input and then calling siphash23_compress() on the result.
2015-10-02lldp: add reception testsBeniamino Galvani
Add some tests to simulate the reception of LLDP frames and to verify the correctness of the data in the MIB.
2015-10-02lldp: fix parsing of TLV lengthBeniamino Galvani
tlv_packet_read_bytes() and tlv_packet_read_string() returned the wrong length when called after other functions which modify the offset in the container. In other words, if the TLV data length is X and we do a tlv_packet_read_u8(), a subsequent tlv_packet_read_bytes() should return a length of (X - 1).
2015-10-02lldp: move lldp_receive_packet() to lldp-internal.cBeniamino Galvani
In order to implement tests for the LLDP state machine, we need to mock lldp_network_bind_raw_socket(). Move the other function lldp_receive_packet() to another file so that we can replace the first function with a custom one and keep the second one.
2015-10-02lldp: check return value of lldp_tlv_packet_exit_container()Beniamino Galvani
2015-10-02lldp: add support for organizationally specific TLVsBeniamino Galvani
LLDP TLVs of type 127 are used to carry organizationally specific information and include additional fields to specify the OUI and subtype. Add support for parsing such fields and functions to access the most common IEEE 802.1 specific TLVs.
2015-10-02lldp: factor out common code in lldp-tlv.cBeniamino Galvani
2015-10-02lldp: add sd_lldp_tlv_packet_get_destination_type()Beniamino Galvani
It can be useful to know the destination address of a LLDP frame because it determines the scope of propagation of the frame and thus this information be used to know whether the neighbor is connected to the same physical link. See clause 7.1 of IEEE Std 802.1AB-2009.
2015-10-02lldp: add public function to export LLDP TLV packetsBeniamino Galvani
Add a public function to get a list of current LLDP neighbours' TLV packets. The function populates an array of pointers to the opaque type sd_lldp_packet and returns the number of elements found. Callers must take care of freeing the array and decreasing the refcount of elements when done.
2015-10-02lldp: move TLV related functions to lldp-tlv.cBeniamino Galvani
Move some public functions from lldp-internal.c to lldp-tlv.c, as now they are not internal functions anymore.
2015-10-02lldp: export opaque TLV type and accessor functionsBeniamino Galvani
Export struct tlv_packet as a public opaque sd_lldp_packet type and make its accessor functions public.
2015-10-02lldp: change order of arguments of lldp_read_*() functionsBeniamino Galvani
These functions are going to be exported, swap the 'data' and 'length' arguments so that their signature is consistent with the rest of the code.
2015-10-02lldp: add reference counter to struct tlv_packetBeniamino Galvani
Add a reference counter to the tlv_packet structure so that it can be shared between multiple users and properly free'd when no longer in use.
2015-10-01Merge pull request #1429 from poettering/dhcp-hostnameDaniel Mack
DHCP and journal remoting fix, as well as NEWS update
2015-10-01Merge pull request #1427 from dbuch/masterDaniel Mack
sd-pppoe: use strna() instead of strempty()
2015-09-30dhcp: make sure we can deal with a single trailing NUL byte in the hostnameLennart Poettering
Fixes #1337
2015-09-30sd-pppoe: use strna() instead of strempty()Daniel Buch
In cases where we use for instance. log_debug() with a statement + string it is better to output (Service-name: N/A) instead of (Service-name: )
2015-09-30tree-wide: remove a number of invocations of strerror() and replace by %mLennart Poettering
Let's clean up our tree a bit, and reduce invocations of the thread-unsafe strerror() by replacing it with printf()'s %m specifier.
2015-09-30basic: split out cpu set specific APIs into cpu-set-util.[ch]Lennart Poettering
2015-09-30tree-wide: clean up log_syntax() usageLennart Poettering
- Rely everywhere that we use abs() on the error code passed in anyway, thus don't need to explicitly negate what we pass in - Never attach synthetic error number information to log messages. Only log about errors we *receive* with the error number we got there, don't log any synthetic error, that don#t even propagate, but just eat up. - Be more careful with attaching exactly the error we get, instead of errno or unrelated errors randomly. - Fix one occasion where the error number and line number got swapped. - Make sure we never tape over OOM issues, or inability to resolve specifiers
2015-09-30tree-wide: use strempty() where possibleDaniel Mack
Also add a Coccinell patch to detect such locations in the future.
2015-09-24Merge pull request #1332 from thom311/masterTom Gundersen
sd-dhcp6: ensure canceling lease timers and refactor setting lease
2015-09-23test-dhcp6-client: Update test case due to changed semanticsPatrik Flykt
Update the test case to stop the ongoing Information Request exchange before unsetting its state. To keep the test case callback verification simpler, temporarily unset the callback function before stopping.
2015-09-23sd-dhcp6-client: Prevent setting and restarting of DHCPv6 clientPatrik Flykt
Prevent modifications to index, MAC address, DUID and Information Request while the DHCPv6 client is running. Require the DHCPv6 client to be stopped first instead of always unconditionally restarting it if the caller calls sd_dhcp6_client_start() more than once. With this change, handling of for example incoming Router Advertisments becomes much easier.
2015-09-22sd-lldp: hide internal detailsDavid Herrmann
Currently, sd-lldp.h exports "UPDATE_INFO".. and defines it to a magic constant '10'. This is completely bogus, so fix it to follow our coding standards: - Prefix exported symbols by SD_LLDP_* - Define a separate event-enum for event types - Translate internal state to external event-types
2015-09-22sd-lldp: hide internal informationDavid Herrmann
Don't export constant that are only used internally.
2015-09-22sd-pppoe: fix namespacingDavid Herrmann
Prefix all exported constants by SD_PPPOE_* to avoid namespacing conflicts.
2015-09-22sd-ipv4ll: fix namespacingDavid Herrmann
Prefix all exported constants with SD_IPV4LL_* to avoid namespacing conflicts.
2015-09-22sd-ipv4acd: fix namespacingDavid Herrmann
Prefix all exported constants with SD_IPV4ACD to prevent namespacing conflicts.
2015-09-22sd-icmp6-nd: fix namespacingDavid Herrmann
Prefix all exported constants by SD_ICMP6_ND_* to avoid any namespacing conflicts.
2015-09-22sd-dhcp6: fix namespacingDavid Herrmann
Prefix all exported constants with SD_DHCP6_CLIENT_* to avoid any namespacing conflicts.
2015-09-22sd-dhcp: fix namespacingDavid Herrmann
Prefix all constants with SD_DHCP_CLIENT_* to avoid namespacing conflicts.
2015-09-22sd-dhcp6: ensure canceling lease timers and refactor setting leaseThomas Haller
Factor our common code to set/clear the client lease. Resetting the lease involves canceling old timers. Also, most importantly, when resetting the lease in client_receive_advertise(), ensure to cancel the timers too. It is not immediately clear, why at that point no timers would be pending. The lease-unref from sd_dhcp6_client_unref() can be omited, because of the preceeding client_reset() call.
2015-09-21test-ipv4ll: use unsigned instead of an array for a seedRonny Chevalier
ipv4ll use an unsigned instead of an uint8_t array. Hence, use an unsigned seed instead of declaring an array and then dereferencing it later.
2015-09-21sd-ipv4ll: do not assert_return when seed == 0Ronny Chevalier
Now that seed is an unsigned and not an array, we do not need to assert on it.
2015-09-18sd-ipv4{acd,ll}: add simple test programsTom Gundersen
These programs should be run manually, typically two instances on a veth pair to check conflict detection. Both test programs take the ifname as input, the ACD also takes the IP address to check, whereas LL (optionally) takes the seed, which determines the sequence of IP addresses to try.
2015-09-18sd-ipv4acd: introduce new library split out from sd-ipv4llTom Gundersen
This splits the Address Conflict Detection out of the Link Local library so that we can reuse it for DHCP and static addresses in the future. Implements RFC5227.
2015-09-18sd-ipv4ll: simplify conflict handlingTom Gundersen
Use stop() and start() to drop some pulicate code.
2015-09-18sd-ipv4ll: rework callbacksTom Gundersen
Firstly, no longer distinguish between STOP and INIT states. Secondly, do not trigger STOP events when calls to sd_ipv4ll_*() fail. The caller is the one who would receive the event and will already know that the call to sd_ipv4ll_*() has failed, so it is redundant. STOP events will now only be triggered by calling sd_ipv4ll_stop() explicitly or by some internal error in the library triggered by receiving a packet or an expiring timeout (i.e., any error that would otherwise not be reported back to the consumer of the library). Lastly, follow CODING_STYLE and always return NULL on unref. Protect from objects being destroyed in callbacks accordingly.
2015-09-18sd-ipv4ll: don't allow changing MAC address whilst runningTom Gundersen
This requires the caller to stop and restart the statemachine if they want to change the MAC address.
2015-09-18sd-ipv4ll: code cleanupsTom Gundersen
Simplify timeout handling.
2015-09-18sd-ipv4ll: remove duplicate packet verificationTom Gundersen
Most packets are filtered out by the BPF, so only check for the parts that may actually differ.
2015-09-18sd-ipv4ll: minor cleanupsTom Gundersen
2015-09-18sd-ipv4ll: split out on_conflict() from on_packet()Tom Gundersen
2015-09-18sd-ipv4ll: split run_state_machine() into on_packet() and on_timeout()Tom Gundersen
Simplify the code a bit, no functional change.
2015-09-18sd-ipv4ll: filter out unwanted ARP packets in the kernelTom Gundersen
We currently process every ARP packet, but we should only care about the ones relating to our IP address. Also rename ipv4ll helpers to apr-utils.[ch], and rework the helpers a bit.