diff options
author | Harald Welte <laforge@osmocom.org> | 2021-04-27 21:44:34 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-04-27 21:53:32 +0200 |
commit | ce53e03dc9ee231103c2ac1d3f2cb52515bbce0e (patch) | |
tree | fd58a201bef89dd7c3882ee97cd56f10f0010d7d /include/osmocom | |
parent | 069967be86bc8f341d23e45fa8c8a967f6d22eea (diff) |
socket: Introduce osmo_sock_set_dscp() to set socket DSCP value
At least on Linux, sockets have a IP_TOS socket option that can be
configured to set the TOS. However, TOS (of RFC791) was replaced
by the DSCP (of RFC2474) in 1998.
As the DCSP bits are only the upper 6 bits of the TOS bits, let's
introduce a helper to get, mask and set the DSCP values in the TOS
bits.
Related: OS#5136, SYS#5427
Change-Id: Ia4ba389a5b7e3e9d5f17a742a900d6fd68c08e40
Diffstat (limited to 'include/osmocom')
-rw-r--r-- | include/osmocom/core/socket.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h index 0443c06e..92cd202b 100644 --- a/include/osmocom/core/socket.h +++ b/include/osmocom/core/socket.h @@ -122,5 +122,7 @@ const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *sockaddr); char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr); +int osmo_sock_set_dscp(int fd, uint8_t dscp); + #endif /* (!EMBEDDED) */ /*! @} */ |