sk-inet: Add IP TOS socket option

The TOS(type of service) field in the ip header allows you specify the
priority of the socket data.

Signed-off-by: Suraj Shirvankar <surajshirvankar@gmail.com>
This commit is contained in:
Suraj Shirvankar 2023-04-12 13:38:06 +00:00 committed by Andrei Vagin
parent 4c1a2ac41b
commit 04cdbd6106
2 changed files with 5 additions and 0 deletions

View file

@ -416,9 +416,11 @@ static int dump_ip_opts(int sk, int family, int type, int proto, IpOptsEntry *io
} else {
ret |= dump_opt(sk, SOL_IP, IP_FREEBIND, &ioe->freebind);
ret |= dump_opt(sk, SOL_IP, IP_PKTINFO, &ioe->pktinfo);
ret |= dump_opt(sk, SOL_IP, IP_TOS, &ioe->tos);
}
ioe->has_freebind = ioe->freebind;
ioe->has_pktinfo = !!ioe->pktinfo;
ioe->has_tos = !!ioe->tos;
return ret;
}
@ -813,6 +815,8 @@ int restore_ip_opts(int sk, int family, int proto, IpOptsEntry *ioe)
ret |= restore_opt(sk, SOL_IP, IP_FREEBIND, &ioe->freebind);
if (ioe->has_pktinfo)
ret |= restore_opt(sk, SOL_IP, IP_PKTINFO, &ioe->pktinfo);
if (ioe->has_tos)
ret |= restore_opt(sk, SOL_IP, IP_TOS, &ioe->tos);
}
if (ioe->raw)

View file

@ -19,6 +19,7 @@ message ip_opts_entry {
optional ip_opts_raw_entry raw = 4;
optional bool pktinfo = 5;
optional uint32 tos = 6;
}
message inet_sk_entry {