return "Unknown";
}
-int init_dhcpv6(const char *ifname, unsigned int options, int sk_prio, int sol_timeout)
+int init_dhcpv6(const char *ifname, unsigned int options, int sk_prio, int sol_timeout, unsigned int dscp)
{
client_options = options;
dhcpv6_retx[DHCPV6_MSG_SOLICIT].max_timeo = sol_timeout;
if (setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &sk_prio, sizeof(sk_prio)) < 0)
goto failure;
+ val = dscp << 2;
+ if (setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, &val, sizeof(val)) < 0) {
+ goto failure;
+ }
+
struct sockaddr_in6 client_addr = { .sin6_family = AF_INET6,
.sin6_port = htons(DHCPV6_CLIENT_PORT), .sin6_flowinfo = 0 };
unsigned int client_options = DHCPV6_CLIENT_FQDN | DHCPV6_ACCEPT_RECONFIGURE;
unsigned int ra_options = RA_RDNSS_DEFAULT_LIFETIME;
unsigned int ra_holdoff_interval = RA_MIN_ADV_INTERVAL;
+ unsigned int dscp = 0;
- while ((c = getopt(argc, argv, "S::DN:V:P:FB:c:i:r:Ru:Ux:s:kK:t:m:Lhedp:fav")) != -1) {
+ while ((c = getopt(argc, argv, "S::DN:V:P:FB:c:i:r:Ru:Ux:s:kK:t:C:m:Lhedp:fav")) != -1) {
switch (c) {
case 'S':
allow_slaac_only = (optarg) ? atoi(optarg) : -1;
sol_timeout = atoi(optarg);
break;
+ case 'C':
+ dscp = atoi(optarg);
+ if (dscp > 63) {
+ dscp = 0;
+ syslog(LOG_ERR, "Invalid DSCP value, using default (0)");
+ }
+ break;
+
case 'm':
ra_holdoff_interval = atoi(optarg);
break;
}
}
- if ((urandom_fd = open("/dev/urandom", O_CLOEXEC | O_RDONLY)) < 0 ||
- init_dhcpv6(ifname, client_options, sk_prio, sol_timeout) ||
- ra_init(ifname, &ifid, ra_options, ra_holdoff_interval) ||
- script_init(script, ifname)) {
- syslog(LOG_ERR, "failed to initialize: %s", strerror(errno));
- return 4;
- }
+ if ((urandom_fd = open("/dev/urandom", O_CLOEXEC | O_RDONLY)) < 0 ||
+ init_dhcpv6(ifname, client_options, sk_prio, sol_timeout, dscp) ||
+ ra_init(ifname, &ifid, ra_options, ra_holdoff_interval) ||
+ script_init(script, ifname)) {
+ syslog(LOG_ERR, "failed to initialize: %s", strerror(errno));
+ return 4;
+ }
script_call("started", 0, false);
" -f Don't send Client FQDN option\n"
" -k Don't send a RELEASE when stopping\n"
" -K <sk-prio> Set packet kernel priority (0)\n"
+ " -C <dscp> Set packet DSCP value (0)\n"
" -t <seconds> Maximum timeout for DHCPv6-SOLICIT (120)\n"
" -m <seconds> Minimum time between accepting RA updates (3)\n"
" -L Ignore default lifetime for RDNSS records\n"
const char *str;
};
-int init_dhcpv6(const char *ifname, unsigned int client_options, int sk_prio, int sol_timeout);
+int init_dhcpv6(const char *ifname, unsigned int client_options, int sk_prio, int sol_timeout, unsigned int dscp);
int dhcpv6_set_ia_mode(enum odhcp6c_ia_mode na, enum odhcp6c_ia_mode pd, bool stateful_only);
int dhcpv6_request(enum dhcpv6_msg type);
int dhcpv6_poll_reconfigure(void);