We truncated the diff of some files because they were too big.
If you want to see the full diff for every file, click here.
Changes of Revision 50
libosmocore.spec
Changed
x
1
2
3
Name: libosmocore
4
Requires: osmocom-master
5
-Version: 1.7.0.104.4ce8
6
+Version: 1.7.0.105.8a50
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.7.0.104.4ce8.tar.xz
13
+Source: libosmocore_1.7.0.105.8a50.tar.xz
14
Source1: rpmlintrc
15
BuildRequires: automake >= 1.6
16
BuildRequires: libtool >= 2
17
commit_4ce820ab8d0820c664afb07e9ea62fdc41eb00ad.txt
Deleted
commit_8a5014be084249be515d0b3d088e9cb21d7552bc.txt
Added
libosmocore_1.7.0.104.4ce8.dsc
Deleted
42
1
2
-Format: 3.0 (native)
3
-Source: libosmocore
4
-Binary: libosmocore, libosmocodec0, libosmocodec-doc, libosmocoding0, libosmocoding-doc, libosmocore19, libosmocore-doc, libosmogb14, libosmogb-doc, libosmogsm18, libosmogsm-doc, libosmoisdn0, libosmoisdn-doc, libosmovty9, libosmovty-doc, libosmoctrl0, libosmoctrl-doc, libosmosim2, libosmousb0, libosmocore-dev, libosmocore-utils, libosmocore-dbg
5
-Architecture: any all
6
-Version: 1.7.0.104.4ce8
7
-Maintainer: Osmocom team <openbsc@lists.osmocom.org>
8
-Homepage: https://projects.osmocom.org/projects/libosmocore
9
-Standards-Version: 3.9.8
10
-Vcs-Browser: https://gitea.osmocom.org/osmocom/libosmocore
11
-Vcs-Git: https://gitea.osmocom.org/osmocom/libosmocore
12
-Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libgnutls28-dev, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev (>= 2.1.0), libsctp-dev, libusb-1.0-0-dev, libmnl-dev, libsystemd-dev, python3:native
13
-Package-List:
14
- libosmocodec-doc deb doc optional arch=all
15
- libosmocodec0 deb libs optional arch=any
16
- libosmocoding-doc deb doc optional arch=all
17
- libosmocoding0 deb libs optional arch=any
18
- libosmocore deb libs optional arch=any
19
- libosmocore-dbg deb debug extra arch=any
20
- libosmocore-dev deb libdevel optional arch=any
21
- libosmocore-doc deb doc optional arch=all
22
- libosmocore-utils deb utils optional arch=any
23
- libosmocore19 deb libs optional arch=any
24
- libosmoctrl-doc deb doc optional arch=all
25
- libosmoctrl0 deb libs optional arch=any
26
- libosmogb-doc deb doc optional arch=all
27
- libosmogb14 deb libs optional arch=any
28
- libosmogsm-doc deb doc optional arch=all
29
- libosmogsm18 deb libs optional arch=any
30
- libosmoisdn-doc deb doc optional arch=all
31
- libosmoisdn0 deb libs optional arch=any
32
- libosmosim2 deb libs optional arch=any
33
- libosmousb0 deb libs optional arch=any
34
- libosmovty-doc deb doc optional arch=all
35
- libosmovty9 deb libs optional arch=any
36
-Checksums-Sha1:
37
- cda7f54ea54ff3e57eb9988ad5baa81105930df3 1007272 libosmocore_1.7.0.104.4ce8.tar.xz
38
-Checksums-Sha256:
39
- 3178210b0d7ab420fdaf59a428779f943e98cdc9bcfa4464ad30b80386433440 1007272 libosmocore_1.7.0.104.4ce8.tar.xz
40
-Files:
41
- ef3589628bf8db8793892d26d3473e8b 1007272 libosmocore_1.7.0.104.4ce8.tar.xz
42
libosmocore_1.7.0.105.8a50.dsc
Added
42
1
2
+Format: 3.0 (native)
3
+Source: libosmocore
4
+Binary: libosmocore, libosmocodec0, libosmocodec-doc, libosmocoding0, libosmocoding-doc, libosmocore19, libosmocore-doc, libosmogb14, libosmogb-doc, libosmogsm18, libosmogsm-doc, libosmoisdn0, libosmoisdn-doc, libosmovty9, libosmovty-doc, libosmoctrl0, libosmoctrl-doc, libosmosim2, libosmousb0, libosmocore-dev, libosmocore-utils, libosmocore-dbg
5
+Architecture: any all
6
+Version: 1.7.0.105.8a50
7
+Maintainer: Osmocom team <openbsc@lists.osmocom.org>
8
+Homepage: https://projects.osmocom.org/projects/libosmocore
9
+Standards-Version: 3.9.8
10
+Vcs-Browser: https://gitea.osmocom.org/osmocom/libosmocore
11
+Vcs-Git: https://gitea.osmocom.org/osmocom/libosmocore
12
+Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libgnutls28-dev, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev (>= 2.1.0), libsctp-dev, libusb-1.0-0-dev, libmnl-dev, libsystemd-dev, python3:native
13
+Package-List:
14
+ libosmocodec-doc deb doc optional arch=all
15
+ libosmocodec0 deb libs optional arch=any
16
+ libosmocoding-doc deb doc optional arch=all
17
+ libosmocoding0 deb libs optional arch=any
18
+ libosmocore deb libs optional arch=any
19
+ libosmocore-dbg deb debug extra arch=any
20
+ libosmocore-dev deb libdevel optional arch=any
21
+ libosmocore-doc deb doc optional arch=all
22
+ libosmocore-utils deb utils optional arch=any
23
+ libosmocore19 deb libs optional arch=any
24
+ libosmoctrl-doc deb doc optional arch=all
25
+ libosmoctrl0 deb libs optional arch=any
26
+ libosmogb-doc deb doc optional arch=all
27
+ libosmogb14 deb libs optional arch=any
28
+ libosmogsm-doc deb doc optional arch=all
29
+ libosmogsm18 deb libs optional arch=any
30
+ libosmoisdn-doc deb doc optional arch=all
31
+ libosmoisdn0 deb libs optional arch=any
32
+ libosmosim2 deb libs optional arch=any
33
+ libosmousb0 deb libs optional arch=any
34
+ libosmovty-doc deb doc optional arch=all
35
+ libosmovty9 deb libs optional arch=any
36
+Checksums-Sha1:
37
+ 3151f8000466ccf4f8b3a53456f62c1d875818c4 1007908 libosmocore_1.7.0.105.8a50.tar.xz
38
+Checksums-Sha256:
39
+ f5b65e4492fa04d0a0d34fc2a62e3514a18a916b67a3f3a669b6d6fc95a29b7e 1007908 libosmocore_1.7.0.105.8a50.tar.xz
40
+Files:
41
+ faf22de779f448f5f2b17335a915878b 1007908 libosmocore_1.7.0.105.8a50.tar.xz
42
libosmocore_1.7.0.104.4ce8.tar.xz/.tarball-version -> libosmocore_1.7.0.105.8a50.tar.xz/.tarball-version
Changed
4
1
2
-1.7.0.104-4ce8
3
+1.7.0.105-8a50
4
libosmocore_1.7.0.104.4ce8.tar.xz/TODO-RELEASE -> libosmocore_1.7.0.105.8a50.tar.xz/TODO-RELEASE
Changed
6
1
2
#library what description / commit summary line
3
libosmocore new API osmo_sockaddr_is_any(), osmo_sockaddr_netmask_to_prefixlen()
4
libosmocore ABI breakage OSMO_NUM_DLIB change affecting internal_cat
5
+libosmocore new API osmo_netns_*()
6
libosmocore_1.7.0.104.4ce8.tar.xz/debian/changelog -> libosmocore_1.7.0.105.8a50.tar.xz/debian/changelog
Changed
12
1
2
-libosmocore (1.7.0.104.4ce8) unstable; urgency=medium
3
+libosmocore (1.7.0.105.8a50) unstable; urgency=medium
4
5
* Automatically generated changelog entry for building the Osmocom master feed
6
7
- -- Osmocom OBS scripts <info@osmocom.org> Sat, 21 Jan 2023 21:57:41 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org> Tue, 24 Jan 2023 18:02:36 +0000
9
10
libosmocore (1.7.0) unstable; urgency=medium
11
12
libosmocore_1.7.0.104.4ce8.tar.xz/include/osmocom/core/Makefile.am -> libosmocore_1.7.0.105.8a50.tar.xz/include/osmocom/core/Makefile.am
Changed
9
1
2
stats.h \
3
macaddr.h \
4
msgb.h \
5
+ netns.h \
6
panic.h \
7
prbs.h \
8
prim.h \
9
libosmocore_1.7.0.105.8a50.tar.xz/include/osmocom/core/netns.h
Added
26
1
2
+/*! \file netns.h
3
+ * Network namespace convenience functions. */
4
+
5
+#pragma once
6
+#if (!EMBEDDED)
7
+
8
+#if defined(__linux__)
9
+
10
+#include <signal.h>
11
+
12
+struct osmo_netns_switch_state {
13
+ sigset_t prev_sigmask;
14
+ int prev_nsfd;
15
+};
16
+
17
+int osmo_netns_open_fd(const char *name);
18
+int osmo_netns_switch_enter(int nsfd, struct osmo_netns_switch_state *state);
19
+int osmo_netns_switch_exit(struct osmo_netns_switch_state *state);
20
+
21
+
22
+#endif /* defined(__linux__) */
23
+
24
+#endif /* (!EMBEDDED) */
25
+/*! @} */
26
libosmocore_1.7.0.104.4ce8.tar.xz/src/core/Makefile.am -> libosmocore_1.7.0.105.8a50.tar.xz/src/core/Makefile.am
Changed
9
1
2
loggingrb.c \
3
macaddr.c \
4
msgb.c \
5
+ netns.c \
6
panic.c \
7
prbs.c \
8
prim.c \
9
libosmocore_1.7.0.105.8a50.tar.xz/src/core/netns.c
Added
201
1
2
+
3
+/* Network namespace convenience functions
4
+ * (C) 2023 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
5
+ *
6
+ * All Rights Reserved
7
+ *
8
+ * SPDX-License-Identifier: GPL-2.0+
9
+ *
10
+ * This program is free software; you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as published by
12
+ * the Free Software Foundation; either version 2 of the License, or
13
+ * (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ */
21
+
22
+#include "config.h"
23
+
24
+/*! \addtogroup netns
25
+ * @{
26
+ * Network namespace convenience functions
27
+ *
28
+ * \file netns.c */
29
+
30
+#if defined(__linux__)
31
+
32
+#ifndef _GNU_SOURCE
33
+#define _GNU_SOURCE
34
+#endif
35
+
36
+#include <errno.h>
37
+#include <stdio.h>
38
+#include <stdlib.h>
39
+#include <unistd.h>
40
+#include <sched.h>
41
+#include <signal.h>
42
+#include <sys/types.h>
43
+#include <sys/stat.h>
44
+#include <sys/socket.h>
45
+#include <sys/mount.h>
46
+#include <sys/param.h>
47
+#include <fcntl.h>
48
+#include <errno.h>
49
+
50
+#include <osmocom/core/utils.h>
51
+#include <osmocom/core/netns.h>
52
+
53
+#define NETNS_PREFIX_PATH "/var/run/netns"
54
+#define NETNS_CURRENT_PATH "/proc/self/ns/net"
55
+
56
+/*! Open a file descriptor for the current network namespace.
57
+ * \returns fd of the current network namespace on success; negative in case of error
58
+ */
59
+static int netns_open_current_fd(void)
60
+{
61
+ int fd;
62
+ /* store the default namespace for later reference */
63
+ if ((fd = open(NETNS_CURRENT_PATH, O_RDONLY)) < 0)
64
+ return -errno;
65
+ return fd;
66
+}
67
+
68
+/*! switch to a (non-default) namespace, store existing signal mask in oldmask.
69
+ * \paramin nsfd file descriptor representing the namespace to which we shall switch
70
+ * \paramout state caller-provided memory location to which state of previous netns is stored
71
+ * \returns 0 on success; negative on error */
72
+int osmo_netns_switch_enter(int nsfd, struct osmo_netns_switch_state *state)
73
+{
74
+ sigset_t intmask;
75
+ int rc;
76
+
77
+ state->prev_nsfd = -1;
78
+
79
+ if (sigfillset(&intmask) < 0)
80
+ return -errno;
81
+ if ((rc = sigprocmask(SIG_BLOCK, &intmask, &state->prev_sigmask)) != 0)
82
+ return -rc;
83
+ state->prev_nsfd = netns_open_current_fd();
84
+
85
+ if (setns(nsfd, CLONE_NEWNET) < 0) {
86
+ /* restore old mask if we couldn't switch the netns */
87
+ sigprocmask(SIG_SETMASK, &state->prev_sigmask, NULL);
88
+ close(state->prev_nsfd);
89
+ state->prev_nsfd = -1;
90
+ return -errno;
91
+ }
92
+ return 0;
93
+}
94
+
95
+/*! switch back to the previous namespace, restoring signal mask.
96
+ * \paramin state information about previous netns, filled by osmo_netns_switch_enter()
97
+ * \returns 0 on successs; negative on error */
98
+int osmo_netns_switch_exit(struct osmo_netns_switch_state *state)
99
+{
100
+ if (state->prev_nsfd < 0)
101
+ return -EINVAL;
102
+
103
+ int rc;
104
+ if (setns(state->prev_nsfd, CLONE_NEWNET) < 0)
105
+ return -errno;
106
+
107
+ close(state->prev_nsfd);
108
+ state->prev_nsfd = -1;
109
+
110
+ if ((rc = sigprocmask(SIG_SETMASK, &state->prev_sigmask, NULL)) != 0)
111
+ return -rc;
112
+ return 0;
113
+}
114
+
115
+static int create_netns(const char *name)
116
+{
117
+ char pathMAXPATHLEN;
118
+ sigset_t intmask, oldmask;
119
+ int fd, prev_nsfd;
120
+ int rc, rc2;
121
+
122
+ /* create /var/run/netns, if it doesn't exist already */
123
+ rc = mkdir(NETNS_PREFIX_PATH, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
124
+ if (rc < 0 && errno != EEXIST)
125
+ return rc;
126
+
127
+ /* create /var/run/netns/name, if it doesn't exist already */
128
+ rc = snprintf(path, sizeof(path), "%s/%s", NETNS_PREFIX_PATH, name);
129
+ if (rc >= sizeof(path))
130
+ return -ENAMETOOLONG;
131
+ fd = open(path, O_RDONLY|O_CREAT|O_EXCL, 0);
132
+ if (fd < 0)
133
+ return -errno;
134
+ if (close(fd) < 0)
135
+ return -errno;
136
+
137
+ /* mask off all signals, store old signal mask */
138
+ if (sigfillset(&intmask) < 0)
139
+ return -errno;
140
+ if ((rc = sigprocmask(SIG_BLOCK, &intmask, &oldmask)) != 0)
141
+ return -rc;
142
+
143
+ prev_nsfd = netns_open_current_fd();
144
+ if (prev_nsfd < 0)
145
+ return prev_nsfd;
146
+
147
+ /* create a new network namespace */
148
+ if (unshare(CLONE_NEWNET) < 0) {
149
+ rc = -errno;
150
+ goto restore_sigmask;
151
+ }
152
+ if (mount(NETNS_CURRENT_PATH, path, "none", MS_BIND, NULL) < 0) {
153
+ rc = -errno;
154
+ goto restore_sigmask;
155
+ }
156
+
157
+ /* switch back to previous namespace */
158
+ if (setns(prev_nsfd, CLONE_NEWNET) < 0) {
159
+ rc = -errno;
160
+ goto restore_sigmask;
161
+ }
162
+
163
+restore_sigmask:
164
+ close(prev_nsfd);
165
+
166
+ /* restore process mask */
167
+ if ((rc2 = sigprocmask(SIG_SETMASK, &oldmask, NULL)) != 0)
168
+ return -rc2;
169
+
170
+ /* might have been set above in case mount fails */
171
+ if (rc < 0)
172
+ return rc;
173
+
174
+ /* finally, open the created namespace file descriptor from previous ns */
175
+ if ((fd = open(path, O_RDONLY)) < 0)
176
+ return -errno;
177
+
178
+ return fd;
179
+}
180
+
181
+/*! Open a file descriptor for the network namespace with provided name.
182
+ * Creates /var/run/netns/ directory if it doesn't exist already.
183
+ * \paramin name Name of the network namespace (in /var/run/netns/)
184
+ * \returns File descriptor of network namespace; negative in case of error
185
+ */
186
+int osmo_netns_open_fd(const char *name)
187
+{
188
+ int rc;
189
+ int fd;
190
+ char pathMAXPATHLEN;
191
+
192
+ /* path = /var/run/netns/name */
193
+ rc = snprintf(path, sizeof(path), "%s/%s", NETNS_PREFIX_PATH, name);
194
+ if (rc >= sizeof(path))
195
+ return -ENAMETOOLONG;
196
+
197
+ /* If netns already exists, simply open it: */
198
+ fd = open(path, O_RDONLY);
199
+ if (fd >= 0)
200
+ return fd;
201