netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* adding tcpdump/OAM support to usb ATM devices
@ 2008-04-27 21:31 Jeremy Jackson
  2008-04-27 21:35 ` David Miller
  2008-04-28 14:18 ` Chas Williams (CONTRACTOR)
  0 siblings, 2 replies; 6+ messages in thread
From: Jeremy Jackson @ 2008-04-27 21:31 UTC (permalink / raw)
  To: netdev

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?

-- 
Jeremy Jackson
Coplanar Networks
(519)489-4903
http://www.coplanar.net
jerj@coplanar.net


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding tcpdump/OAM support to usb ATM devices
  2008-04-27 21:31 adding tcpdump/OAM support to usb ATM devices Jeremy Jackson
@ 2008-04-27 21:35 ` David Miller
  2008-04-27 22:35   ` Jeremy Jackson
  2008-04-28 14:18 ` Chas Williams (CONTRACTOR)
  1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2008-04-27 21:35 UTC (permalink / raw)
  To: jerj; +Cc: netdev

From: Jeremy Jackson <jerj@coplanar.net>
Date: Sun, 27 Apr 2008 17:31:53 -0400

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding tcpdump/OAM support to usb ATM devices
  2008-04-27 21:35 ` David Miller
@ 2008-04-27 22:35   ` Jeremy Jackson
  0 siblings, 0 replies; 6+ messages in thread
From: Jeremy Jackson @ 2008-04-27 22:35 UTC (permalink / raw)
  To: David Miller; +Cc: netdev


On Sun, 2008-04-27 at 14:35 -0700, David Miller wrote:
> From: Jeremy Jackson <jerj@coplanar.net>
> Date: Sun, 27 Apr 2008 17:31:53 -0400
> 
> > 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.

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.

-- 
Jeremy Jackson
Coplanar Networks
(519)489-4903
http://www.coplanar.net
jerj@coplanar.net


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding tcpdump/OAM support to usb ATM devices
  2008-04-27 21:31 adding tcpdump/OAM support to usb ATM devices Jeremy Jackson
  2008-04-27 21:35 ` David Miller
@ 2008-04-28 14:18 ` Chas Williams (CONTRACTOR)
  2008-04-28 15:54   ` Jeremy Jackson
  1 sibling, 1 reply; 6+ messages in thread
From: Chas Williams (CONTRACTOR) @ 2008-04-28 14:18 UTC (permalink / raw)
  To: Jeremy Jackson; +Cc: netdev

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.

>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.

>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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding tcpdump/OAM support to usb ATM devices
  2008-04-28 14:18 ` Chas Williams (CONTRACTOR)
@ 2008-04-28 15:54   ` Jeremy Jackson
  2008-04-29 12:04     ` Chas Williams (CONTRACTOR)
  0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Jackson @ 2008-04-28 15:54 UTC (permalink / raw)
  To: chas3; +Cc: netdev


On Mon, 2008-04-28 at 10:18 -0400, Chas Williams (CONTRACTOR) wrote:
> 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.

> >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.

> eventually, all the atm clients (zeppelin, atmsigd, et al) should be
> converted to using netlink.
> 
> >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.

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.

-- 
Jeremy Jackson
Coplanar Networks
(519)489-4903
http://www.coplanar.net
jerj@coplanar.net


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding tcpdump/OAM support to usb ATM devices
  2008-04-28 15:54   ` Jeremy Jackson
@ 2008-04-29 12:04     ` Chas Williams (CONTRACTOR)
  0 siblings, 0 replies; 6+ messages in thread
From: Chas Williams (CONTRACTOR) @ 2008-04-29 12:04 UTC (permalink / raw)
  To: Jeremy Jackson; +Cc: netdev

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.

>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.

>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.

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.

diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/atmoamd.c linux-atm-2.4.1/src/oamd/atmoamd.c
--- ../linux-atm-2.5/src/oamd/atmoamd.c	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/atmoamd.c	2004-02-26 20:24:26.000000000 +0100
@@ -1,3 +1,12 @@
+/* 
+ *	atmoamd.c	OAM daemon
+ *
+ *	Written 2003-2004 by Jorge Boncompte (jorge@dti2.net), 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();
 
diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/crc10.c linux-atm-2.4.1/src/oamd/crc10.c
--- ../linux-atm-2.5/src/oamd/crc10.c	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/crc10.c	2004-02-26 15:14:29.000000000 +0100
@@ -1,3 +1,12 @@
+/* 
+ *	crc10.c	CRC10 calculation routines
+ *
+ *	Written 2003-2004 by Jorge Boncompte (jorge@dti2.net), DTI2
+ *	
+ *	The CRC10 table and sum routine are from the f4loopbackd.c source
+ *	from Alex Zeffertt.
+*/
+
 #include <atm.h>
 
 #include "crc10.h"
diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/crc10.h linux-atm-2.4.1/src/oamd/crc10.h
--- ../linux-atm-2.5/src/oamd/crc10.h	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/crc10.h	2004-02-26 15:13:52.000000000 +0100
@@ -1,9 +1,10 @@
 /* 
  *	crc10.h	CRC10
  *
- *	Written 2003 by Jorge Boncompte, DTI2
+ *	Written 2003-2004 by Jorge Boncompte (jorge@dti2.net), DTI2
  *	
  *	The CRC10 table and sum routine are from the f4loopbackd.c source
+ *	from Alex Zeffertt.
 */
 
 #ifndef CRC10_H
diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/io.c linux-atm-2.4.1/src/oamd/io.c
--- ../linux-atm-2.5/src/oamd/io.c	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/io.c	2004-02-26 20:30:50.000000000 +0100
@@ -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 (jorge@dti2.net), 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;
 		}
 
diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/io.h linux-atm-2.4.1/src/oamd/io.h
--- ../linux-atm-2.5/src/oamd/io.h	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/io.h	2004-02-26 20:31:01.000000000 +0100
@@ -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 (jorge@dti2.net), 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
diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/Makefile.am linux-atm-2.4.1/src/oamd/Makefile.am
--- ../linux-atm-2.5/src/oamd/Makefile.am	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/Makefile.am	2003-12-17 15:52:26.000000000 +0100
@@ -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)
diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/oam.c linux-atm-2.4.1/src/oamd/oam.c
--- ../linux-atm-2.5/src/oamd/oam.c	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/oam.c	2004-02-26 20:23:55.000000000 +0100
@@ -1,9 +1,17 @@
+/* 
+ *	oam.c - OAM cell processing
+ *
+ *	Written 2003-2004 by Jorge Boncompte (jorge@dti2.net), DTI2
+ *
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <errno.h>
 #include <atm.h>
-#include <linux/atmoam.h>
+#include <atmoam.h>
+#include <syslog.h>
 
 #include "oam.h"
 #include "io.h"
@@ -18,21 +26,39 @@
 void
 handle_circuit_state(int state)
 {
+    char itf[8], vpi[8], vci[8], itftype[16];
+
+    snprintf(itf, sizeof(itf), "%u", vcc.ctrl.itf);
+    snprintf(vpi, sizeof(vpi), "%u", vcc.ctrl.vpi);
+    snprintf(vci, sizeof(vci), "%u", vcc.ctrl.vci);
+    snprintf(itftype, sizeof(itftype), "ATM");
+
     vcc.state = state;
     diag(COMPONENT, DIAG_DEBUG, "VCC STATE CHANGE: %s",
 	vcc.state ? "DOWN" : "UP");
+
     if (vcc.state == VCC_UP) {
-	system("backuprdsi stop&");
+	syslog(LOG_DAEMON|LOG_NOTICE, "ATM VCC %d.%d.%d STATE CHANGED TO UP\n",
+		vcc.ctrl.itf, vcc.ctrl.vpi, vcc.ctrl.vci);
+	if (!fork()) {
+	    execlp(ATM_UP_SCRIPT, ATM_UP_SCRIPT, itf, vpi, vci, itftype, 0);
+	    syslog(LOG_DAEMON|LOG_NOTICE, "EXEC failed\n");
+	    exit(1);
+	}
     } else if (vcc.state == VCC_DOWN) {
-	system("backuprdsi start&");
+	syslog(LOG_DAEMON|LOG_NOTICE, "ATM VCC %d.%d.%d STATE CHANGED TO DOWN\n",
+		vcc.ctrl.itf, vcc.ctrl.vpi, vcc.ctrl.vci);
+	if (!fork()) {
+	    execlp(ATM_DOWN_SCRIPT, ATM_DOWN_SCRIPT, itf, vpi, vci, itftype, 0);
+	    syslog(LOG_DAEMON|LOG_NOTICE, "EXEC failed\n");
+	    exit(1);
+	}
     }
 }
 
 void
 oam_state_print(void)
 {
-	return;
-
 	printf
 	    ("-------------------------------------------------------------------\n");
 	printf("T: %d UP: %d DOWN: %d STATE: %d VCCSTATE %d CTag: %lx\n", timer,
@@ -80,7 +106,7 @@
 oam_send(struct atmoam_ctrl *ctrl)
 {
     int error;
-    
+
     error = send_kernel(ctrl);
     if (error > 0) {
 	fsm.state = OAM_SENT;
@@ -160,14 +186,14 @@
 		     oampayload->LoopBackInd ==
 		     1 ? "Loopback" : "Loopback reply", ctag);
 
-		if (pdu[1] == 1) {	/* Celda de Loopback */
+		if (pdu[1] == 1) {	/* Loopback cell */
 			vcc.stats.F5.InEndLoop++;
-			pdu[1] = 0;	/* Clear Loopback but */
+			pdu[1] = 0;	/* Clear Loopback bit */
 
 			/* Recalculate CRC10 */
 			crc10(pdu);
 
-			/* Volvemos a enviar la celda */
+			/* Sent the cell */
 			return 1;
 		}
 		if (pdu[1] == 0) {	/* Loopback reply */
@@ -186,11 +212,12 @@
 						return 0;
 					}
 				}
-				/* Desde aqui deberiamos ir a ESPERAR a 10 */
+				/* WAIT 10 seconds */
 				OAM_WAIT_10_S;
 				return 0;
 			} else {
-				printf("Wrong Correlation Tag\n");
+				syslog(LOG_DAEMON|LOG_ERR,
+					"Wrong Correlation Tag\n");
 				vcc.stats.CTagErrors++;
 				OAM_INC_DOWNRETRY;
 				if (fsm.downretry >= OAM_DOWNRETRY) {
@@ -205,7 +232,7 @@
 						return 0;
 					}
 				}
-				/* Desde aqui deberiamos ir a ESPERAR a 10 */
+				/* WAIT 10 seconds */
 				OAM_WAIT_10_S;
 				return 0;
 			}
@@ -221,7 +248,9 @@
 
 	if (crc10_check(ctrl->cell.payload) != 0) {
 		diag(COMPONENT, DIAG_ERROR,
-		     "Received OAM cell, failed CRC-10 check");
+		     "Received OAM cell failed CRC-10 check");
+		syslog(LOG_DAEMON|LOG_ERR,
+			"Received OAM cell failed CRC-10 check\n");
 		vcc.stats.CrcErrors++;
 		OAM_INC_DOWNRETRY;
 		if (fsm.downretry >= OAM_DOWNRETRY) {
@@ -252,14 +281,14 @@
 }
 
 void
-oam_fsm(void)
+oam_fsm(struct sockaddr_atmpvc *addr)
 {
 	switch (fsm.state) {
 	case OAM_INIT:
 		timer = 0;
-		vcc.ctrl.number = 0;
-		vcc.ctrl.vpi = 8;
-		vcc.ctrl.vci = 32;
+		vcc.ctrl.itf = addr->sap_addr.itf;
+		vcc.ctrl.vpi = addr->sap_addr.vpi;
+		vcc.ctrl.vci = addr->sap_addr.vci;
 		vcc.ctrl.pti = 5;
 		vcc.CTag = oam_build_lb_cell(&vcc.ctrl);
 		oam_send(&vcc.ctrl);
@@ -276,7 +305,7 @@
 				return;
 			}
 		}
-		/* Desde aqui deberiamos ir a ESPERAR a 10 */
+		/* WAIT 10 seconds */
 		OAM_WAIT_10_S;
 		break;
 	case OAM_WAIT10:
diff -X /root/diff-no-incluir -uNr ../linux-atm-2.5/src/oamd/oam.h linux-atm-2.4.1/src/oamd/oam.h
--- ../linux-atm-2.5/src/oamd/oam.h	2004-02-21 16:31:40.000000000 +0100
+++ linux-atm-2.4.1/src/oamd/oam.h	2004-02-26 15:54:58.000000000 +0100
@@ -1,7 +1,7 @@
 /* 
  *	oam.h - OAM cell processing
  *
- *	Written 2003 by Jorge Boncompte, DTI2
+ *	Written 2003-2004 by Jorge Boncompte (jorge@dti2.net), 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-29 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-27 21:31 adding tcpdump/OAM support to usb ATM devices Jeremy Jackson
2008-04-27 21:35 ` David Miller
2008-04-27 22:35   ` Jeremy Jackson
2008-04-28 14:18 ` Chas Williams (CONTRACTOR)
2008-04-28 15:54   ` Jeremy Jackson
2008-04-29 12:04     ` Chas Williams (CONTRACTOR)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).