diff -Naur ./edgeos-vyatta-dhcp/common/discover.c ./edgeos-vyatta-dhcp.patched/common/discover.c --- ./edgeos-vyatta-dhcp/common/discover.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/common/discover.c 2020-08-02 09:54:49.298692200 +0200 @@ -248,6 +248,10 @@ return 0; } + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(ifaces->sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + memset(&lifnum, 0, sizeof(lifnum)); #ifdef ISC_PLATFORM_HAVELIFNUM lifnum.lifn_family = AF_UNSPEC; diff -Naur ./edgeos-vyatta-dhcp/common/icmp.c ./edgeos-vyatta-dhcp.patched/common/icmp.c --- ./edgeos-vyatta-dhcp/common/icmp.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/common/icmp.c 2020-08-02 09:58:30.354339200 +0200 @@ -94,7 +94,11 @@ log_error ("unable to create icmp socket: %m"); return; } - + + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(icmp_state -> socket, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + #if defined (HAVE_SETFD) if (fcntl (icmp_state -> socket, F_SETFD, 1) < 0) log_error ("Can't set close-on-exec on icmp: %m"); diff -Naur ./edgeos-vyatta-dhcp/common/lpf.c ./edgeos-vyatta-dhcp.patched/common/lpf.c --- ./edgeos-vyatta-dhcp/common/lpf.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/common/lpf.c 2020-08-02 11:49:41.724479700 +0200 @@ -89,6 +89,11 @@ log_fatal ("Open a socket for LPF: %m"); } + /* Set Kernel Priority to 6 */ + int val; + val = 6; + setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + memset (&ifr, 0, sizeof ifr); strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name); ifr.ifr_name[IFNAMSIZ-1] = '\0'; @@ -495,6 +500,10 @@ log_fatal("Can't create socket for \"%s\": %m", name); } + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + memset(&tmp, 0, sizeof(tmp)); strcpy(tmp.ifr_name, name); if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) { diff -Naur ./edgeos-vyatta-dhcp/common/raw.c ./edgeos-vyatta-dhcp.patched/common/raw.c --- ./edgeos-vyatta-dhcp/common/raw.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/common/raw.c 2020-08-02 10:06:09.591887600 +0200 @@ -66,6 +66,10 @@ if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) log_fatal ("Can't create dhcp socket: %m"); + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + /* Set the BROADCAST option so that we can broadcast DHCP responses. */ flag = 1; if (setsockopt (sock, SOL_SOCKET, SO_BROADCAST, diff -Naur ./edgeos-vyatta-dhcp/common/socket.c ./edgeos-vyatta-dhcp.patched/common/socket.c --- ./edgeos-vyatta-dhcp/common/socket.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/common/socket.c 2020-08-02 10:08:55.786774900 +0200 @@ -189,6 +189,10 @@ log_fatal("Can't create dhcp socket: %m"); } + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + /* Set the REUSEADDR option so that we don't fail to start if we're being restarted. */ flag = 1; @@ -1174,6 +1178,10 @@ } flag_check: + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + if (lifr.lifr_flags & (IFF_VIRTUAL|IFF_IPMP)) { hw->hlen = sizeof (hw->hbuf); srandom((long)gethrtime()); diff -Naur ./edgeos-vyatta-dhcp/minires/res_send.c ./edgeos-vyatta-dhcp.patched/minires/res_send.c --- ./edgeos-vyatta-dhcp/minires/res_send.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/minires/res_send.c 2020-08-02 10:13:27.423691000 +0200 @@ -375,6 +375,11 @@ "socket(vc)", errno); return (-1); } + + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(statp->_sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + errno = 0; if (connect(statp->_sock, (struct sockaddr *)nsap, @@ -533,6 +538,11 @@ "socket(dg)", errno); return terrno; } + + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(statp->_sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + statp->_flags &= ~RES_F_CONN; } #ifndef CANNOT_CONNECT_DGRAM @@ -600,6 +610,11 @@ len = sizeof(local_addr); s1 = socket(PF_INET, SOCK_DGRAM, 0); + + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(s1, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + result = getsockname(statp->_sock, (struct sockaddr *)&local_addr, &len); diff -Naur ./edgeos-vyatta-dhcp/omapip/connection.c ./edgeos-vyatta-dhcp.patched/omapip/connection.c --- ./edgeos-vyatta-dhcp/omapip/connection.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/omapip/connection.c 2020-08-02 10:17:21.136001500 +0200 @@ -147,6 +147,10 @@ return ISC_R_UNEXPECTED; } + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(obj -> socket, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + /* Set up the local address, if any. */ if (local_addr) { /* Only do TCPv4 so far. */ diff -Naur ./edgeos-vyatta-dhcp/omapip/listener.c ./edgeos-vyatta-dhcp.patched/omapip/listener.c --- ./edgeos-vyatta-dhcp/omapip/listener.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/omapip/listener.c 2020-08-02 10:18:36.477061400 +0200 @@ -126,6 +126,10 @@ goto error_exit; } + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(obj -> socket, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + #if defined (HAVE_SETFD) if (fcntl (obj -> socket, F_SETFD, 1) < 0) { status = ISC_R_UNEXPECTED; diff -Naur ./edgeos-vyatta-dhcp/omapip/mrtrace.c ./edgeos-vyatta-dhcp.patched/omapip/mrtrace.c --- ./edgeos-vyatta-dhcp/omapip/mrtrace.c 2019-01-22 02:43:10.000000000 +0100 +++ ./edgeos-vyatta-dhcp.patched/omapip/mrtrace.c 2020-08-02 10:22:26.368217000 +0200 @@ -343,10 +343,16 @@ int trace_mr_socket (int domain, int type, int protocol) { #if defined (TRACING) - if (!trace_playback ()) + if (!trace_playback ()) { #endif - return socket (domain, type, protocol); + int sock = socket (domain, type, protocol); + /* Set Kernel Priority to 6 */ + int val = 6; + setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val)); + + return sock; #if defined (TRACING) + } return 100; #endif }