Created
June 15, 2023 15:57
-
-
Save djGrrr/1adf50a34515e67b923d833c0c27bee6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur /root/dhclient/clparse.c sbin/dhclient/clparse.c | |
--- /root/dhclient/clparse.c 2023-06-15 11:41:32.754958000 -0230 | |
+++ sbin/dhclient/clparse.c 2023-06-15 12:23:19.363379000 -0230 | |
@@ -47,6 +47,7 @@ | |
#include "dhcpd.h" | |
#include "dhctoken.h" | |
+#include <netinet/ip.h> | |
struct client_config top_level_config; | |
static struct interface_info *dummy_interfaces; | |
@@ -77,6 +78,7 @@ | |
/* Set some defaults... */ | |
top_level_config.vlan_pcp = 0; | |
+ top_level_config.ip_tos = IPTOS_LOWDELAY; | |
top_level_config.timeout = 60; | |
top_level_config.select_interval = 0; | |
top_level_config.reboot_timeout = 10; | |
@@ -264,6 +266,10 @@ | |
case VLAN_PCP: | |
parse_lease_time(cfile, &tmp); | |
config->vlan_pcp = (u_int)tmp; | |
+ return; | |
+ case IP_TYPE_OF_SERVICE: | |
+ parse_lease_time(cfile, &tmp); | |
+ config->ip_tos = (u_int)tmp; | |
return; | |
case BACKOFF_CUTOFF: | |
parse_lease_time(cfile, &config->backoff_cutoff); | |
diff -ur /root/dhclient/conflex.c sbin/dhclient/conflex.c | |
--- /root/dhclient/conflex.c 2023-06-15 11:41:32.753160000 -0230 | |
+++ sbin/dhclient/conflex.c 2023-06-15 12:23:39.691000000 -0230 | |
@@ -417,6 +417,8 @@ | |
return (INITIAL_INTERVAL); | |
if (!strcasecmp(atom + 1, "nterface")) | |
return (INTERFACE); | |
+ if (!strcasecmp(atom + 1, "p-tos")) | |
+ return (IP_TYPE_OF_SERVICE); | |
break; | |
case 'l': | |
if (!strcasecmp(atom + 1, "ease")) | |
diff -ur /root/dhclient/dhclient.conf.5 sbin/dhclient/dhclient.conf.5 | |
--- /root/dhclient/dhclient.conf.5 2023-06-15 11:41:32.754695000 -0230 | |
+++ sbin/dhclient/dhclient.conf.5 2023-06-15 12:14:24.848188000 -0230 | |
@@ -491,6 +491,10 @@ | |
This requires the | |
.Va net.link.vlan.mtag_pcp | |
sysctl to be set to 1. | |
+.It Ic ip-tos Ar code ; | |
+The | |
+.Ic ip-tos | |
+statement sets the TOS (Type Of Service) value for the IP header. | |
.El | |
.Sh EXAMPLES | |
The following configuration file is used on a laptop | |
diff -ur /root/dhclient/dhcpd.h sbin/dhclient/dhcpd.h | |
--- /root/dhclient/dhcpd.h 2023-06-15 11:41:32.753355000 -0230 | |
+++ sbin/dhclient/dhcpd.h 2023-06-15 12:00:02.645413000 -0230 | |
@@ -160,6 +160,7 @@ | |
u_int8_t requested_options[256]; | |
int requested_option_count; | |
u_int vlan_pcp; | |
+ u_int ip_tos; | |
time_t timeout; | |
time_t initial_interval; | |
time_t retry_interval; | |
diff -ur /root/dhclient/dhctoken.h sbin/dhclient/dhctoken.h | |
--- /root/dhclient/dhctoken.h 2023-06-15 11:41:32.751929000 -0230 | |
+++ sbin/dhclient/dhctoken.h 2023-06-15 12:22:58.524456000 -0230 | |
@@ -134,6 +134,7 @@ | |
#define TOKEN_NOT 334 | |
#define ALWAYS_REPLY_RFC1048 335 | |
#define VLAN_PCP 336 | |
+#define IP_TYPE_OF_SERVICE 337 | |
#define is_identifier(x) ((x) >= FIRST_TOKEN && \ | |
(x) != STRING && \ | |
diff -ur /root/dhclient/packet.c sbin/dhclient/packet.c | |
--- /root/dhclient/packet.c 2023-06-15 11:41:32.749546000 -0230 | |
+++ sbin/dhclient/packet.c 2023-06-15 13:20:23.045470000 -0230 | |
@@ -54,6 +54,8 @@ | |
#define ETHER_HEADER_SIZE (ETHER_ADDR_LEN * 2 + sizeof(u_int16_t)) | |
+extern struct interface_info *ifi; | |
+ | |
u_int32_t checksum(unsigned char *, unsigned, u_int32_t); | |
u_int32_t wrapsum(u_int32_t); | |
@@ -118,7 +120,7 @@ | |
ip.ip_v = 4; | |
ip.ip_hl = 5; | |
- ip.ip_tos = IPTOS_LOWDELAY; | |
+ ip.ip_tos = ifi->client->config->ip_tos; | |
ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len); | |
ip.ip_id = 0; | |
ip.ip_off = 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment