summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/dhcp-packet.c
diff options
context:
space:
mode:
authorSiddharth Chandrasekara <csiddharth@vmware.com>2019-09-23 13:25:21 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-09-26 04:39:46 +0200
commitafe42aef39d027a8c74e0f5dd1e496b8de5daa95 (patch)
treecc647def939c26d3adf3632f336d3a4d8bf8258c /src/libsystemd-network/dhcp-packet.c
parentnetwork: drop noisy log message (diff)
downloadsystemd-afe42aef39d027a8c74e0f5dd1e496b8de5daa95.tar.xz
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-packet.c')
-rw-r--r--src/libsystemd-network/dhcp-packet.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c
index ad5f8e267a..fe7d51703b 100644
--- a/src/libsystemd-network/dhcp-packet.c
+++ b/src/libsystemd-network/dhcp-packet.c
@@ -75,12 +75,15 @@ uint16_t dhcp_packet_checksum(uint8_t *buf, size_t len) {
void dhcp_packet_append_ip_headers(DHCPPacket *packet, be32_t source_addr,
uint16_t source_port, be32_t destination_addr,
- uint16_t destination_port, uint16_t len) {
+ uint16_t destination_port, uint16_t len, int ip_service_type) {
packet->ip.version = IPVERSION;
packet->ip.ihl = DHCP_IP_SIZE / 4;
packet->ip.tot_len = htobe16(len);
- packet->ip.tos = IPTOS_CLASS_CS6;
+ if (ip_service_type >= 0)
+ packet->ip.tos = ip_service_type;
+ else
+ packet->ip.tos = IPTOS_CLASS_CS6;
packet->ip.protocol = IPPROTO_UDP;
packet->ip.saddr = source_addr;