Hello,
I am using shadowsocks-libev v3.3.5 as a proxy for my openwrt router with this json configuration file:
{
"server": <my_server_ip>,
"server_port": 1090,
"local_port": 8388,
"password": "my_pass",
"timeout": 86400,
"method": "chacha20-ietf-poly1305",
"reuse_port": true,
"fast_open": false,
"disable_sni": true,
"mptcp": true,
"dscp": {
"8389": "CS1",
"8390": "CS4"
}
}
- I use dscp configuration for packets classification here
This was working fine on openwrt 21.02 (kernel version 5.4).
I upgraded my openwrt image to openwrt 23.05 (kernel version 5.15) and I started getting errors from shadowsocks binary about dscp configuration:
ERROR: setting ipv4 dscp failed: 22
ERROR: setting ipv6 dscp failed: 22
I tracked the error message in shadowsocks-libev source code in C and found that updating the socket options with the dscp value given in the configuration fails.
Here is the lines from redir.c file redir.c
// Set non blocking
setnonblocking(remotefd);
if (listener->tos >= 0) {
int rc = setsockopt(remotefd, IPPROTO_IP, IP_TOS, &listener->tos, sizeof(listener->tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv4 dscp failed: %d", errno);
}
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &listener->tos, sizeof(listener->tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv6 dscp failed: %d", errno);
}
}
Did anyone face such an issue ?
Any idea about kernel updates/upgrades that shall cause this?
Thanks