summaryrefslogtreecommitdiffstats
path: root/listen/listen.c
Commit message (Collapse)AuthorAgeFilesLines
* listen: Remove unnecessary including of <netinet/in.h>Ralf Baechle2017-08-031-1/+0
| | | | | | Broken out from a patch by Wietse Ruyg <pe1oez@dds.nl>. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Listen: Remove useless postincrement op.Ralf Baechle2017-08-031-1/+1
| | | | | | | GCC would have done that itself but now the code is slightly less eyesore. Broken out from a patch by Wietse Ruyg <pe1oez@dds.nl>. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* treewide: Kill assignments in if conditions.Ralf Baechle2017-08-031-6/+8
| | | | | | | | | | | | | | | | | | | Somewhat hard to read and the code base already has many overlong lines Found with below spatch files: @parens@ expression E, F, G; binary operator X; statement S; @@ - if ((E = F) X G) + E = F; + if (E X G) S Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Listen: Remove useless parens around argument of return statement.Ralf Baechle2017-07-281-1/+1
| | | | | | | | | | | | | | | Found by below coccinelle script. @parens@ expression E; @@ return - ( E - ) ; Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* listen: Remove all uses of register keyword.Ralf Baechle2017-07-281-4/+4
| | | | | | Compilers are ignoring it for over a quarter century. Time to catch up! Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* listen: Fix overzealous GCC 7 compiler warnings.Ralf Baechle2017-07-261-6/+26
| | | | | | | | | | | | | | | | | | | | | | | make[2]: Entering directory '/home/ralf/src/ax25/ax25-apps/listen' gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -MT listen.o -MD -MP -MF .deps/listen.Tpo -c -o listen.o listen.c listen.c: In function ‘ts_format’: listen.c:53:58: warning: ‘%06u’ directive output may be truncated writing between 6 and 10 bytes into a region of size between 0 and 7 [-Wformat-truncation=] (void)snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", ^~~~ listen.c:53:42: note: using the range [0, 4294967295] for directive argument (void)snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", ^~~~~~~~~~~~~~~~~~~~~ listen.c:53:9: note: ‘snprintf’ output between 16 and 27 bytes into a destination of size 16 (void)snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sec / 3600, (sec % 3600) / 60, sec % 60, usec); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The value of the variables is such that there is no overflow possible but GCC is not able to figure this out. Change the code such that GCC can figure out the value range thus getting us rid of the variables. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Compress multiple blank lines into single lines.Ralf Baechle2017-07-251-1/+0
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* listen: Remove code controlled by NEW_AX25_STACK.Ralf Baechle2017-07-251-8/+0
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Sort out variable and function declarations.Ralf Baechle2017-01-311-8/+6
| | | | | | | | | | - Make static what can be made static. - Add declaration where they were missing. - Don't define variables in headers. - Move declaations to the proper locations. - Pick up declarations from the proper headers. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Improved timestamps. With code and -t -tt -ttt ... option behaviour from ↵Thomas Osterried2016-07-041-11/+135
| | | | | | | | tcpdump. -> Without -t, listen now shows a timestamp. Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
* listen -a shows on segmented packets ok, but shows also the defragmented,Thomas Osterried2016-03-121-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | packet, but garbled: bpq2: fm DL9SAU to DL9SAU-15 ctl I00+ pid=8(segment) len 4 remain 0 0000 E2 E3 E4 | ... Reason: the defragmented packet is passed to netif_rx(skb). It has skb->protocol = htons(ETH_P_IP), but still belongs to ifr.ifr_hwaddr.sa_family == AF_AX25. listen -a looks for every iface with like ifr.ifr_hwaddr.sa_family == AF_AX25 and thus gets the desegmented packet. This desegmented packet has already lost his ax25 header information (it's the IP datagram that netif_rx sees), prefixed by AX25_P_IP = 0xcc: strace: recvfrom(3, "\0\210\230r\246\202\252\340\210\230r\246\202\252\177\314\10\201\314E\0\1\1\0\32\0\0?\1!\327,\200\200\n,\200\200\1\0\0\347\300\21\6\0\1\26\23\303V.. recvfrom(3, "\314E\0\1\1\0\32\0\0?\1!\327,\200\200\n,\200\200\1\0\0\347\300\21\6\0\1\26\23\303V.. \314 == 0xcc == AX25_P_IP We can make safely make the assumption for first byte == 0xcc and length > 2, that we safeley can detect those IP frames, and then ignore it. Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
* listen: Fix signedness compiler warnings.Ralf Baechle2015-06-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | make[2]: Entering directory '/home/ralf/src/ax25/ax25-apps/listen' gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -MT listen.o -MD -MP -MF .deps/listen.Tpo -c -o listen.o listen.c listen.c: In function ‘ascii_dump’: listen.c:231:4: warning: pointer targets in passing argument 2 of ‘__builtin_strncat’ differ in signedness [-Wpointer-sign] strncat(buf, &c, 1); ^ listen.c:231:4: note: expected ‘const char *’ but argument is of type ‘unsigned char *’ listen.c: In function ‘hex_dump’: listen.c:282:8: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] data2 = data; ^ [...] gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -MT rosedump.o -MD -MP -MF .deps/rosedump.Tpo -c -o rosedump.o rosedump.c rosedump.c: In function ‘facility’: rosedump.c:331:9: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] factot = data; ^ rosedump.c:398:11: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] for (d = data, l = 0; l < lgaddcall; ^ rosedump.c:406:28: warning: pointer targets in passing argument 1 of ‘dump_ax25_call’ differ in signedness [-Wpointer-sign] dump_ax25_call(d, 7)); ^ rosedump.c:296:14: note: expected ‘unsigned char *’ but argument is of type ‘char *’ static char *dump_ax25_call(unsigned char *data, int l_data) ^ rosedump.c:410:28: warning: pointer targets in passing argument 1 of ‘dump_ax25_call’ differ in signedness [-Wpointer-sign] dump_ax25_call(d, 7)); ^ rosedump.c:296:14: note: expected ‘unsigned char *’ but argument is of type ‘char *’ static char *dump_ax25_call(unsigned char *data, int l_data) ^ rosedump.c:438:4: warning: pointer targets in passing argument 2 of ‘__builtin_strncpy’ differ in signedness [-Wpointer-sign] strncpy(indorig, data, lgadind); ^ rosedump.c:438:4: note: expected ‘const char *’ but argument is of type ‘unsigned char *’ rosedump.c:441:4: warning: pointer targets in passing argument 2 of ‘__builtin_strncpy’ differ in signedness [-Wpointer-sign] strncpy(inddest, data, lgadind); ^ rosedump.c:441:4: note: expected ‘const char *’ but argument is of type ‘unsigned char *’ rosedump.c:451:14: warning: pointer targets in passing argument 1 of ‘data_dump’ differ in signedness [-Wpointer-sign] data_dump(factot, lgtot, 1); ^ In file included from rosedump.c:11:0: listen.h:31:6: note: expected ‘unsigned char *’ but argument is of type ‘char *’ void data_dump(unsigned char *, int, int); ^ [...] gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c utils.c: In function ‘lprintf’: utils.c:49:10: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] for (p = str; *p != '\0'; p++) { ^ utils.c:71:10: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] for (p = str; *p != '\0'; p++) ^ [...] make[2]: Leaving directory '/home/ralf/src/ax25/ax25-apps/listen' Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Remove parenthesis around arguments of return statements.Ralf Baechle2015-05-021-2/+2
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Nuke trailing whitespace.Ralf Baechle2015-05-021-1/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* The last patch introduced cosmetic errors likeThomas Osterried2010-06-051-16/+28
| | | | | | | | | | | | GIFADDR: Bad file descriptor after signling termination with ^C In detail: close(3) = 0 sigreturn() = ? (mask now []) ioctl(3, SIOCGIFHWADDR, {ifr_name="eth0", ???}) = -1 EBADF (Bad file descriptor) -> The interrupt handler introduced concurrency issues ;) The patch caused only unexpected behaviour; no security problems. This new patch fixes this problem.
* Don't abort on SIGWINCH. Cleanly terminate on SIGINT and SIGTERM.Ralf Baechle2010-05-301-4/+34
| | | | Patch from Michael Stuermer <ms@mallorn.de> with a few touchups be me.
* Remove use of backwards compatibility header name.Ralf Baechle2009-06-211-4/+0
| | | | | | Glibc as old as 2.2 provides working headers under the right name and if not libax25 would install headers under the right name so this has become redundant and ugly.
* Fix type of length argument to sockset syscalls.Ralf Baechle2009-06-141-1/+1
| | | | | | | | Various socket syscalls receive a length argument that should be a socklen_t rsp. a ptr to a socklen_t but instead int rsp. ptr to int were being passed. While in theory this was a bug it's harmless as dangerously large values would not be used but the issue manifested itself in a significant number of compilation warnings.
* Fix warnings about // style comment. And remove some of the mostRalf Baechle2007-01-231-2/+2
| | | | pointless comments.
* used PF_PACKET for SOCK_PACKET sockets, added time.h to axspawn.cMichael Taylor2002-11-031-1/+1
|
* updated libtool, uniformly indented source, corrected small ax25mond ↵Terry Dawson VK2KTJ2001-09-121-82/+89
| | | | Makefile bug
* Initial revisionax25-apps-0.0.5p2Craig Small2001-04-101-5/+9
|
* Import ax25-apps 0.0.3 from tarballax25-apps-0.0.3Ralf Baechle1999-08-101-16/+25
|
* Import ax25-apps 0.0.2 from tarballax25-apps-0.0.2Ralf Baechle1999-07-081-1/+1
|
* Import ax25-apps 0.0.1 from tarballax25-apps-0.0.1Ralf Baechle1999-06-071-0/+293