Projects
osmocom:master
libosmo-netif
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 114
View file
commit_2014a82b7ae0b4214c0a9bd62297b2cd5d2163fa.txt
Added
View file
commit_e6c09ffa973517a580a42134694c1812efe18a2a.txt
Deleted
View file
libosmo-netif_1.5.1.12.e6c0.dsc -> libosmo-netif_1.5.1.14.2014.dsc
Changed
@@ -2,7 +2,7 @@ Source: libosmo-netif Binary: libosmonetif11, libosmo-netif-dev, libosmo-netif-doc, libosmo-netif-dbg Architecture: any all -Version: 1.5.1.12.e6c0 +Version: 1.5.1.14.2014 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/libosmo-netif Standards-Version: 3.9.6 @@ -15,8 +15,8 @@ libosmo-netif-doc deb doc optional arch=all libosmonetif11 deb libs optional arch=any Checksums-Sha1: - 94d03cfc170c2dc4e150a640e54b559fbb84b6fd 194564 libosmo-netif_1.5.1.12.e6c0.tar.xz + fe1377e6164337aca7dc227d46b41798bb2eb3fc 194012 libosmo-netif_1.5.1.14.2014.tar.xz Checksums-Sha256: - 84006831e4b11e7240b7b4055f6451f76e59d067990d490c99ad3296a8d240bd 194564 libosmo-netif_1.5.1.12.e6c0.tar.xz + 46fc99cb35435b75a53db99be7782176550787f1cc697ec2efa3d983f2565599 194012 libosmo-netif_1.5.1.14.2014.tar.xz Files: - 59d84e57b043187ca182a90a50334597 194564 libosmo-netif_1.5.1.12.e6c0.tar.xz + e154199b3116c0beb51ecdf652a4399a 194012 libosmo-netif_1.5.1.14.2014.tar.xz
View file
libosmo-netif_1.5.1.12.e6c0.tar.xz/.tarball-version -> libosmo-netif_1.5.1.14.2014.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.5.1.12-e6c0 +1.5.1.14-2014
View file
libosmo-netif_1.5.1.12.e6c0.tar.xz/TODO-RELEASE -> libosmo-netif_1.5.1.14.2014.tar.xz/TODO-RELEASE
Changed
@@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-netif add API osmo_stream_cli_set_{ip_dscp,priority}(), osmo_stream_srv_link_set_{ip_dscp,priority}()
View file
libosmo-netif_1.5.1.12.e6c0.tar.xz/debian/changelog -> libosmo-netif_1.5.1.14.2014.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -libosmo-netif (1.5.1.12.e6c0) unstable; urgency=medium +libosmo-netif (1.5.1.14.2014) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom master feed - -- Osmocom OBS scripts <info@osmocom.org> Fri, 22 Nov 2024 16:16:17 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Mon, 25 Nov 2024 10:21:33 +0000 libosmo-netif (1.5.1) unstable; urgency=medium
View file
libosmo-netif_1.5.1.12.e6c0.tar.xz/include/osmocom/netif/stream.h -> libosmo-netif_1.5.1.14.2014.tar.xz/include/osmocom/netif/stream.h
Changed
@@ -70,6 +70,8 @@ void osmo_stream_srv_link_set_name(struct osmo_stream_srv_link *link, const char *name); const char *osmo_stream_srv_link_get_name(const struct osmo_stream_srv_link *link); void osmo_stream_srv_link_set_nodelay(struct osmo_stream_srv_link *link, bool nodelay); +int osmo_stream_srv_link_set_priority(struct osmo_stream_srv_link *link, int sk_prio); +int osmo_stream_srv_link_set_ip_dscp(struct osmo_stream_srv_link *link, uint8_t ip_dscp); void osmo_stream_srv_link_set_addr(struct osmo_stream_srv_link *link, const char *addr); int osmo_stream_srv_link_set_addrs(struct osmo_stream_srv_link *link, const char **addr, size_t addrcnt); void osmo_stream_srv_link_set_port(struct osmo_stream_srv_link *link, uint16_t port); @@ -192,6 +194,8 @@ void osmo_stream_cli_set_name(struct osmo_stream_cli *cli, const char *name); const char *osmo_stream_cli_get_name(const struct osmo_stream_cli *cli); void osmo_stream_cli_set_nodelay(struct osmo_stream_cli *cli, bool nodelay); +int osmo_stream_cli_set_priority(struct osmo_stream_cli *cli, int sk_prio); +int osmo_stream_cli_set_ip_dscp(struct osmo_stream_cli *cli, uint8_t ip_dscp); void osmo_stream_cli_set_addr(struct osmo_stream_cli *cli, const char *addr); int osmo_stream_cli_set_addrs(struct osmo_stream_cli *cli, const char **addr, size_t addrcnt); void osmo_stream_cli_set_port(struct osmo_stream_cli *cli, uint16_t port);
View file
libosmo-netif_1.5.1.12.e6c0.tar.xz/src/stream_cli.c -> libosmo-netif_1.5.1.14.2014.tar.xz/src/stream_cli.c
Changed
@@ -102,7 +102,9 @@ uint16_t local_port; int sk_domain; int sk_type; + int sk_prio; /* socket priority, SO_PRIORITY, default=0=unset */ uint16_t proto; + uint8_t ip_dscp; /* IP Differentiated services, 0..63, default=0=unset */ osmo_stream_cli_connect_cb_t connect_cb; osmo_stream_cli_disconnect_cb_t disconnect_cb; osmo_stream_cli_read_cb_t read_cb; @@ -888,7 +890,8 @@ ret = osmo_sock_init2_multiaddr2(AF_UNSPEC, SOCK_STREAM, cli->proto, (const char **)cli->local_addr, cli->local_addrcnt, cli->local_port, (const char **)cli->addr, cli->addrcnt, cli->port, - OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK, + OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_BIND | OSMO_SOCK_F_NONBLOCK | + OSMO_SOCK_F_DSCP(cli->ip_dscp) | OSMO_SOCK_F_PRIO(cli->sk_prio), &cli->ma_pars); break; #endif @@ -896,7 +899,8 @@ ret = osmo_sock_init2(AF_UNSPEC, SOCK_STREAM, cli->proto, cli->local_addr0, cli->local_port, cli->addr0, cli->port, - OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); + OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_BIND | OSMO_SOCK_F_NONBLOCK | + OSMO_SOCK_F_DSCP(cli->ip_dscp) | OSMO_SOCK_F_PRIO(cli->sk_prio)); } if (ret < 0) { @@ -953,6 +957,69 @@ nodelay, errno); } +/*! Set the priority value of the stream socket. + * Setting this will automatically set the socket priority + * option on any socket established via \ref osmo_stream_cli_open + * or any re-connect. This can be set either before or after opening the + * socket. + * \paramin cli Stream client whose sockets are to be configured + * \paramin sk_prio priority value. Values outside 0..6 require CAP_NET_ADMIN. + * \return negative on error, 0 on success + */ +int osmo_stream_cli_set_priority(struct osmo_stream_cli *cli, int sk_prio) +{ + int rc; + int fd; + + if (cli->sk_prio == sk_prio) + return 0; /* No change needed */ + + cli->sk_prio = sk_prio; + + if (!stream_cli_is_opened(cli)) + return 0; /* Config will be applied upon open() time */ + + if ((fd = osmo_stream_cli_get_fd(cli)) < 0) { /* Shouldn't happen... */ + LOGSCLI(cli, LOGL_ERROR, "set_priority(%d): failed obtaining socket\n", cli->sk_prio); + return -EBADFD; + } + if ((rc = osmo_sock_set_priority(fd, cli->sk_prio)) < 0) + LOGSCLI(cli, LOGL_ERROR, "set_priority(%d): failed setsockopt err=%d\n", + cli->sk_prio, errno); + return rc; +} + +/*! Set the DSCP (differentiated services code point) of the stream socket. + * Setting this will automatically set the IP DSCP option on any socket established + * via \ref osmo_stream_cli_open or any re-connect. This can be set either before or + * after opening the socket. + * \paramin cli Stream client whose sockets are to be configured + * \paramin ip_dscp DSCP value. Value range 0..63. + * \return negative on error, 0 on success + */ +int osmo_stream_cli_set_ip_dscp(struct osmo_stream_cli *cli, uint8_t ip_dscp) +{ + int rc; + int fd; + + if (cli->ip_dscp == ip_dscp) + return 0; /* No change needed */ + + cli->ip_dscp = ip_dscp; + + if (!stream_cli_is_opened(cli)) + return 0; /* Config will be applied upon open() time */ + + if ((fd = osmo_stream_cli_get_fd(cli)) < 0) { /* Shouldn't happen... */ + LOGSCLI(cli, LOGL_ERROR, "set_ip_dscp(%u): failed obtaining socket\n", cli->ip_dscp); + return -EBADFD; + } + if ((rc = osmo_sock_set_dscp(fd, cli->ip_dscp)) < 0) + LOGSCLI(cli, LOGL_ERROR, "set_ip_dscp(%u): failed setsockopt err=%d\n", + cli->ip_dscp, errno); + return rc; +} + /*! Open connection of an Osmocom stream client. * This will initiate an non-blocking outbound connect to the configured destination (server) address. * By default the client will automatically attempt to reconnect after default timeout. @@ -982,7 +1049,8 @@ #ifdef HAVE_LIBSCTP case IPPROTO_SCTP: local_addrcnt = cli->local_addrcnt; - flags = OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK; + flags = OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_NONBLOCK | + OSMO_SOCK_F_DSCP(cli->ip_dscp) | OSMO_SOCK_F_PRIO(cli->sk_prio); if (cli->local_addrcnt > 0 || cli->local_port > 0) { /* explicit bind required? */ flags |= OSMO_SOCK_F_BIND; /* If no local addr configured, use local_addr0=NULL by default when creating the socket. */ @@ -999,7 +1067,8 @@ ret = osmo_sock_init2(cli->sk_domain, cli->sk_type, cli->proto, cli->local_addr0, cli->local_port, cli->addr0, cli->port, - OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); + OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_BIND | OSMO_SOCK_F_NONBLOCK | + OSMO_SOCK_F_DSCP(cli->ip_dscp) | OSMO_SOCK_F_PRIO(cli->sk_prio)); } break; default:
View file
libosmo-netif_1.5.1.12.e6c0.tar.xz/src/stream_srv.c -> libosmo-netif_1.5.1.14.2014.tar.xz/src/stream_srv.c
Changed
@@ -81,7 +81,9 @@ uint16_t port; int sk_domain; int sk_type; + int sk_prio; /* socket priority, SO_PRIORITY, default=0=unset */ uint16_t proto; + uint8_t ip_dscp; /* IP Differentiated services, 0..63, default=0=unset */ osmo_stream_srv_link_accept_cb_t accept_cb; void *data; int flags; @@ -148,6 +150,24 @@ goto error_close_socket; } + if (link->ip_dscp > 0) { + ret = osmo_sock_set_dscp(sock_fd, link->ip_dscp); + if (ret < 0) { + LOGSLNK(link, LOGL_ERROR, "set_ip_dscp(%u): failed setsockopt err=%d\n", + link->ip_dscp, errno); + goto error_close_socket; + } + } + + if (link->sk_prio > 0) { + ret = osmo_sock_set_priority(sock_fd, link->sk_prio); + if (ret < 0) { + LOGSLNK(link, LOGL_ERROR, "set_priority(%d): failed setsockopt err=%d\n", + link->sk_prio, errno); + goto error_close_socket; + } + } + if (!link->accept_cb) { ret = -ENOTSUP; goto error_close_socket; @@ -224,6 +244,33 @@ link->flags &= ~OSMO_STREAM_SRV_F_NODELAY; } +/*! Set the priority value of the stream socket. + * Setting this will automatically set the socket priority + * option on any socket established via this server link, before + * calling the accept_cb(). + * \paramin link server link whose sockets are to be configured + * \paramin sk_prio priority value. Values outside 0..6 require CAP_NET_ADMIN. + * \return negative on error, 0 on success + */ +int osmo_stream_srv_link_set_priority(struct osmo_stream_srv_link *link, int sk_prio) +{ + link->sk_prio = sk_prio; + return 0; +} + +/*! Set the DSCP (differentiated services code point) of the stream socket. + * Setting this will automatically set the IP DSCP option on any socket on any + * socket established via this server link, before calling the accept_cb(). + * \paramin link server link whose sockets are to be configured + * \paramin ip_dscp DSCP value. Value range 0..63. + * \return negative on error, 0 on success + */ +int osmo_stream_srv_link_set_ip_dscp(struct osmo_stream_srv_link *link, uint8_t ip_dscp) +{ + link->ip_dscp = ip_dscp; + return 0; +} + /*! Set the local address to which we bind. * Any changes to this setting will only become active upon next (re)connect. * \paramin link Stream Server Link to modify
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.