aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-09-07 19:54:49 +0200
committerHarald Welte <laforge@gnumonks.org>2015-09-07 22:25:35 +0200
commit5c11c9463779abb960f47c656dae533eab9f1abf (patch)
tree89ca08e6b9d09f8d756322fa98fca7d3860bc0c3 /src
parent08a793be9fbaf63c4df50b641c52dd4fcdc91844 (diff)
hnbgw: Fix SCTP server/receiver
* we need to swap PPID endianness * we need to explicitly subscrie to the event(s) for sctp_sndrcvinfo
Diffstat (limited to 'src')
-rw-r--r--src/hnbgw.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hnbgw.c b/src/hnbgw.c
index f24facc..5e033fa 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -52,6 +52,8 @@ static int hnb_socket_cb(struct osmo_fd *fd, unsigned int what)
} else
msgb_put(msg, rc);
+ sinfo.sinfo_ppid = ntohl(sinfo.sinfo_ppid);
+
switch (sinfo.sinfo_ppid) {
case IUH_PPI_HNBAP:
rc = hnbgw_hnbap_rx(hnb, msg);
@@ -128,6 +130,19 @@ static struct vty_app_info vty_info = {
static int daemonize = 0;
+static int sctp_sock_init(int fd)
+{
+ struct sctp_event_subscribe event;
+ int rc;
+
+ /* subscribe for all events */
+ memset((uint8_t *)&event, 1, sizeof(event));
+ rc = setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS,
+ &event, sizeof(event));
+
+ return rc;
+}
+
int main(int argc, char **argv)
{
int rc;
@@ -159,6 +174,7 @@ int main(int argc, char **argv)
perror("Error binding Iuh port");
exit(1);
}
+ sctp_sock_init(g_hnb_gw.listen_fd.fd);
if (daemonize) {
rc = osmo_daemonize();