[systemd-commits] src/libsystemd-network

Tom Gundersen tomegun at kemper.freedesktop.org
Mon Mar 31 15:33:39 PDT 2014


 src/libsystemd-network/dhcp-network.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 66a67effcc5beaf8a61e1c1147c3114b02a96439
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Mar 31 23:28:58 2014 +0200

    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>

diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/dhcp-network.c
index 29e915c..ecc94b9 100644
--- a/src/libsystemd-network/dhcp-network.c
+++ b/src/libsystemd-network/dhcp-network.c
@@ -37,8 +37,7 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link)
         assert(index > 0);
         assert(link);
 
-        s = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
-                   htons(ETH_P_IP));
+        s = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
         if (s < 0)
                 return -errno;
 



More information about the systemd-commits mailing list