diff options
author | Tom Gundersen <teg@jklm.no> | 2014-05-06 22:02:14 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-05-06 22:09:05 +0200 |
commit | 85923f79e1d1191673c5dffa4bdf1f5aadaa415b (patch) | |
tree | df9d0952a3403396a0ce8b8e0965164d310403f6 /src/libsystemd-network/dhcp-network.c | |
parent | 085cabf266bfbbc5ebdada9179a8ebe404e540a8 (diff) |
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.
Diffstat (limited to 'src/libsystemd-network/dhcp-network.c')
-rw-r--r-- | src/libsystemd-network/dhcp-network.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/dhcp-network.c index 722f1b18b3..2a63f1850e 100644 --- a/src/libsystemd-network/dhcp-network.c +++ b/src/libsystemd-network/dhcp-network.c @@ -98,7 +98,7 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link, uint32_t int dhcp_network_bind_udp_socket(be32_t address, uint16_t port) { - int s; + int s, tos = IPTOS_CLASS_CS6; union sockaddr_union src = { .in.sin_family = AF_INET, .in.sin_port = htobe16(port), @@ -109,6 +109,9 @@ int dhcp_network_bind_udp_socket(be32_t address, uint16_t port) if (s < 0) return -errno; + if (setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) + return -errno; + if (bind(s, &src.sa, sizeof(src.in)) < 0) { safe_close(s); return -errno; |