aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/netif/ipa.h2
-rw-r--r--src/channel/abis_ipa_client.c10
-rw-r--r--src/channel/abis_ipa_server.c4
-rw-r--r--src/ipa.c16
4 files changed, 23 insertions, 9 deletions
diff --git a/include/osmocom/netif/ipa.h b/include/osmocom/netif/ipa.h
index 152ea24..5c815cd 100644
--- a/include/osmocom/netif/ipa.h
+++ b/include/osmocom/netif/ipa.h
@@ -65,7 +65,7 @@ struct ipaccess_unit {
struct osmo_fd;
struct tlv_parsed;
-int osmo_ipa_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
+int osmo_ipa_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd, int server);
int osmo_ipa_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
int osmo_ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
diff --git a/src/channel/abis_ipa_client.c b/src/channel/abis_ipa_client.c
index 9c3554d..079ad35 100644
--- a/src/channel/abis_ipa_client.c
+++ b/src/channel/abis_ipa_client.c
@@ -154,6 +154,14 @@ void osmo_abis_ipa_cli_set_rsl_port(struct osmo_chan *c, uint16_t port)
osmo_stream_cli_set_port(s->rsl, port);
}
+void osmo_abis_ipa_cli_set_unit(struct osmo_chan *c, struct ipaccess_unit *unit)
+{
+ struct chan_abis_ipa_cli *s = (struct chan_abis_ipa_cli *)&c->data;
+
+ osmo_ipa_unit_free(s->unit);
+ s->unit = unit;
+}
+
void osmo_abis_ipa_cli_set_cb_signalmsg(struct osmo_chan *c,
void (*signal_msg)(struct msgb *msg, int type))
{
@@ -257,7 +265,7 @@ abis_ipa_cli_rcvmsg(struct osmo_chan *c, struct osmo_stream_cli *conn,
int ret;
/* Handle IPA PING, PONG and ID_ACK messages. */
- if (osmo_ipa_rcvmsg_base(msg, ofd))
+ if (osmo_ipa_rcvmsg_base(msg, ofd, 0)) /* XXX: 0 indicates client */
return 0;
if (msg_type == IPAC_MSGT_ID_GET) {
diff --git a/src/channel/abis_ipa_server.c b/src/channel/abis_ipa_server.c
index b971b50..e4fac1c 100644
--- a/src/channel/abis_ipa_server.c
+++ b/src/channel/abis_ipa_server.c
@@ -346,8 +346,8 @@ abis_ipa_srv_rcvmsg(struct osmo_chan *c,
char *unitid;
int len, ret;
- /* Handle IPA PING, PONG and ID_ACK messages. */
- if (osmo_ipa_rcvmsg_base(msg, ofd))
+ /* Handle IPA PING, PONG and ID_ACK messages */
+ if (osmo_ipa_rcvmsg_base(msg, ofd, 1)) /* XXX: 1 indicates server */
return 0;
if (msg_type == IPAC_MSGT_ID_RESP) {
diff --git a/src/ipa.c b/src/ipa.c
index a4c3a5f..955ae84 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -216,7 +216,7 @@ int ipaccess_send_id_req(int fd)
}
/* base handling of the ip.access protocol */
-int osmo_ipa_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
+int osmo_ipa_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd, int server)
{
int ipa_ccm = 0;
uint8_t msg_type = *(msg->l2h);
@@ -224,17 +224,23 @@ int osmo_ipa_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
switch (msg_type) {
case IPAC_MSGT_PING:
+ LOGP(DLINP, LOGL_DEBUG, "PING!\n");
ipa_ccm = 1;
ret = ipaccess_send_pong(bfd->fd);
break;
case IPAC_MSGT_PONG:
- DEBUGP(DLMI, "PONG!\n");
+ LOGP(DLINP, LOGL_DEBUG, "PONG!\n");
ipa_ccm = 1;
break;
case IPAC_MSGT_ID_ACK:
- DEBUGP(DLMI, "ID_ACK? -> ACK!\n");
- ipa_ccm = 1;
- ret = ipaccess_send_id_ack(bfd->fd);
+ if (server) {
+ LOGP(DLINP, LOGL_DEBUG, "ID_ACK? -> ACK!\n");
+ ipa_ccm = 1;
+ ret = ipaccess_send_id_ack(bfd->fd);
+ } else {
+ LOGP(DLINP, LOGL_DEBUG, "ID_ACK! OK!\n");
+ ipa_ccm = 1;
+ }
break;
}
return ipa_ccm;