summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso2011-07-07 19:19:46 +0200
committerPablo Neira Ayuso2011-07-07 19:19:46 +0200
commiteb43413013d75c21db121e5ad40c587ca6c1f453 (patch)
treebc1b5a510383f909ef2257f3075ad19fadad8ac5
parentipaccess: release virtual E1 line for closed connection (diff)
downloadlibosmo-abis-eb43413013d75c21db121e5ad40c587ca6c1f453.tar.gz
libosmo-abis-eb43413013d75c21db121e5ad40c587ca6c1f453.tar.xz
libosmo-abis-eb43413013d75c21db121e5ad40c587ca6c1f453.zip
ipaccess: skip further processing for ping, pong and id_req messages
-rw-r--r--src/input/ipaccess.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 5ecd2e6..3f4008b 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <errno.h>
#include <string.h>
#include <time.h>
@@ -186,25 +187,28 @@ int ipaccess_send_id_req(int fd)
}
/* base handling of the ip.access protocol */
-int ipaccess_rcvmsg_base(struct msgb *msg,
- struct osmo_fd *bfd)
+static bool ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
{
+ bool ipa_ccm = false;
uint8_t msg_type = *(msg->l2h);
int ret = 0;
switch (msg_type) {
case IPAC_MSGT_PING:
+ ipa_ccm = true;
ret = ipaccess_send_pong(bfd->fd);
break;
case IPAC_MSGT_PONG:
DEBUGP(DMI, "PONG!\n");
+ ipa_ccm = true;
break;
case IPAC_MSGT_ID_ACK:
DEBUGP(DMI, "ID_ACK? -> ACK!\n");
+ ipa_ccm = true;
ret = ipaccess_send_id_ack(bfd->fd);
break;
}
- return 0;
+ return ipa_ccm;
}
/* base handling of the ip.access protocol */
@@ -257,8 +261,9 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg,
char *unitid;
int len, ret;
- /* handle base messages */
- ipaccess_rcvmsg_base(msg, bfd);
+ /* Handle IPA PING, PONG and ID_ACK messages. */
+ if (ipaccess_rcvmsg_base(msg, bfd))
+ return 0;
switch (msg_type) {
case IPAC_MSGT_ID_RESP: