Age | Commit message (Collapse) | Author |
|
Let's just keep the few parts we actually need of it in the main sd_lldp
object, so that we can simplify things quite a bit.
While we are at it, remove ifname and mac fields which we make no use of
whatsoever.
|
|
We don't expose them, and they are only of questionnable use.
|
|
This isn't an excercise in creating APIs that are hard to understand, hence
let's call a callback a callback.
|
|
There's really no point in maintaining a state, the state machine is trivial,
and we actually never look at the state anyway, we just keep updating it.
|
|
|
|
Fixes: #2457
|
|
The function must never fail.
|
|
Better support of OPENPGPKEY, CAA, TLSA packets and tests
|
|
ISO/IEC 9899:1999 §7.21.1/2 says:
Where an argument declared as size_t n specifies the length of the array
for a function, n can have the value zero on a call to that
function. Unless explicitly stated otherwise in the description of a
particular function in this subclause, pointer arguments on such a call
shall still have valid values, as described in 7.1.4.
In base64_append_width memcpy was called as memcpy(x, NULL, 0). GCC 4.9
started making use of this and assumes This worked fine under -O0, but
does something strange under -O3.
This patch fixes a bug in base64_append_width(), fixes a possible bug in
journal_file_append_entry_internal(), and makes use of the new function
to simplify the code in other places.
|
|
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
|
|
The server might answer to a DHCPREQUEST with a NAK and currently the
client restarts the configuration process immediately. It was
observed that this can easily generate loops in which the network is
flooded with DISCOVER,OFFER,REQUEST,NAK sequences.
RFC 2131 only states that "if the client receives a DHCPNAK message,
the client restarts the configuration process" without further
details.
Add a delay with exponential backoff between retries after NAKs to
limit the number of requests and cap the delay to 30 minutes.
|
|
Also don't permit host/domain names that reference the root domain, and unify the codepaths for this.
|
|
Coverity inspired fixes
|
|
This could happen if the remote sent us a badly formatted
option.
CID #1317206.
|
|
It cannot fail.
CID #1320623.
|
|
libsystemd-network provides the public function
sd_dhcp6_client_set_request_option() to enable the request of a given
DHCP option. However the enum defining such options is defined in the
internal header dhcp6-protocol.h. Move the enum definition to the
public header sd-dhcp6-client.h and properly namespace values.
|
|
libsystemd-network provides the public function
sd_dhcp_client_set_request_option() to enable the request of a given
DHCP option. However the enum defining such options is defined in the
internal header dhcp-protocol.h. Move the enum definition to the
public header sd-dhcp-client.h and properly namespace values.
|
|
At the moment sd_dhcp_lease_get_routes() returns an array of structs
which are not defined in public headers. Instead, change the function
to return an array of pointers to opaque sd_dhcp_route objects.
|
|
Merge separate two error handling statements into two nested ifs.
This looks cleaner, and avoids a gcc warning about *prefix being
uninitialized.
While at it, fix identation of logging statements elsewhere in the
file.
|
|
If the initial allocation succeeded, there is no way to
fail, so cleanup function is not necessary.
|
|
Also add a coccinelle receipt to help with such transitions.
|
|
Closes #2223.
|
|
LLDP type system name and system description should
be with in 255 characters and unique.
Let's add the validation to discard corrupt packets.
|
|
|
|
canonical names
We'll need this later when putting together RR serializations to
checksum.
|
|
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.
|
|
Network fixes
|
|
The new dns_label_escape() call now operates on a buffer passed in,
similar to dns_label_unescape(). This should make decoding a bit faster,
and nicer.
|
|
Let's change the return value to bool. If we encounter an error while
parsing, return "false" instead of the actual parsing error, after all
the specified hostname does not qualify for what the function is
supposed to test.
Dealing with the additional error codes was always cumbersome, and
easily misused, like for example in the DHCP code.
Let's also rename the functions from dns_name_root() to
dns_name_is_root(), to indicate that this function checks something and
returns a bool. Similar for dns_name_is_signal_label().
|
|
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.
|
|
Verify the hoplimit and that the received packet is large enough for the RA
header.
See <http://tools.ietf.org/html/rfc4861#section-6.1.2>.
|
|
We never send packets without first knowing the link-local L3 address,
so we should always include the L2 address in RS packets.
|
|
|
|
tree-wide: sort includes in *.h
|
|
This happens when running our test-suite over a socketpair,
so don't fall over in that case.
Fixes issue #1952.
|
|
libsystemd-network: add support for "Client FQDN" DHCP option (v2)
|
|
See https://tools.ietf.org/html/rfc4861#section-4.2. Some routers (dnsmasq) will send packets
from global addresses, which would break the default route setup, so ignore those.
This is also what the kernel does.
|
|
This is a continuation of the previous include sort patch, which
only sorted for .c files.
|
|
networkd fixes
|
|
This adds support for the Client Fully Qualified Domain Name (FQDN)
option [RFC 4702] to libsystemd-network. The option can be used to
exchange information about a DHCPv4 client's fully qualified domain
name and about responsibility for updating the DNS RR related to the
client's address assignment.
Other popular DHCP clients (dhclient, dhcpcd) support this option and
it would be useful to have it in networkd too.
|
|
This ensures that several DHCPv6 clients can run on separate interfaces
simultaneously.
|
|
We need to enable SO_REUSEADDR in order for several sockets to be allowed
to bind to the same port (even on different links).
|
|
tree-wide: group include of libudev.h with sd-*
|
|
|
|
Let's make sure the destructor cannot hit the n_ref == 0 case.
|
|
siphash24: let siphash24_finalize() and siphash24() return the result…
|
|
Rather than passing a pointer to return the result, return it directly
from the function calls.
Also, return the result in native endianess, and let the callers care
about the conversion. For hash tables and bloom filters, we don't care,
but in order to keep MAC addresses and DHCP client IDs stable, we
explicitly convert to LE.
|
|
Sort the includes accoding to the new coding style.
|
|
The clients may be triggered to be started repeatedly without being stopped first,
simply swallow the error rather than failing the link.
|
|
Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which
enforce pointer alignment this fixes crashes when we previously cast an
unaligned array to uint64_t*, and on others this should at least improve
performance as the compiler now aligns these properly.
This also simplifies the code in most cases by getting rid of typecasts. The
only place which we can't change is struct duid's en.id, as that is _packed_
and public API, so we can't enforce alignment of the "id" field and have to
use memcpy instead.
|