Age | Commit message (Collapse) | Author |
|
This avoids confusion what this is, in particular as libc knows an
index() function.
|
|
|
|
|
|
If we handly arbitrary data we should use "void*" pointers, not
"uint8_t*", how go intended C to be used.
|
|
Everywhere else we call the generic user data pointer just "userdata",
rather than "user_data". Let's do this here, too.
|
|
We place the opening bracket of a function on the same line as the
function name. Let's do so in the DHCP sources too.
|
|
No need to invole atomic ops in single-threaded APIs, let's simplify
this.
|
|
When we make sd-dhcp public one day we really should not make
sd_dhcp_lease_save() and sd_dhcp_lease_load() public, since it's pretty
much only useful as internal utility for networkd itself.
|
|
Previoulsy, we just checked whether the domain names specified in
incoming DHCP leases are valid. Given that validation code actually
internally normalizes anyway, it's a good idea to simply do the full
normalization and store that in the lease structure. This allows us to
remove the manual removal of a trailing dot, if there is one.
|
|
|
|
This one is simply to add: encode the tzdata timezone in the DHCP
options and optionally make use of it.
|
|
Let's make sure there's no embedded 0 byte. Also, let's reset the string
if the length is zero.
|
|
strv_extend() does not consume the passed entry, hence, we must properly
free it. Furthermore, we should *not* use strv_consume() as we do greedy
allocations on 'ret'; and greedy-allocations should only be used for short
lived objects or caches.
Fix the domainname parser to properly free temporary storage when done.
|
|
In our API design, getter-functions don't ref objects. Calls like
foo_get_bar() will not ref 'bar'. We never do that and there is no real
reason to do it in single threaded APIs. If you need a ref-count, you
better take it yourself *BEFORE* doing anything else on the parent object
(as this might invalidate your pointer).
Right now, sd_dhcp?_get_lease() refs the lease it returns. A lot of
code-paths in systemd do not expect this and thus leak the lease
reference. Fix this by changing the API to not ref returned objects.
|
|
|
|
Test option setting and getting in test_advertise_option(). Verify
that the information provided in DHCPv6 Reply messages is also
available in the Information and Solicit callbacks.
|
|
Although the SNTP option specified in RFC 4075 has been deprecated, some
servers are still sending NTP information with this option. Use the SNTP
information provided only if the NTP option is not present.
Update the test case as SNTP information is also requested.
|
|
Support NTP server and multicast addresses and NTP server domain names
as specified in RFC 5908.
|
|
Support DHCPv6 DNS search list option as specified in RFC 3646. This
option contains a list of DNS search domains encoded without compression
as specified in Section 8. of RFC 3315.
|
|
Support DHCPv6 DNS server option as specified in RFC 3646. This option
contains a list of IPv6 DNS server addresses.
|
|
Add a helper function containing a modified version of dns_packet_read_name()
that does not use DnsPacket to extract a string array of domain names from
the provided option data. The domain names are stored uncompressed as defined
in Section 8. of RFC 3315.
|
|
Add a helper function that extracts a block of IPv6 addresses from
the provided option data.
|
|
As the lease structure contains interesting information, save it also
for the Information Reply.
|
|
When the DHCPv6 client is started by the library user or stopped for
any reason, unref the DHCPv6 lease when resetting the DHCPv6 client
data structure. This makes the DHCPv6 client always start from a clean
state and not keep unnecessary an lease structure around when stopped.
If this is not done, a previously existing lease information can be
interpreted to be from another server when restarting DHCPv6.
|
|
|
|
Coverity #1315324
|
|
Manual merge of https://github.com/systemd/systemd/pull/751.
|
|
Tests are modified to check behaviour with relax and without relax.
New tests are added for hostname_cleanup().
Tests are moved a new file (test-hostname-util) because there's
now a bunch of them.
New parameter is not used anywhere, except in tests, so there should
be no observable change.
|
|
|
|
Follow-up for PR #877.
|
|
|
|
Save the private options along side the rest of the options in the lease
files.
|
|
This stores private-zone DHCP options inside of their respective DHCP
lease. These options aren't used by networkd (what would it do with
them?), but saving them will allow other programs to query the values.
To improve performance, the options are stored in ascending order by
tag.
|
|
|
|
CID 1315105: Resource leaks (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 800 in
dhcp_server_handle_message()
*** CID 1315105: Resource leaks (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 800 in
|
|
tree-wide: convert bootchart and lldp code to use clock_boottime_or_m…
|
|
We should avoid using CLOCK_BOOTTIME directly unless we actually can
sensible distuingish it from CLOCK_MONOTONIC. CLOCK_BOOTTIME is only
fully feature on very recent Linux kernels, hence we should stick to a
fallback logic, which is already available in the
clock_boottime_or_monotonic() call.
|
|
Previously, if the event loop never ran before sd_event_now() would
fail. With this change it will instead fall back to invoking now(). This
way, the function cannot fail anymore, except for programming error when
invoking it with wrong parameters.
This takes into account the fact that many callers did not handle the
error condition correctly, and if the callers did, then they kept simply
invoking now() as fall back on their own. Hence let's shorten the code
using this call, and make things more robust, and let's just fall back
to now() internally.
Whether now() is used or the cache timestamp may still be detected via
the return value of sd_event_now(). If > 0 is returned, then the fall
back to now() was used, if == 0 is returned, then the cached value was
returned.
This patch also simplifies many of the invocations of sd_event_now():
the manual fall back to now() can be removed. Also, in cases where the
call is invoked withing void functions we can now protect the invocation
via assert_se(), acknowledging the fact that the call cannot fail
anymore except for programming errors with the parameters.
This change is inspired by #841.
|
|
Some places invoked fflush() directly with their own manual error
checking, let's unify all that by using fflush_and_check().
This also unifies the general error paths of fflush()+rename() file
writers.
|
|
sd-dhcp-lease: fix handling of multiple routers
We only support one router, but in case more than one is given, we now ignore subsequent ones, rather than fall over.
|
|
This adds support for option 43 (Vendor Specific Information) to
libsystemd-network DHCP code. The option carries an opaque object of n
octets, interpreted by vendor-specific code on the clients and
servers.
[@zonque: adopted to new unhexmem() API]
|
|
We were ignoring failures from unhexchar, which meant that invalid
hex characters were being turned into garbage rather than the string
rejected.
Fix this by making unhexmem return an error code, also change the API
slightly, to return the size of the returned memory, reflecting the
fact that the memory is a binary blob,and not a string.
For convenience, still append a trailing NULL byte to the returned
memory (not included in the returned size), allowing callers to
treat it as a string without doing a second copy.
|
|
currently if a dhcp server sends more than one router, sd-dhcp-lease
does not copy the ip because it assumes it will only ever be 4 bytes. a
dhcp server could send more than one ip in the router list, so we should
copy the first one and ignore the rest of the bytes.
|
|
ldp_receive_frame after correct processing of the packet the state
should be LLDP_AGENT_RX_WAIT_FOR_FRAME not LLDP_AGENT_RX_UPDATE_INFO.
|
|
Seems to have been removed by mistake in:
9021bb9f935c93b516b10c88db2a212a9e3a8140
|
|
|
|
|
|
dhcp domain option
previously hostname_is_valid was used to validate domain names, which
would silently drop perfectly valid dns names that were longer than a
single dns label.
|
|
It's only marginally shorter then the usual for() loop, but certainly
more readable.
|
|
|