Commit 7a6709a2 authored by Cedric Roux's avatar Cedric Roux

warning removal/bug fixes/adding logs in rb_tool.c

parent 676ca5c3
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/ioctl.h>
#include <ctype.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
...@@ -109,7 +110,7 @@ void IAL_NAS_ioctl_init(int inst) ...@@ -109,7 +110,7 @@ void IAL_NAS_ioctl_init(int inst)
{ {
struct nas_msg_statistic_reply *msgrep; struct nas_msg_statistic_reply *msgrep;
int err,rc; int err;
sprintf(gifr.name, "oai%d",inst); sprintf(gifr.name, "oai%d",inst);
...@@ -132,7 +133,6 @@ void IAL_NAS_ioctl_init(int inst) ...@@ -132,7 +133,6 @@ void IAL_NAS_ioctl_init(int inst)
if (err<0) { if (err<0) {
printf("IOCTL error, err=%d\n",err); printf("IOCTL error, err=%d\n",err);
rc = -1;
} }
printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets); printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
...@@ -151,16 +151,10 @@ void IAL_NAS_ioctl_init(int inst) ...@@ -151,16 +151,10 @@ void IAL_NAS_ioctl_init(int inst)
int main(int argc,char **argv) int main(int argc,char **argv)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
{ {
int done = 0, rc = 0, meas_polling_counter = 0;
fd_set readfds;
struct timeval tv;
int i = 0;
int err = 0; int err = 0;
char * buffer;
int c = 0; int c = 0;
int action=0,rbset=0,cxset=0,instset=0,saddr_ipv4set=0,saddr_ipv6set=0,daddr_ipv4set=0,daddr_ipv6set=0,dscpset=0,mpls_outlabelset=0,mpls_inlabelset=0; int action=0,rbset=0,cxset=0,instset=0,saddr_ipv4set=0,saddr_ipv6set=0,daddr_ipv4set=0,daddr_ipv6set=0,dscpset=0,mpls_outlabelset=0,mpls_inlabelset=0;
char rb[100],cx[100],dscp[100],inst[100],mpls_outgoinglabel[100],mpls_incominglabel[100]; char rb[100],cx[100],dscp[100],inst[100],mpls_outgoinglabel[100],mpls_incominglabel[100];
int index = 0;
struct nas_msg_rb_establishment_request *msgreq = NULL; struct nas_msg_rb_establishment_request *msgreq = NULL;
struct nas_msg_class_add_request *msgreq_class = NULL; struct nas_msg_class_add_request *msgreq_class = NULL;
in_addr_t saddr_ipv4,daddr_ipv4; in_addr_t saddr_ipv4,daddr_ipv4;
...@@ -213,15 +207,21 @@ int main(int argc,char **argv) ...@@ -213,15 +207,21 @@ int main(int argc,char **argv)
mpls_inlabelset=1; mpls_inlabelset=1;
break; break;
case 's': case 's': {
inet_aton(optarg,&saddr_ipv4); struct in_addr a;
inet_aton(optarg,&a);
saddr_ipv4 = a.s_addr;
saddr_ipv4set = 1; saddr_ipv4set = 1;
break; break;
}
case 't': case 't': {
inet_aton(optarg,&daddr_ipv4); struct in_addr a;
inet_aton(optarg,&a);
daddr_ipv4 = a.s_addr;
daddr_ipv4set = 1; daddr_ipv4set = 1;
break; break;
}
case 'x': case 'x':
printf("IPv6: %s\n",optarg); printf("IPv6: %s\n",optarg);
...@@ -303,7 +303,7 @@ int main(int argc,char **argv) ...@@ -303,7 +303,7 @@ int main(int argc,char **argv)
if (action == ADD_RB) { if (action == ADD_RB) {
gifr.type = NAS_MSG_RB_ESTABLISHMENT_REQUEST; gifr.type = NAS_MSG_RB_ESTABLISHMENT_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
if (saddr_ipv4set == 1) { if (saddr_ipv4set == 1) {
...@@ -329,6 +329,7 @@ int main(int argc,char **argv) ...@@ -329,6 +329,7 @@ int main(int argc,char **argv)
gifr.type = NAS_MSG_CLASS_ADD_REQUEST; gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
msgreq_class->rab_id = atoi(rb); msgreq_class->rab_id = atoi(rb);
msgreq_class->lcr = atoi(cx); msgreq_class->lcr = atoi(cx);
...@@ -340,6 +341,7 @@ int main(int argc,char **argv) ...@@ -340,6 +341,7 @@ int main(int argc,char **argv)
msgreq_class->saddr.ipv4 = daddr_ipv4; msgreq_class->saddr.ipv4 = daddr_ipv4;
gifr.type = NAS_MSG_CLASS_ADD_REQUEST; gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
} }
if (saddr_ipv6set == 1) { if (saddr_ipv6set == 1) {
...@@ -370,6 +372,7 @@ int main(int argc,char **argv) ...@@ -370,6 +372,7 @@ int main(int argc,char **argv)
gifr.type = NAS_MSG_CLASS_ADD_REQUEST; gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
msgreq_class->rab_id = atoi(rb); msgreq_class->rab_id = atoi(rb);
msgreq_class->lcr = atoi(cx); msgreq_class->lcr = atoi(cx);
...@@ -380,6 +383,7 @@ int main(int argc,char **argv) ...@@ -380,6 +383,7 @@ int main(int argc,char **argv)
memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16); memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
gifr.type = NAS_MSG_CLASS_ADD_REQUEST; gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
} }
...@@ -411,6 +415,7 @@ int main(int argc,char **argv) ...@@ -411,6 +415,7 @@ int main(int argc,char **argv)
gifr.type = NAS_MSG_CLASS_ADD_REQUEST; gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
msgreq_class->rab_id = atoi(rb); msgreq_class->rab_id = atoi(rb);
msgreq_class->lcr = atoi(cx); msgreq_class->lcr = atoi(cx);
...@@ -430,12 +435,14 @@ int main(int argc,char **argv) ...@@ -430,12 +435,14 @@ int main(int argc,char **argv)
gifr.type = NAS_MSG_CLASS_ADD_REQUEST; gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
} }
} else if (action == DEL_RB) { } else if (action == DEL_RB) {
gifr.type = NAS_MSG_RB_RELEASE_REQUEST; gifr.type = NAS_MSG_RB_RELEASE_REQUEST;
err=ioctl(fd, NAS_IOCTL_RRM, &gifr); err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
if (err == -1) perror("ioctl");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment