Attention is currently required from: lynxis lazus, pespin.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36059?usp=email )
Change subject: epdg: Make sure PCO is forwarded from strongswan to PGW and back
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36059?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie01d6e88b3ccc55fecc97c2ba75bb31bba5b9ef7
Gerrit-Change-Number: 36059
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Tue, 27 Feb 2024 08:23:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36062?usp=email )
Change subject: osmo_io: Change struct osmo_io_ops to contain struct, not union
......................................................................
osmo_io: Change struct osmo_io_ops to contain struct, not union
As we introduce more modes, and each mode aliases call-back function
pointers to those of another mode, we have more and more error cases
where we (for exampele) access read_cb, but in reality the user has
populated recvfrom_cb.
Let's use a struct, meaning that call-backs of one mode no longer alias
to the same memory locations of call-backs fro another mode. This
allows us to properly check if the user actually provided the right
callbacks for the given mode of the iofd.
This breaks ABI, but luckily not API. So a simple recompile of
higher-layer library + application code will work.
Change-Id: I9d302df8d00369e7b30437a52deb205f75882be3
---
M TODO-RELEASE
M include/osmocom/core/osmo_io.h
M src/core/osmo_io.c
M src/core/osmo_io_poll.c
4 files changed, 96 insertions(+), 36 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
diff --git a/TODO-RELEASE b/TODO-RELEASE
index a8e812b..3e75184 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -12,6 +12,8 @@
core ADD osmo_sock_sctp_get_peer_addr_info()
core ADD gsmtap_inst_fd2() core, DEPRECATE gsmtap_inst_fd()
core behavior change osmo_tdef_fsm_inst_state_chg(): allow millisecond precision
+core ABI change osmo_io_ops now contains a struct of structs, not union of structs
+core ABI change osmo_iofd_set_ioops() now returns a value (error code)
isdn ABI change add states and flags for external T200 handling
isdn ADD initial implementation of the V.110 Terminal Adapter
gsm ABI change add T200 timer states to lapdm_datalink
diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h
index 46e1a53..3c704be 100644
--- a/include/osmocom/core/osmo_io.h
+++ b/include/osmocom/core/osmo_io.h
@@ -35,37 +35,35 @@
{ return get_value_string(osmo_io_backend_names, val); }
struct osmo_io_ops {
- union {
- /* mode OSMO_IO_FD_MODE_READ_WRITE: */
- struct {
- /*! call-back function when something was read from fd */
- void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg);
- /*! call-back function when write has completed on fd */
- void (*write_cb)(struct osmo_io_fd *iofd, int res,
- struct msgb *msg);
- /*! call-back function to segment the data at message boundaries.
- * Needs to return the size of the next message. If it returns
- * -EAGAIN or a value larger than msgb_length() (message is incomplete)
- * osmo_io will wait for more data to be read. Other negative values
- * cause the msg to be discarded.
- * If a full message was received (segmentation_cb() returns a value <= msgb_length())
- * the msgb will be trimmed to size by osmo_io and forwarded to the read call-back. Any
- * parsing done to the msgb by segmentation_cb() will be preserved for the read_cb()
- * (e.g. setting lxh or msgb->cb). */
- int (*segmentation_cb)(struct msgb *msg);
- };
+ /* mode OSMO_IO_FD_MODE_READ_WRITE: */
+ struct {
+ /*! call-back function when something was read from fd */
+ void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg);
+ /*! call-back function when write has completed on fd */
+ void (*write_cb)(struct osmo_io_fd *iofd, int res,
+ struct msgb *msg);
+ /*! call-back function to segment the data at message boundaries.
+ * Needs to return the size of the next message. If it returns
+ * -EAGAIN or a value larger than msgb_length() (message is incomplete)
+ * osmo_io will wait for more data to be read. Other negative values
+ * cause the msg to be discarded.
+ * If a full message was received (segmentation_cb() returns a value <= msgb_length())
+ * the msgb will be trimmed to size by osmo_io and forwarded to the read call-back. Any
+ * parsing done to the msgb by segmentation_cb() will be preserved for the read_cb()
+ * (e.g. setting lxh or msgb->cb). */
+ int (*segmentation_cb)(struct msgb *msg);
+ };
- /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */
- struct {
- /*! call-back function emulating recvfrom */
- void (*recvfrom_cb)(struct osmo_io_fd *iofd, int res,
- struct msgb *msg,
- const struct osmo_sockaddr *saddr);
- /*! call-back function emulating sendto */
- void (*sendto_cb)(struct osmo_io_fd *iofd, int res,
- struct msgb *msg,
- const struct osmo_sockaddr *daddr);
- };
+ /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */
+ struct {
+ /*! call-back function emulating recvfrom */
+ void (*recvfrom_cb)(struct osmo_io_fd *iofd, int res,
+ struct msgb *msg,
+ const struct osmo_sockaddr *saddr);
+ /*! call-back function emulating sendto */
+ void (*sendto_cb)(struct osmo_io_fd *iofd, int res,
+ struct msgb *msg,
+ const struct osmo_sockaddr *daddr);
};
};
@@ -98,4 +96,4 @@
const char *osmo_iofd_get_name(const struct osmo_io_fd *iofd);
void osmo_iofd_set_name(struct osmo_io_fd *iofd, const char *name);
-void osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops);
+int osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops);
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index e059f87..9de9e2e 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -306,6 +306,8 @@
int res;
struct msgb *pending = NULL;
+ OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE);
+
if (rc <= 0) {
iofd->io_ops.read_cb(iofd, rc, msg);
return;
@@ -473,6 +475,24 @@
return 0;
}
+static int check_mode_callback_compat(enum osmo_io_fd_mode mode, const struct osmo_io_ops *ops)
+{
+ switch (mode) {
+ case OSMO_IO_FD_MODE_READ_WRITE:
+ if (ops->recvfrom_cb || ops->sendto_cb)
+ return false;
+ break;
+ case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
+ if (ops->read_cb || ops->write_cb)
+ return false;
+ break;
+ default:
+ break;
+ }
+
+ return true;
+}
+
/*! Allocate and setup a new iofd.
* \param[in] ctx the parent context from which to allocate
* \param[in] fd the underlying system file descriptor
@@ -496,6 +516,9 @@
return NULL;
}
+ if (!check_mode_callback_compat(mode, ioops))
+ return NULL;
+
iofd = talloc_zero(ctx, struct osmo_io_fd);
if (!iofd)
return NULL;
@@ -543,8 +566,10 @@
return rc;
IOFD_FLAG_UNSET(iofd, IOFD_FLAG_CLOSED);
- if (iofd->io_ops.read_cb)
+ if ((iofd->mode == OSMO_IO_FD_MODE_READ_WRITE && iofd->io_ops.read_cb) ||
+ (iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO && iofd->io_ops.recvfrom_cb)) {
osmo_iofd_ops.read_enable(iofd);
+ }
if (iofd->tx_queue.current_length > 0)
osmo_iofd_ops.write_enable(iofd);
@@ -722,8 +747,11 @@
/*! Set the osmo_io_ops for an iofd.
* \param[in] iofd Target iofd file descriptor
* \param[in] ioops osmo_io_ops structure to be set */
-void osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops)
+int osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops)
{
+ if (!check_mode_callback_compat(iofd->mode, ioops))
+ return -EINVAL;
+
iofd->io_ops = *ioops;
switch (iofd->mode) {
@@ -743,6 +771,8 @@
default:
OSMO_ASSERT(0);
}
+
+ return 0;
}
/*! Notify the user if/when the socket is connected.
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index 5000dca..d7f80c0 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -81,10 +81,18 @@
rc = sendmsg(ofd->fd, &msghdr->hdr, msghdr->flags);
iofd_handle_send_completion(iofd, rc, msghdr);
} else {
- if (iofd->mode == OSMO_IO_FD_MODE_READ_WRITE)
- /* Socket is writable, but we have no data to send. A non-blocking/async
- connect() is signalled this way. */
+ /* Socket is writable, but we have no data to send. A non-blocking/async
+ connect() is signalled this way. */
+ switch (iofd->mode) {
+ case OSMO_IO_FD_MODE_READ_WRITE:
iofd->io_ops.write_cb(iofd, 0, NULL);
+ break;
+ case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
+ iofd->io_ops.sendto_cb(iofd, 0, NULL, NULL);
+ break;
+ default:
+ break;
+ }
if (osmo_iofd_txqueue_len(iofd) == 0)
iofd_poll_ops.write_disable(iofd);
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36062?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9d302df8d00369e7b30437a52deb205f75882be3
Gerrit-Change-Number: 36062
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36055?usp=email )
Change subject: Make socket.c compile without libsctp support (--disable-libsctp)
......................................................................
Make socket.c compile without libsctp support (--disable-libsctp)
Change-Id: I214a16b60e0149a8b1cdcfd3c788cc56a1a40476
---
M src/core/socket.c
1 file changed, 13 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/core/socket.c b/src/core/socket.c
index ce73cd8..d36a5f4 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1868,6 +1868,7 @@
return 0;
}
+#ifdef HAVE_LIBSCTP
/*! Get multiple IP addresses and/or port number on socket in separate string buffers
* \param[in] fd file descriptor of socket.
* \param[out] ip_proto IPPROTO of the socket, eg: IPPROTO_SCTP.
@@ -1956,6 +1957,7 @@
local ? sctp_freeladdrs(addrs) : sctp_freepaddrs(addrs);
return rc;
}
+#endif
/*! Get local IP address on socket
* \param[in] fd file descriptor of socket
@@ -2018,6 +2020,7 @@
return talloc_asprintf(ctx, "(%s)", str);
}
+#ifdef HAVE_LIBSCTP
/*! Format multiple IP addresses and/or port number into a combined string buffer
* \param[out] str Destination string buffer.
* \param[in] str_len sizeof(str), usually OSMO_SOCK_MULTIADDR_PEER_STR_MAXLEN.
@@ -2123,6 +2126,7 @@
return sb.chars_needed;
}
+#endif
/*! Get address/port information on socket in provided string buffer, like "r=1.2.3.4:5<->l=6.7.8.9:10".
* This does not include braces like osmo_sock_get_name().
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36055?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I214a16b60e0149a8b1cdcfd3c788cc56a1a40476
Gerrit-Change-Number: 36055
Gerrit-PatchSet: 2
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/35978?usp=email )
Change subject: VTY: rename 'sctp-role' to 'transport-role', add an alias
......................................................................
Patch Set 6: Code-Review+1
(1 comment)
File tests/vty/ss7_asp_test.vty:
https://gerrit.osmocom.org/c/libosmo-sccp/+/35978/comment/44ffe174_96fa1e22
PS2, Line 425: role sg
: transport-role ser
> I am one of those people who don't like omitting default values in the output of `show running-confi […]
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35978?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Iab6c898181d79a5ed2bea767ee90e55bc3af16a5
Gerrit-Change-Number: 35978
Gerrit-PatchSet: 6
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 27 Feb 2024 08:11:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment