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),
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;
packet->ip.ihl = DHCP_IP_SIZE / 4;
packet->ip.tot_len = htobe16(len);
+ packet->ip.tos = IPTOS_CLASS_CS6;
+
packet->ip.protocol = IPPROTO_UDP;
packet->ip.saddr = source_addr;
packet->ip.daddr = destination_addr;