diff options
author | Thomas Osterried <thomas@osterried.de> | 2005-10-30 10:31:40 +0000 |
---|---|---|
committer | Thomas Osterried <thomas@osterried.de> | 2005-10-30 10:31:40 +0000 |
commit | f3a4c67e9091c98596c19784040b88ad446a87cf (patch) | |
tree | d200e4c73346a29e72452a2a62e7263b8cdecbeb /ax25ipd/io.c | |
parent | 20a2c84a1c4488ae730bcb8c0ae52a12624c1848 (diff) |
- tun/tap support for ax25ipd
- fclose() fix in config.c
description of tun/tap:
added a new fast and efficient link to the linux kernel ax25 stack,
via the ethertap interface.
ax25 goes directly to the bpqether interface in the kernel via
ethertap/tuntap interfaces, which is a much better way than traditional
kissattach to a ttyp/ptyp pair.
Diffstat (limited to 'ax25ipd/io.c')
-rw-r--r-- | ax25ipd/io.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/ax25ipd/io.c b/ax25ipd/io.c index 9c59ac1..914255a 100644 --- a/ax25ipd/io.c +++ b/ax25ipd/io.c @@ -69,6 +69,8 @@ int fromlen; time_t last_bc_time; +int ttyfd_bpq = 0; + /* * I/O modes for the io_error routine */ @@ -187,7 +189,7 @@ void io_open() } } - ttyfd = open(ttydevice, O_RDWR, 0); + ttyfd = ((ttyfd_bpq = (strchr(ttydevice, '/') ? 0 : 1)) ? open_ethertap(ttydevice) : open(ttydevice, O_RDWR, 0)); if (ttyfd < 0) { perror("opening tty device"); exit(1); @@ -196,6 +198,10 @@ void io_open() perror("setting non-blocking I/O on tty device"); exit(1); } + if (ttyfd_bpq) { + set_bpq_dev_call_and_up(ttydevice); + goto behind_normal_tty; + } #ifdef USE_TERMIOS if (ioctl(ttyfd, TCGETS, &nterm) < 0) { #endif @@ -287,6 +293,8 @@ void io_open() if (digi) send_params(); +behind_normal_tty: + last_bc_time = 0; /* force immediate id */ } @@ -354,14 +362,24 @@ void io_start() { } while (io_error(n, buf, n, READ_MSG, TTY_MODE)); LOGL4("ttydata l=%d\n", n); - if (n > 0) - assemble_kiss(buf, n); + if (n > 0) { + if (!ttyfd_bpq) { + assemble_kiss(buf, n); + } else { + // no crc on bpqether. but a MAC header + if (receive_bpq(buf, n) < 0) { + goto out_ttyfd; + } + } + } + /* * If we are in "beacon after" mode, reset the "last_bc_time" each time * we hear something on the channel. */ if (!bc_every) last_bc_time = time(NULL); +out_ttyfd: } if (udp_mode) { |