adding tcpdump/OAM support to usb ATM devices
Subsystems (2)
who cares about ATM? Well anyone using ADSL/2/2+ high speed internet access is stuck with it, and that's not a small number of people.
Diagnosing problems is often complicated by the fact that large backhaul networks appear as only 1 IP hop in traceroute.
The goal is to support sending and receiving F5 OAM cells on a Linux host, from in-use PVCs bound to a br2684 bridge, your typical USB ADSL modem. The ATM OAM segment "ping" can be useful in troubleshooting, yet few modems support it, and *none* return timing and other detailed information.
The modems running embedded Linux internally (openwrt AR7 for example) could also use this.
The question: what is the recommended way to push the captured cells to userspace? raw ATM socket, netlink, packet socket, i'm not up to speed here people!
in 2.6.22 drivers/usb/atm/usbatm.c::usbatm_extract_one_cell()
cells received for open PVC/SVC sockets are processed, however OAM cells are dropped, and cells to unbound VPI/VCI are dropped.
This seems the likely place to route cells somewhere useful, but what mechanism to use?
Signature · 5 lines
Jeremy Jackson Coplanar Networks (519)489-4903 http://www.coplanar.net [email protected]
David Miller
maintainerFrom: Jeremy Jackson <[email protected]>
Date: Sun, 27 Apr 2008 17:31:53 -0400
Quoted 5 lines
The question: what is the recommended way to push the captured cells to userspace? raw ATM socket, netlink, packet socket, i'm not up to speed here people!
in 2.6.22 drivers/usb/atm/usbatm.c::usbatm_extract_one_cell()
It depends upon what you want to do with this.
Maybe it makes sense, if what you're trying to do is expose the signalling layer of the packet to diagnostic tools, is have an option in the driver such that the entire ATM header area will be presented to the AF_PACKET socket when tapping the network.
Could that work?
Adding special mechanisms to get at the packet data is going to make it more difficult to use this stuff, and kind of defeat your purpose. So anything that's automatically working with tcpdump and will "just work" is preferred.
Quoted 16 lines · David Miller
From: Jeremy Jackson <[email protected]>
Date: Sun, 27 Apr 2008 17:31:53 -0400Quoted 5 lines
The question: what is the recommended way to push the captured cells to userspace? raw ATM socket, netlink, packet socket, i'm not up to speed here people!
in 2.6.22 drivers/usb/atm/usbatm.c::usbatm_extract_one_cell()
It depends upon what you want to do with this.
Maybe it makes sense, if what you're trying to do is expose the signalling layer of the packet to diagnostic tools, is have an option in the driver such that the entire ATM header area will be presented to the
AF_PACKETsocket when tapping the network.
Quoted 6 lines
Could that work?
Adding special mechanisms to get at the packet data is going to make it more difficult to use this stuff, and kind of defeat your purpose. So anything that's automatically working with tcpdump and will "just work" is preferred.
Backgroud: OAM cells are like the ICMP of ATM networking, they are separate from payload cells, not part of the headers. They do share the VPI/VCI of the data circuit, but have a different cell Packet Type Indication (PTI)
With br2684, it exposes an ethernet-like device. Tcpdump can work on that no problem, and perhaps it could expose the headers of the first/last cell of each "frame", but I don't see how the OAM cells would fit into capturing packets that way.
Or can an AF_PACKET socket be made that retrieved raw ATM cells (AAL0 style) regardless of the upper layer (br2684)?
Sadly, my goal isn't an overhaul of the ATM stack, but a minimal-distance hack with some good advice thrown in. The typical tcpdump would grab all cells, or perhaps unclaimed ones unless in promisc mode, but I'm happy with just partial capture of certain out of band cells for now.
Maybe the code in usbatm_extract_one_cell() that drops cells, would check for an ATM packet socket first, and dump the cells in there, otherwise drop them.
Signature · 5 lines
Jeremy Jackson Coplanar Networks (519)489-4903 http://www.coplanar.net [email protected]
Quoted 2 lines · In message <1209331913.8768.214.camel@ragnarok>,Jeremy Jackson writes:
who cares about ATM? Well anyone using ADSL/2/2+ high speed internet access is stuck with it, and that's not a small number of people.
i still care.
Quoted 3 lines
The question: what is the recommended way to push the captured cells to userspace? raw ATM socket, netlink, packet socket, i'm not up to speed here people!
the right way is netlink. i have some patches to add more complete oam support but they use the current ioctl interface which should be considered deprecated. so adding new functionality using this interface to the kernel, would likely be rejected.
eventually, all the atm clients (zeppelin, atmsigd, et al) should be converted to using netlink.
Quoted 7 lines
in 2.6.22 drivers/usb/atm/usbatm.c::usbatm_extract_one_cell()
cells received for open PVC/SVC sockets are processed, however OAM cells are dropped, and cells to unbound VPI/VCI are dropped.
This seems the likely place to route cells somewhere useful, but what mechanism to use?
i guess now might be the time to try to define a netlink interface between the userspace and the kernel.
Quoted 5 lines · Chas Williams (CONTRACTOR)
Quoted 2 lines · In message <1209331913.8768.214.camel@ragnarok>,Jeremy Jackson writes:
who cares about ATM? Well anyone using ADSL/2/2+ high speed internet access is stuck with it, and that's not a small number of people.
i still care.
good to hear! I'd love to label ATM as legacy and forget it... but we're stuck with ATM on ADSL (VDSL has packet mode with HDLC-like framing) since no hardware vendor has implemented the packet mode for ADSL2/2+ even though it's part of the spec.
Quoted 8 lines
Quoted 3 lines
The question: what is the recommended way to push the captured cells to userspace? raw ATM socket, netlink, packet socket, i'm not up to speed here people!
the right way is netlink. i have some patches to add more complete oam support but they use the current ioctl interface which should be considered deprecated. so adding new functionality using this interface to the kernel, would likely be rejected.
Can you send me some patches? It would be good for discussion and experimentation.
Quoted 5 lines
eventually, all the atm clients (zeppelin, atmsigd, et al) should be converted to using netlink.
Quoted 2 lines
in 2.6.22 drivers/usb/atm/usbatm.c::usbatm_extract_one_cell()
Quoted 8 lines
Quoted 5 lines
cells received for open PVC/SVC sockets are processed, however OAM cells are dropped, and cells to unbound VPI/VCI are dropped.
This seems the likely place to route cells somewhere useful, but what mechanism to use?
i guess now might be the time to try to define a netlink interface between the userspace and the kernel.
I think there are 2 cases, packet socket support for ATM, for libpcap/tcpdump etc, and control functions (presently ioctl) switched to use netlink. Generating OAM cells might belong to a control function on netlink, but I wonder about PF_RAWATM, the present setup with pcv/svc sockets is a bit wierd, you set the qos type to AAL0 to mean raw. Perhaps there should be a PF_RAWATM instead.
Signature · 5 lines
Jeremy Jackson Coplanar Networks (519)489-4903 http://www.coplanar.net [email protected]
Quoted 4 lines · In message <1209398082.8768.257.camel@ragnarok>,Jeremy Jackson writes:
good to hear! I'd love to label ATM as legacy and forget it... but we're stuck with ATM on ADSL (VDSL has packet mode with HDLC-like framing) since no hardware vendor has implemented the packet mode for ADSL2/2+ even though it's part of the spec.
simply because of dsl and your local phone company, i suspect atm will remain around for a few more years yet. i also belive that verizon's fios has atm in it somewhere.
Quoted 2 lines
Can you send me some patches? It would be good for discussion and experimentation.
attached is the kernel side of the atm oamd. the userspace side is in the linux-atm sourceforge repository. i had some example netlink code, but i cant find it.
Quoted 6 lines
I think there are 2 cases, packet socket support for ATM, for libpcap/tcpdump etc, and control functions (presently ioctl) switched to use netlink. Generating OAM cells might belong to a control function on netlink, but I wonder about
PF_RAWATM, the present setup with pcv/svc sockets is a bit wierd, you set the qos type to AAL0 to mean raw. Perhaps there should be aPF_RAWATMinstead.
packet socket support for tcpdump might be troublesome. in aal5, the atm headers are added/subtracted by the adapters themselves. additionally, there isnt a single queue for all the incoming/outgoing atm traffic (although this isnt a huge challenge).
the present setup with pvc/svc and a single atm socket family type somewhat matches the atm socket api. adding a raw type might make is easier to figure out which could be sent to tcpdump as 'raw atm' data.
however, with a properly functioning oamd you should need to tcpdump the link. if you use netlink, you should be able to snoop the oam traffic from userspace, and write your own oam ping type utility.
src/oamd/atmoamd.c renamed from linux-atm-2.5/src/oamd/atmoamd.c +37 -5
@@ -1,3 +1,12 @@ +/* +* atmoamd.c OAM daemon +* +* Written 2003-2004 by Jorge Boncompte ([email protected]), DTI2 +* +* Code based on the atmarpd daemon by Werner Almerberger +* +*/ +#if HAVE_CONFIG_H #include <config.h> #endif
@@ -10,6 +19,7 @@#include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> +#include <sys/wait.h> #include <signal.h> #include <atm.h>
@@ -22,7 +32,7 @@static void usage (const char *name) { -fprintf (stderr,"usage: %s [-b] [-d]\n" , name); +fprintf (stderr,"usage: %s [-b] [-d] [-i [itf.]vpi.vci]\n" , name);fprintf (stderr,"%6s %s -V\n" ,"" , name);exit (1 ); }
@@ -36,17 +46,28 @@signal (SIGALRM , sig_handler);alarm (1 ); } +if (signo ==SIGCHLD ) { +signal (SIGCHLD , sig_handler); +while (waitpid (-1 ,NULL ,WNOHANG ) >0 ) + { + } + } }int main (int argc,char **argv) { +struct sockaddr_atmpvc addr;int c, background =0 ;set_application ("atmoamd" );set_verbosity (NULL ,DIAG_INFO ); -while ((c =getopt (argc,argv,"bdV" )) !=EOF ) + addr.sap_addr.itf =0 ; + addr.sap_addr.vpi =8 ; + addr.sap_addr.vci =32 ; + +while ((c =getopt (argc,argv,"bdi:V" )) !=EOF )switch (c) {case 'b' : background =1 ;
@@ -55,13 +76,21 @@set_verbosity (NULL ,DIAG_DEBUG ); debug =1 ;break ; +case 'i' : +memset (&addr,0 ,sizeof (addr)); +if (text2atm (optarg,(struct sockaddr *) &addr,sizeof (addr), +T2A_PVC |T2A_UNSPEC |T2A_WILDCARD ) <0 )usage (argv[0 ]); +break ;case 'V' :printf ("%s\n" ,VERSION );return 0 ;default :usage (argv[0 ]); } -if (argc != optind)usage (argv[0 ]); + +if (argc != optind) +usage (argv[0 ]); +diag (COMPONENT ,DIAG_INFO ,"Linux ATM OAM, version " VERSION );open_kernel ();
@@ -73,15 +102,18 @@ pid =fork ();if (pid <0 )diag (COMPONENT ,DIAG_FATAL ,"fork: %s" ,strerror (errno));if (pid) { -diag (COMPONENT ,DIAG_DEBUG ,"Backgrounding (PID %d)" ,pid); +diag (COMPONENT ,DIAG_DEBUG ,"Backgrounding (PID %d)" , pid);exit (0 ); } }signal (SIGALRM , sig_handler); +signal (SIGCHLD , sig_handler);alarm (1 ); -poll_loop (); +diag (COMPONENT ,DIAG_INFO ,"Started for Itf %d VPI/VCI %d/%d" , + addr.sap_addr.itf, addr.sap_addr.vpi, addr.sap_addr.vci); +poll_loop (&addr);close_kernel ();
src/oamd/crc10.c renamed from linux-atm-2.5/src/oamd/crc10.c +9 -0
@@ -1,3 +1,12 @@ +/* +* crc10.c CRC10 calculation routines +* +* Written 2003-2004 by Jorge Boncompte ([email protected]), DTI2 +* +* The CRC10 table and sum routine are from the f4loopbackd.c source +* from Alex Zeffertt. +*/ +#include <atm.h> #include "crc10.h"
src/oamd/crc10.h renamed from linux-atm-2.5/src/oamd/crc10.h +2 -1
@@ -1,9 +1,10 @@/* * crc10.h CRC10 * -* Written 2003 by Jorge Boncompte, DTI2 +* Written 2003-2004 by Jorge Boncompte ([email protected]), DTI2 * * The CRC10 table and sum routine are from the f4loopbackd.c source +* from Alex Zeffertt. */ #ifndef CRC10_H
src/oamd/io.c renamed from linux-atm-2.5/src/oamd/io.c +14 -8
@@ -1,6 +1,11 @@ -/* io.c - I/O operations */ - -/* Written 1995-2000 by Werner Almesberger, EPFL-LRC/ICA */ +/* +* io.c I/O operations +* +* Written 2003-2004 by Jorge Boncompte ([email protected]), DTI2 +* +* Code based on the atmarpd daemon by Werner Almesberger +* +*/ #if HAVE_CONFIG_H #include <config.h>
@@ -72,9 +77,10 @@ }diag (COMPONENT ,DIAG_DEBUG , -"OAM %s Cell received on Intf %d VPI/VCI %d/%d (Vcc %p)" , +"OAM %s(%d) Cell received on Intf %d VPI/VCI %d/%d (Vcc %p)" , ctrl.pti ==5 ?"F5-E2E" : (ctrl.pti ==4 ?"F5-SEG" :"UNK" ), - ctrl.number, ctrl.vpi, ctrl.vci, *(struct atm_vcc **) &ctrl.vcc); + ctrl.pti, ctrl.itf, ctrl.vpi, ctrl.vci, + *(struct atm_vcc **) &ctrl.vcc);oam_process (&ctrl); }
@@ -86,7 +92,7 @@ }void -poll_loop (void ) +poll_loop (struct sockaddr_atmpvc *addr) {struct pollfd pollfds;
@@ -94,10 +100,10 @@ pollfds.events =POLLIN ;/* Que eventos queremos, solo entradas */ for (;;) { -oam_state_print (); +// oam_state_print(); if (run_fsm) { -oam_fsm (); +oam_fsm (addr); run_fsm =0 ; }
src/oamd/io.h renamed from linux-atm-2.5/src/oamd/io.h +10 -6
@@ -1,7 +1,11 @@ -/* io.h - I/O operations */ - -/* Written 1995-1999 by Werner Almesberger, EPFL-LRC/ICA */ - +/* +* io.h I/O operations +* +* Written 2003-2004 by Jorge Boncompte ([email protected]), DTI2 +* +* Code based on the atmarpd daemon by Werner Almesberger +* +*/ #ifndef IO_H #define IO_H
@@ -10,11 +14,11 @@#include <sys/socket.h> /* for struct sockaddr */ #include <atm.h> /* for struct sockaddr_atmsvc */ #include <atmd.h> -#include <linux/atmoam.h> +#include <atmoam.h> void open_kernel (void );void recv_kernel (void );int send_kernel (struct atmoam_ctrl *);void close_kernel (void ); -void poll_loop (void ); +void poll_loop (struct sockaddr_atmpvc *);#endif
Los ficheros binarios ../linux-atm-2.5/src/oamd/.libs/atmoamd y linux-atm-2.4.1/src/oamd/.libs/atmoamd son distintos
src/oamd/Makefile.am renamed from linux-atm-2.5/src/oamd/Makefile.am +2 -2
@@ -1,6 +1,6 @@ sbin_PROGRAMS = atmoamd +LDADD = $(top_builddir)/src/lib/libatm.la + atmoamd_SOURCES = atmoamd.c io.c io.h oam.c oam.h crc10.c crc10.h -atmoamd_LDADD = $(top_builddir)/src/lib/libatm.la -atmoamd_DEPENDENCIES = $(zeppelin_LDADD)
src/oamd/oam.c renamed from linux-atm-2.5/src/oamd/oam.c +47 -18
144 lines not on this page · raw message
src/oamd/oam.h renamed from linux-atm-2.5/src/oamd/oam.h +8 -5
@@ -1,7 +1,7 @@/* * oam.h - OAM cell processing * -* Written 2003 by Jorge Boncompte, DTI2 +* Written 2003-2004 by Jorge Boncompte ([email protected]), DTI2 * */
@@ -24,6 +24,9 @@#define OAM_INC_DOWNRETRY fsm.downretry++; fsm.upretry=0#define OAM_WAIT_10_S timer = 0; fsm.state = OAM_WAIT10 +#define ATM_UP_SCRIPT "/etc/atm/atm-up" +#define ATM_DOWN_SCRIPT "/etc/atm/atm-down" +struct oamfsm {int state;short upretry;
@@ -43,17 +46,17 @@struct {unsigned long InEndLoop;unsigned long InSegLoop; -// unsigned long InAIS; -// unsigned long InRDI; +unsigned long InAIS; +unsigned long InRDI;unsigned long OutEndLoop;unsigned long OutSegLoop; -// unsigned long OutRDI; +unsigned long OutRDI; } F5; } stats; };void oam_process (struct atmoam_ctrl *ctrl); -void oam_fsm (void ); +void oam_fsm (struct sockaddr_atmpvc *);void oam_state_print (void );#endif