diff options
author | Siddharth Chandrasekara <csiddharth@vmware.com> | 2019-09-23 04:25:21 -0700 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-09-26 11:39:46 +0900 |
commit | afe42aef39d027a8c74e0f5dd1e496b8de5daa95 (patch) | |
tree | cc647def939c26d3adf3632f336d3a4d8bf8258c /src/libsystemd-network/dhcp-network.c | |
parent | 55a1729fd095f2e0733247e7b4911cf41bf6b2ed (diff) | |
download | systemd-afe42aef39d027a8c74e0f5dd1e496b8de5daa95.tar.gz systemd-afe42aef39d027a8c74e0f5dd1e496b8de5daa95.tar.bz2 systemd-afe42aef39d027a8c74e0f5dd1e496b8de5daa95.zip |
dhcp4: make IPServiceType configurable
IPServiceType set to CS6 (network control) causes problems on some old
network setups that continue to interpret the field as IP TOS.
Make DHCP work on such networks by allowing this field to be set to
CS4 (Realtime) instead, as this maps to IPTOS_LOWDELAY.
Signed-off-by: Siddharth Chandrasekaran <csiddharth@vmware.com>
Diffstat (limited to 'src/libsystemd-network/dhcp-network.c')
-rw-r--r-- | src/libsystemd-network/dhcp-network.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/dhcp-network.c index 94c10ed14c..8e7f8a65ab 100644 --- a/src/libsystemd-network/dhcp-network.c +++ b/src/libsystemd-network/dhcp-network.c @@ -146,7 +146,7 @@ int dhcp_network_bind_raw_socket(int ifindex, union sockaddr_union *link, bcast_addr, ð_mac, arp_type, dhcp_hlen, port); } -int dhcp_network_bind_udp_socket(int ifindex, be32_t address, uint16_t port) { +int dhcp_network_bind_udp_socket(int ifindex, be32_t address, uint16_t port, int ip_service_type) { union sockaddr_union src = { .in.sin_family = AF_INET, .in.sin_port = htobe16(port), @@ -159,7 +159,11 @@ int dhcp_network_bind_udp_socket(int ifindex, be32_t address, uint16_t port) { if (s < 0) return -errno; - r = setsockopt_int(s, IPPROTO_IP, IP_TOS, IPTOS_CLASS_CS6); + if (ip_service_type >= 0) + r = setsockopt_int(s, IPPROTO_IP, IP_TOS, ip_service_type); + else + r = setsockopt_int(s, IPPROTO_IP, IP_TOS, IPTOS_CLASS_CS6); + if (r < 0) return r; |