3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
2eec67acbb00593e414549a7e5b35eb7dd776b1b |
|
23-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use. |
e2acdb6b0f68d9b4152708a9f21bf9e11f8b9e7e |
|
09-Feb-2015 |
Torstein Husebø <torstein@huseboe.net> |
treewide: correct typos and use consistent "MAC" spelling |
76253e73f9c9c24fec755e485516f3b55d0707b4 |
|
11-Oct-2014 |
Dan Williams <dcbw@redhat.com> |
sd-dhcp-client: support non-Ethernet hardware addresses
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. |
088b6ba2648db1899fd956bf8238f0706fbe6c45 |
|
29-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-network: make socket filter programs static const where possible
(also, fix some whitespace/indentation issues, and avoid "index" as identifier in
order to not clash against libc's "index()" call) |
076adf013a171e819f84684e2eb22e965e96ee59 |
|
28-Jul-2014 |
Tom Gundersen <teg@jklm.no> |
dhcp-network: enable IP_FREEBIND for UDP sockets
This allows the sockets to be bound to a specific address before it is configured,
also enable SO_REUSEADDR to allow multiple DHCP clients to run at the same time. |
ffc90a11962274ac597b7838f31a4aff0362aa46 |
|
07-Jul-2014 |
Michal Sekletar <msekleta@redhat.com> |
dhcp-network: make clear that we are ANDing Fragment offset field with mask
Reading BPF assembly written as C macros is inherently difficult. Don't
make it harder than necessary and provide clearer explanation in the
comment. |
b064329fd80b8d0fe2e46c561f92886090fa20d1 |
|
07-Jul-2014 |
Michal Sekletar <msekleta@redhat.com> |
dhcp-network: ignore IP packets with More Fragments (MF) flag set
We already ignore IP fragments, because we expect that Fragment
offset (FO) field is not set. However first fragment in a fragmented IP
flow will have all zeroes in FO field. We should ignore such packet as
well, thus we need to look at MF flag in the IP header. Checking MF flag
will filter out all except last packet in fragmented flows. Last one
will be ruled out by next check for value of FO. |
58587a7a0c3bf5595190486781d3bbc00654c6ef |
|
07-Jul-2014 |
Michal Sekletar <msekleta@redhat.com> |
dhcp-network: add check for DHCP.chaddr
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. |
68328ed63ce3a938679caf41db64e068234a0ca8 |
|
22-Jun-2014 |
Michal Sekletar <msekleta@redhat.com> |
dhcp-network: don't bother with IP fragments |
d6bd972d061af306ede2affd2c9340a1660f7996 |
|
21-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: fix broadcast of DHCP packets
The destination IP address should be INADDR_BROADCAST, but was
accidentally left as INADDR_ANY. |
03966da2ca04ca96dd0a1852d7fa423aaf18eba6 |
|
18-Jun-2014 |
Michal Sekletar <msekleta@redhat.com> |
dhcp-network: remove TODO
There is no need to explicitly check version of L3 protocol in the
ethernet header because we bind socket with .sll_protocol set to
ETH_P_IP, thus we only receive IPv4 packets on the socket. |
b44cd8821087f2afebf85fec5b588f5720a9415c |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add basic functionality for creating/destroying server instance |
fef0e0f3b2ad24ed825f04fe1fe60742958f3567 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
dhcp-network: allow UDP socket to listen on any address
For this to work nicely we need to use REUSEADDR so that more than one socket
can be open at the same time. Also, we request the ifindex to be appended
to incoming messages, so we know whence it came. |
c3d2994b595542caa971a06ea894019d16b95896 |
|
06-May-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp: network - don't leak sockets on failure
Also some general cleanups |
85923f79e1d1191673c5dffa4bdf1f5aadaa415b |
|
06-May-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp: network - set TOS on outgoing packets
This should improve performance on busy wireless networks and the
like. Inspired by a similar change in dnsmasq. |
085cabf266bfbbc5ebdada9179a8ebe404e540a8 |
|
06-May-2014 |
Tom Gundersen <teg@jklm.no> |
dhcp-network: don't pass ifindex to bind_udp_socket
UDP sockets can anyway not be bound to specific netdev's. The packages would have to be filtered
when received instead. |
7429b07f822348dc5a87208ce107f5f6bf02656d |
|
06-Apr-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-client: improve BPF
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. |
0c79c68d93d721d37ba088fb50dbf07bb0d447e5 |
|
06-Apr-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-client: eagerly drop too small packets
If they are too small to fit the IP+UDP+DHCP headers they can be of no use, so
don't waste resources parsing them. This is at the cost of losing some verbosity
in the logging. |
bc29e507e2731d594ab577d04c13d771b39fa0c1 |
|
02-Apr-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-client: use BPF on raw socket
Filter out everything except UDP packets destined for the DHCP client port,
this should avoid the vast majority of spurious wakeups.
Filter based on [0], with permission.
Possible improvemnts: also check for the DHCP magic cookie to drop invalid
packets. Check for our xid to filter out packets destined for other clients.
[0]: <https://github.com/ambrop72/badvpn/blob/master/dhcpclient/BDHCPClient.c#L57> |
66a67effcc5beaf8a61e1c1147c3114b02a96439 |
|
01-Apr-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-client: --omg-optimized
Passing the protocol to socket() is redundant as it will be specified again in
bind(). Dropping the redundancy reduces the cost of bind() from ~30ms to ~0ms.
For details see [0].
networkd in a container (i.e., with next to no network latency) can now
negotiate a DHCP lease in 0.7 - 5 ms.
Thanks to Kay for help with debugging and to Daniel Borkmann for the pointer
to fix the problem.
[0]: <https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=902fefb82ef72a50c78cb4a20cc954b037a98d1c> |
03e334a1c7dc8c20c38902aa039440763acc9b17 |
|
18-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: replace close_nointr_nofail() by a more useful safe_close()
safe_close() automatically becomes a NOP when a negative fd is passed,
and returns -1 unconditionally. This makes it easy to write lines like
this:
fd = safe_close(fd);
Which will close an fd if it is open, and reset the fd variable
correctly.
By making use of this new scheme we can drop a > 200 lines of code that
was required to test for non-negative fds or to reset the closed fd
variable afterwards. |
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2 |
|
28-Feb-2014 |
Tom Gundersen <teg@jklm.no> |
sd-network: add new library
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. |