Changes of Revision 385

libosmocore.spec Changed
x
 
1
@@ -14,13 +14,13 @@
2
 
3
 Name:           libosmocore
4
 Requires: osmocom-master
5
-Version: 1.10.0.47.38eb4
6
+Version: 1.10.0.54.3536
7
 Release:        0
8
 Summary:        The Open Source Mobile Communications Core Library
9
 License:        GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND AGPL-3.0-or-later
10
 Group:          Productivity/Telephony/Utilities
11
 Url:            https://osmocom.org/projects/libosmocore/wiki/Libosmocore
12
-Source: libosmocore_1.10.0.47.38eb4.tar.xz
13
+Source: libosmocore_1.10.0.54.3536.tar.xz
14
 Source1: rpmlintrc
15
 BuildRequires:  automake >= 1.6
16
 BuildRequires:  libtool >= 2
17
commit_353638e2ff94b1ae4f46132b30edbacc99259852.txt Added
commit_38eb4281066b73440230423dfcc055e80ace1b28.txt Deleted
libosmocore_1.10.0.47.38eb4.dsc -> libosmocore_1.10.0.54.3536.dsc Changed
22
 
1
@@ -2,7 +2,7 @@
2
 Source: libosmocore
3
 Binary: libosmocore, libosmocodec4, libosmocodec-doc, libosmocoding0, libosmocoding-doc, libosmocore22, libosmocore-doc, libosmogb14, libosmogb-doc, libosmogsm20, libosmogsm-doc, libosmoisdn0, libosmoisdn-doc, libosmovty13, libosmovty-doc, libosmoctrl0, libosmoctrl-doc, libosmosim2, libosmosim-doc, libosmousb0, libosmousb-doc, libosmocore-dev, libosmocore-utils, libosmocore-dbg
4
 Architecture: any all
5
-Version: 1.10.0.47.38eb4
6
+Version: 1.10.0.54.3536
7
 Maintainer: Osmocom team <openbsc@lists.osmocom.org>
8
 Homepage: https://projects.osmocom.org/projects/libosmocore
9
 Standards-Version: 3.9.8
10
@@ -35,8 +35,8 @@
11
  libosmovty-doc deb doc optional arch=all
12
  libosmovty13 deb libs optional arch=any
13
 Checksums-Sha1:
14
- bde58bf5898ba78cf4bd8c47638318337e2f77c6 1123248 libosmocore_1.10.0.47.38eb4.tar.xz
15
+ 5cab2071ca26eaa4f4b8fa635f959e9ce70a2226 1123280 libosmocore_1.10.0.54.3536.tar.xz
16
 Checksums-Sha256:
17
- dbe27783b3276ff80f41b07cbc1bc2bec1118e9e8d12a9a011bdf6735b7defd5 1123248 libosmocore_1.10.0.47.38eb4.tar.xz
18
+ 0c2f6e80fd73323cce398213b3b26f671c73bb81ffab7c9c3407a5f83f34fb2c 1123280 libosmocore_1.10.0.54.3536.tar.xz
19
 Files:
20
- f19cad99e358b1081c724cd11fd20190 1123248 libosmocore_1.10.0.47.38eb4.tar.xz
21
+ fe38ed0c31a9136b4b100409efa6dcaa 1123280 libosmocore_1.10.0.54.3536.tar.xz
22
libosmocore_1.10.0.47.38eb4.tar.xz/.tarball-version -> libosmocore_1.10.0.54.3536.tar.xz/.tarball-version Changed
4
 
1
@@ -1 +1 @@
2
-1.10.0.47-38eb4
3
+1.10.0.54-3536
4
libosmocore_1.10.0.47.38eb4.tar.xz/debian/changelog -> libosmocore_1.10.0.54.3536.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-libosmocore (1.10.0.47.38eb4) unstable; urgency=medium
3
+libosmocore (1.10.0.54.3536) unstable; urgency=medium
4
 
5
   * Automatically generated changelog entry for building the Osmocom master feed
6
 
7
- -- Osmocom OBS scripts <info@osmocom.org>  Thu, 05 Dec 2024 13:52:26 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org>  Tue, 10 Dec 2024 11:27:44 +0000
9
 
10
 libosmocore (1.10.0) unstable; urgency=medium
11
 
12
libosmocore_1.10.0.47.38eb4.tar.xz/src/core/osmo_io.c -> libosmocore_1.10.0.54.3536.tar.xz/src/core/osmo_io.c Changed
90
 
1
@@ -328,7 +328,7 @@
2
 void iofd_handle_segmented_read(struct osmo_io_fd *iofd, struct msgb *msg, int rc)
3
 {
4
    int res;
5
-   struct msgb *pending = NULL;
6
+   struct msgb *pending;
7
 
8
    OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE);
9
 
10
@@ -338,9 +338,18 @@
11
    }
12
 
13
    do {
14
+       pending = NULL;
15
        res = iofd_handle_segmentation(iofd, msg, &pending);
16
-       if (res != IOFD_SEG_ACT_DEFER || rc < 0)
17
+       if (res != IOFD_SEG_ACT_DEFER || rc < 0) {
18
            iofd->io_ops.read_cb(iofd, rc, msg);
19
+           /* The user could unregister/close the iofd during read_cb() above.
20
+            * Once that's done, it doesn't expect to receive any more events,
21
+            * so discard it: */
22
+           if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) {
23
+               msgb_free(pending);
24
+               return;
25
+           }
26
+       }
27
        if (res == IOFD_SEG_ACT_HANDLE_MORE)
28
            msg = pending;
29
    } while (res == IOFD_SEG_ACT_HANDLE_MORE);
30
@@ -736,19 +745,29 @@
31
 {
32
    int rc = 0;
33
 
34
-   if (fd >= 0)
35
-       iofd->fd = fd;
36
-   else if (iofd->fd < 0) {
37
+   if (fd < 0 && iofd->fd < 0) {
38
        /* this might happen if both osmo_iofd_setup() and osmo_iofd_register() are called with -1 */
39
        LOGPIO(iofd, LOGL_ERROR, "Cannot register io_fd using invalid fd == %d\n", iofd->fd);
40
        return -EBADF;
41
    }
42
+   if (fd < 0)
43
+       fd = iofd->fd;
44
+   else if (iofd->fd < 0)
45
+       iofd->fd = fd;
46
+
47
+   if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) {
48
+       /* If re-registering same fd, handle as NO-OP.
49
+        * New FD should go through unregister() first. */
50
+       return iofd->fd == fd ? 0 : -ENOTSUP;
51
+   }
52
 
53
    rc = osmo_iofd_ops.register_fd(iofd);
54
    if (rc)
55
        return rc;
56
 
57
    IOFD_FLAG_UNSET(iofd, IOFD_FLAG_CLOSED);
58
+   IOFD_FLAG_SET(iofd, IOFD_FLAG_FD_REGISTERED);
59
+
60
    if ((iofd->mode == OSMO_IO_FD_MODE_READ_WRITE && iofd->io_ops.read_cb) ||
61
        (iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO && iofd->io_ops.recvfrom_cb) ||
62
        (iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG && iofd->io_ops.recvmsg_cb)) {
63
@@ -771,7 +790,14 @@
64
  */
65
 int osmo_iofd_unregister(struct osmo_io_fd *iofd)
66
 {
67
-   return osmo_iofd_ops.unregister_fd(iofd);
68
+   int rc;
69
+
70
+   if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
71
+       return 0;
72
+
73
+   rc = osmo_iofd_ops.unregister_fd(iofd);
74
+   IOFD_FLAG_UNSET(iofd, IOFD_FLAG_FD_REGISTERED);
75
+   return rc;
76
 }
77
 
78
 /*! Retrieve the number of messages pending in the transmit queue.
79
@@ -844,6 +870,10 @@
80
 
81
    iofd->pending = NULL;
82
 
83
+   osmo_iofd_ops.read_disable(iofd);
84
+   osmo_iofd_ops.write_disable(iofd);
85
+   osmo_iofd_unregister(iofd);
86
+
87
    rc = osmo_iofd_ops.close(iofd);
88
    iofd->fd = -1;
89
    return rc;
90
libosmocore_1.10.0.47.38eb4.tar.xz/src/core/osmo_io_poll.c -> libosmocore_1.10.0.54.3536.tar.xz/src/core/osmo_io_poll.c Changed
51
 
1
@@ -128,32 +128,24 @@
2
    struct osmo_fd *ofd = &iofd->u.poll.ofd;
3
    int rc;
4
 
5
-   if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
6
-       return 0;
7
    osmo_fd_setup(ofd, iofd->fd, 0, &iofd_poll_ofd_cb_dispatch, iofd, 0);
8
+   if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED))
9
+       osmo_fd_write_enable(&iofd->u.poll.ofd);
10
+
11
    rc = osmo_fd_register(ofd);
12
-   if (!rc)
13
-       IOFD_FLAG_SET(iofd, IOFD_FLAG_FD_REGISTERED);
14
    return rc;
15
 }
16
 
17
 static int iofd_poll_unregister(struct osmo_io_fd *iofd)
18
 {
19
    struct osmo_fd *ofd = &iofd->u.poll.ofd;
20
-
21
-   if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
22
-       return 0;
23
    osmo_fd_unregister(ofd);
24
-   IOFD_FLAG_UNSET(iofd, IOFD_FLAG_FD_REGISTERED);
25
-
26
    return 0;
27
 }
28
 
29
 static int iofd_poll_close(struct osmo_io_fd *iofd)
30
 {
31
-   iofd_poll_unregister(iofd);
32
    osmo_fd_close(&iofd->u.poll.ofd);
33
-
34
    return 0;
35
 }
36
 
37
@@ -179,11 +171,9 @@
38
 
39
 static void iofd_poll_notify_connected(struct osmo_io_fd *iofd)
40
 {
41
-   int rc;
42
+   /* Set flag to enable during register() time: */
43
+   IOFD_FLAG_SET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);
44
 
45
-   rc = iofd_poll_register(iofd);
46
-   if (rc < 0)
47
-       return;
48
    osmo_fd_write_enable(&iofd->u.poll.ofd);
49
 }
50
 
51
libosmocore_1.10.0.47.38eb4.tar.xz/src/core/osmo_io_uring.c -> libosmocore_1.10.0.54.3536.tar.xz/src/core/osmo_io_uring.c Changed
148
 
1
@@ -324,8 +324,65 @@
2
 static void iofd_uring_write_enable(struct osmo_io_fd *iofd);
3
 static void iofd_uring_read_enable(struct osmo_io_fd *iofd);
4
 
5
+
6
+/* called via osmocom poll/select main handling once outbound non-blocking connect() completes */
7
+static int iofd_uring_connected_cb(struct osmo_fd *ofd, unsigned int what)
8
+{
9
+   struct osmo_io_fd *iofd = ofd->data;
10
+
11
+   LOGPIO(iofd, LOGL_DEBUG, "Socket connected or failed.\n");
12
+
13
+   if (!(what & OSMO_FD_WRITE))
14
+       return 0;
15
+
16
+   /* Unregister from poll/select handling. */
17
+   osmo_fd_unregister(ofd);
18
+   IOFD_FLAG_UNSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);
19
+
20
+   /* Notify the application about this via a zero-length write completion call-back. */
21
+   IOFD_FLAG_SET(iofd, IOFD_FLAG_IN_CALLBACK);
22
+   switch (iofd->mode) {
23
+   case OSMO_IO_FD_MODE_READ_WRITE:
24
+       iofd->io_ops.write_cb(iofd, 0, NULL);
25
+       break;
26
+   case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
27
+       iofd->io_ops.sendto_cb(iofd, 0, NULL, NULL);
28
+       break;
29
+   case OSMO_IO_FD_MODE_RECVMSG_SENDMSG:
30
+       iofd->io_ops.sendmsg_cb(iofd, 0, NULL);
31
+       break;
32
+   }
33
+   IOFD_FLAG_UNSET(iofd, IOFD_FLAG_IN_CALLBACK);
34
+
35
+   /* If write/read notifications are pending, enable it now. */
36
+   if (iofd->u.uring.write_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
37
+       iofd_uring_write_enable(iofd);
38
+   if (iofd->u.uring.read_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
39
+       iofd_uring_read_enable(iofd);
40
+
41
+   if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_TO_FREE) && !iofd->u.uring.read_msghdr && !iofd->u.uring.write_msghdr)
42
+       talloc_free(iofd);
43
+   return 0;
44
+}
45
+
46
 static int iofd_uring_register(struct osmo_io_fd *iofd)
47
 {
48
+   if (iofd->mode != OSMO_IO_FD_MODE_RECVMSG_SENDMSG)
49
+       return 0; /* Nothing to be done */
50
+
51
+   /* OSMO_IO_FD_MODE_RECVMSG_SENDMSG:
52
+    * Use a temporary osmo_fd which we can use to notify us once the connection is established
53
+    * or failed (indicated by FD becoming writable). This is needed as (at least for SCTP sockets)
54
+    * one cannot submit a zero-length writev/sendmsg in order to get notification when the socekt
55
+    * is writable.*/
56
+   if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED)) {
57
+       osmo_fd_setup(&iofd->u.uring.connect_ofd, iofd->fd, OSMO_FD_WRITE,
58
+                 iofd_uring_connected_cb, iofd, 0);
59
+       if (osmo_fd_register(&iofd->u.uring.connect_ofd) < 0) {
60
+           LOGPIO(iofd, LOGL_ERROR, "Failed to register FD for connect event.\n");
61
+           return -EBADFD;
62
+       }
63
+   }
64
    return 0;
65
 }
66
 
67
@@ -450,72 +507,21 @@
68
 
69
 static int iofd_uring_close(struct osmo_io_fd *iofd)
70
 {
71
-   iofd_uring_read_disable(iofd);
72
-   iofd_uring_write_disable(iofd);
73
-   iofd_uring_unregister(iofd);
74
    return close(iofd->fd);
75
 }
76
 
77
-/* called via osmocom poll/select main handling once outbound non-blocking connect() completes */
78
-static int iofd_uring_connected_cb(struct osmo_fd *ofd, unsigned int what)
79
+static void iofd_uring_notify_connected(struct osmo_io_fd *iofd)
80
 {
81
-   struct osmo_io_fd *iofd = ofd->data;
82
-
83
-   LOGPIO(iofd, LOGL_DEBUG, "Socket connected or failed.\n");
84
-
85
-   if (!(what & OSMO_FD_WRITE))
86
-       return 0;
87
-
88
-   /* Unregister from poll/select handling. */
89
-   osmo_fd_unregister(ofd);
90
-   IOFD_FLAG_UNSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);
91
-
92
-   /* Notify the application about this via a zero-length write completion call-back. */
93
-   IOFD_FLAG_SET(iofd, IOFD_FLAG_IN_CALLBACK);
94
-   switch (iofd->mode) {
95
-   case OSMO_IO_FD_MODE_READ_WRITE:
96
-       iofd->io_ops.write_cb(iofd, 0, NULL);
97
-       break;
98
-   case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
99
-       iofd->io_ops.sendto_cb(iofd, 0, NULL, NULL);
100
-       break;
101
-   case OSMO_IO_FD_MODE_RECVMSG_SENDMSG:
102
-       iofd->io_ops.sendmsg_cb(iofd, 0, NULL);
103
-       break;
104
-   }
105
-   IOFD_FLAG_UNSET(iofd, IOFD_FLAG_IN_CALLBACK);
106
-
107
-   /* If write/read notifications are pending, enable it now. */
108
-   if (iofd->u.uring.write_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
109
+   if (iofd->mode != OSMO_IO_FD_MODE_RECVMSG_SENDMSG) {
110
        iofd_uring_write_enable(iofd);
111
-   if (iofd->u.uring.read_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
112
-       iofd_uring_read_enable(iofd);
113
+       return;
114
+   }
115
 
116
-   if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_TO_FREE) && !iofd->u.uring.read_msghdr && !iofd->u.uring.write_msghdr)
117
-       talloc_free(iofd);
118
-   return 0;
119
-}
120
+   /* OSMO_IO_FD_MODE_RECVMSG_SENDMSG: Don't call this function after enabling read or write. */
121
+   OSMO_ASSERT(!iofd->u.uring.write_enabled && !iofd->u.uring.read_enabled);
122
 
123
-static void iofd_uring_notify_connected(struct osmo_io_fd *iofd)
124
-{
125
-   if (iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG) {
126
-       /* Don't call this function after enabling read or write. */
127
-       OSMO_ASSERT(!iofd->u.uring.write_enabled && !iofd->u.uring.read_enabled);
128
-
129
-       /* Use a temporary osmo_fd which we can use to notify us once the connection is established
130
-        * or failed (indicated by FD becoming writable).
131
-        * This is needed as (at least for SCTP sockets) one cannot submit a zero-length writev/sendmsg
132
-        * in order to get notification when the socekt is writable.*/
133
-       if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED)) {
134
-           osmo_fd_setup(&iofd->u.uring.connect_ofd, iofd->fd, OSMO_FD_WRITE,
135
-                     iofd_uring_connected_cb, iofd, 0);
136
-           if (osmo_fd_register(&iofd->u.uring.connect_ofd) < 0)
137
-               LOGPIO(iofd, LOGL_ERROR, "Failed to register FD for connect event.\n");
138
-           else
139
-               IOFD_FLAG_SET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);
140
-       }
141
-   } else
142
-       iofd_uring_write_enable(iofd);
143
+   /* Set flag to enable temporary osmo_fd during register() time: */
144
+   IOFD_FLAG_SET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);
145
 }
146
 
147
 const struct iofd_backend_ops iofd_uring_ops = {
148