summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-01-17 15:37:37 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-01-17 15:37:37 +0000
commited8c341a6a0a86463d7d07422ff2b562297fe5b9 (patch)
tree76810d2657f416affefdc7b4da2242d22604c326
parentaa2ac49fdc6746c3ef49fadef49b5d2bb0d03924 (diff)
add support for routed RFC2684 encaps. on ATM (patches written by joseangel), close #58
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3003 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/linux-atm/patches/100-br2684.patch667
-rw-r--r--target/linux/generic-2.4/patches/225-atm_br2684.patch600
-rw-r--r--target/linux/image/ar7/Makefile9
3 files changed, 1029 insertions, 247 deletions
diff --git a/package/linux-atm/patches/100-br2684.patch b/package/linux-atm/patches/100-br2684.patch
index 2eddf008e..94239ae97 100644
--- a/package/linux-atm/patches/100-br2684.patch
+++ b/package/linux-atm/patches/100-br2684.patch
@@ -1,6 +1,185 @@
+diff -ruN linux-atm-2.4.1/configure.in linux-atm-2.4.1.new/configure.in
+--- linux-atm-2.4.1/configure.in 2003-04-25 04:17:05.000000000 +0200
++++ linux-atm-2.4.1.new/configure.in 2005-07-27 15:45:49.532396543 +0200
+@@ -153,26 +153,6 @@
+ src/Makefile \
+ src/include/Makefile \
+ src/lib/Makefile \
+- src/test/Makefile \
+- src/debug/Makefile \
+- src/qgen/Makefile \
+- src/saal/Makefile \
+- src/sigd/Makefile \
+- src/maint/Makefile \
+- src/arpd/Makefile \
+- src/ilmid/Makefile \
+- src/ilmid/asn1/Makefile \
+- src/man/Makefile \
+- src/led/Makefile \
+- src/lane/Makefile \
+- src/mpoad/Makefile \
+- src/switch/Makefile \
+- src/switch/debug/Makefile \
+- src/switch/tcp/Makefile \
+- src/config/Makefile \
+- src/config/init-redhat/Makefile \
+- src/extra/Makefile \
+- src/extra/linux-atm.spec \
+- src/extra/ANS/Makefile
++ src/br2684/Makefile \
+ )
+
+diff -ruN linux-atm-2.4.1/src/br2684/Makefile linux-atm-2.4.1.new/src/br2684/Makefile
+--- linux-atm-2.4.1/src/br2684/Makefile 1970-01-01 02:00:00.000000000 +0200
++++ linux-atm-2.4.1.new/src/br2684/Makefile 2002-07-15 23:44:25.000000000 +0200
+@@ -0,0 +1,13 @@
++PREFIX=${TI_FILESYSTEM}
++
++all: br2684ctl
++
++br2684ctl: br2684ctl.c
++ gcc -latm -o br2684ctl br2684ctl.c
++ strip br2684ctl
++
++install: br2684ctl
++ cp br2684ctl $(PREFIX)/usr/sbin/
++
++clean:
++ rm -rf br2684ctl *.o
+diff -ruN linux-atm-2.4.1/src/Makefile.am linux-atm-2.4.1.new/src/Makefile.am
+--- linux-atm-2.4.1/src/Makefile.am 2001-10-03 23:14:53.000000000 +0200
++++ linux-atm-2.4.1.new/src/Makefile.am 2005-07-27 15:33:52.389309711 +0200
+@@ -1,3 +1,2 @@
+-SUBDIRS = include lib test debug qgen saal sigd maint arpd ilmid man led lane \
+- mpoad switch config extra
++SUBDIRS = include lib br2684
+
+
+diff -Nur linux-atm-2.4.1.orig/src/include/linux/atmbr2684.h linux-atm-2.4.1/src/include/linux/atmbr2684.h
+--- linux-atm-2.4.1.orig/src/include/linux/atmbr2684.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-atm-2.4.1/src/include/linux/atmbr2684.h 2005-11-13 00:06:42.000000000 +0100
+@@ -0,0 +1,117 @@
++#ifndef _LINUX_ATMBR2684_H
++#define _LINUX_ATMBR2684_H
++
++#include <linux/atm.h>
++#include <linux/if.h> /* For IFNAMSIZ */
++#include <linux/if_ether.h> /* ETH_P_* */
++
++/*
++ * Type of media we're bridging (ethernet, token ring, etc) Currently only
++ * ethernet is supported
++ */
++#define BR2684_MEDIA_ETHERNET (0) /* 802.3 */
++#define BR2684_MEDIA_802_4 (1) /* 802.4 */
++#define BR2684_MEDIA_TR (2) /* 802.5 - token ring */
++#define BR2684_MEDIA_FDDI (3)
++#define BR2684_MEDIA_802_6 (4) /* 802.6 */
++
++/*
++ * Is there FCS inbound on this VC? This currently isn't supported.
++ */
++#define BR2684_FCSIN_NO (0)
++#define BR2684_FCSIN_IGNORE (1)
++#define BR2684_FCSIN_VERIFY (2)
++
++/*
++ * Is there FCS outbound on this VC? This currently isn't supported.
++ */
++#define BR2684_FCSOUT_NO (0)
++#define BR2684_FCSOUT_SENDZERO (1)
++#define BR2684_FCSOUT_GENERATE (2)
++
++/*
++ * Does this VC include LLC encapsulation?
++ */
++#define BR2684_ENCAPS_VC (0) /* VC-mux */
++#define BR2684_ENCAPS_LLC (1)
++#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
++
++/*
++ * Is this VC bridged or routed?
++ */
++
++#define BR2684_PAYLOAD_ROUTED (0)
++#define BR2684_PAYLOAD_BRIDGED (1)
++
++
++/*
++ * This is for the ATM_NEWBACKENDIF call - these are like socket families:
++ * the first element of the structure is the backend number and the rest
++ * is per-backend specific
++ */
++struct atm_newif_br2684 {
++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
++ int media; /* BR2684_MEDIA_* */
++ char ifname[IFNAMSIZ];
++ int mtu;
++ int payload; /* bridged or routed */
++};
++
++/*
++ * This structure is used to specify a br2684 interface - either by a
++ * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name
++ */
++#define BR2684_FIND_BYNOTHING (0)
++#define BR2684_FIND_BYNUM (1)
++#define BR2684_FIND_BYIFNAME (2)
++struct br2684_if_spec {
++ int method; /* BR2684_FIND_* */
++ union {
++ char ifname[IFNAMSIZ];
++ int devnum;
++ } spec;
++};
++
++/*
++ * This is for the ATM_SETBACKEND call - these are like socket families:
++ * the first element of the structure is the backend number and the rest
++ * is per-backend specific
++ */
++struct atm_backend_br2684 {
++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
++ struct br2684_if_spec ifspec;
++ int fcs_in; /* BR2684_FCSIN_* */
++ int fcs_out; /* BR2684_FCSOUT_* */
++ int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
++ int encaps; /* BR2684_ENCAPS_* */
++ int payload; /* BR2684_PAYLOAD_* */
++ int has_vpiid; /* 1: use vpn_id - Unsupported */
++ __u8 vpn_id[7];
++ int send_padding; /* unsupported */
++ int min_size; /* we will pad smaller packets than this */
++};
++
++/*
++ * The BR2684_SETFILT ioctl is an experimental mechanism for folks
++ * terminating a large number of IP-only vcc's. When netfilter allows
++ * efficient per-if in/out filters, this support will be removed
++ */
++struct br2684_filter {
++ __u32 prefix; /* network byte order */
++ __u32 netmask; /* 0 = disable filter */
++};
++
++struct br2684_filter_set {
++ struct br2684_if_spec ifspec;
++ struct br2684_filter filter;
++};
++
++enum br2684_payload {
++ p_routed = BR2684_PAYLOAD_ROUTED,
++ p_bridged = BR2684_PAYLOAD_BRIDGED,
++};
++
++#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
++ struct br2684_filter_set)
++
++#endif /* _LINUX_ATMBR2684_H */
+diff Nur linux-atm-2.4.1.orig/src/br2684/br2684ctl.c linux-atm-2.4.1/src/br2684/br2684ctl.c
--- linux-atm-2.4.1.orig/src/br2684/br2684ctl.c
+++ linux-atm-2.4.1/src/br2684/br2684ctl.c
-@@ -0,0 +1,251 @@
+@@ -0,0 +1,302 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
@@ -32,280 +211,274 @@
+
+int lastsock, lastitf;
+
-+
-+void fatal(const char *str, int i)
++void fatal(char *str, int i)
+{
-+ syslog (LOG_ERR,"Fatal: %s",str);
-+ exit(-2);
++ syslog(LOG_ERR, "Fatal: %s", str);
++ exit(-2);
+};
+
+
+void exitFunc(void)
+{
-+ syslog (LOG_PID,"Daemon terminated\n");
++ syslog(LOG_PID, "Daemon terminated\n");
+}
+
+
-+int create_br(char *nstr)
++int create_pidfile(char *nstr)
+{
-+ int num, err;
-+
-+ if(lastsock<0) {
-+ lastsock = socket(PF_ATMPVC, SOCK_DGRAM, ATM_AAL5);
-+ }
-+ if (lastsock<0) {
-+ syslog(LOG_ERR, "socket creation failed: %s",strerror(errno));
-+ } else {
-+ /* create the device with ioctl: */
-+ num=atoi(nstr);
-+ if( num>=0 && num<1234567890){
-+ struct atm_newif_br2684 ni;
-+ ni.backend_num = ATM_BACKEND_BR2684;
-+ ni.media = BR2684_MEDIA_ETHERNET;
-+ ni.mtu = 1500;
-+ sprintf(ni.ifname, "nas%d", num);
-+ err=ioctl (lastsock, ATM_NEWBACKENDIF, &ni);
-+
-+ if (err == 0)
-+ syslog(LOG_INFO, "Interface \"%s\" created sucessfully\n",ni.ifname);
-+ else
-+ syslog(LOG_INFO, "Interface \"%s\" could not be created, reason: %s\n",
-+ ni.ifname,
-+ strerror(errno));
-+ lastitf=num; /* even if we didn't create, because existed, assign_vcc wil want to know it! */
-+ } else {
-+ syslog(LOG_ERR,"err: strange interface number %d", num );
-+ }
-+ }
-+ return 0;
++ FILE *pidfile = NULL;
++ char name[20];
++ int num;
++
++ if (nstr == NULL)
++ return -1;
++ num = atoi(nstr);
++ if (num < 0)
++ return -1;
++
++ snprintf(name, 20, "/var/run/nas%d.pid", num);
++ pidfile = fopen(name, "w");
++ if (pidfile == NULL)
++ return -1;
++ fprintf(pidfile, "%d", getpid());
++ fclose(pidfile);
++
++ return 0;
++}
++
++int create_br(char *nstr, int payload)
++{
++ int num, err;
++
++ if (lastsock < 0) {
++ lastsock = socket(PF_ATMPVC, SOCK_DGRAM, ATM_AAL5);
++ }
++ if (lastsock < 0) {
++ syslog(LOG_ERR, "socket creation failed: %s",
++ strerror(errno));
++ } else {
++ /* create the device with ioctl: */
++ num = atoi(nstr);
++ if (num >= 0 && num < 1234567890) {
++ struct atm_newif_br2684 ni;
++ ni.backend_num = ATM_BACKEND_BR2684;
++ ni.media = BR2684_MEDIA_ETHERNET;
++ ni.mtu = 1500;
++ ni.payload = payload; /* bridged or routed */
++ sprintf(ni.ifname, "nas%d", num);
++ err = ioctl(lastsock, ATM_NEWBACKENDIF, &ni);
++
++ if (err == 0)
++ syslog(LOG_INFO,
++ "Interface \"%s\" created sucessfully\n",
++ ni.ifname);
++ else
++ syslog(LOG_INFO,
++ "Interface \"%s\" could not be created, reason: %s\n",
++ ni.ifname, strerror(errno));
++ lastitf = num; /* even if we didn't create, because existed, assign_vcc wil want to know it! */
++ } else {
++ syslog(LOG_ERR, "err: strange interface number %d",
++ num);
++ }
++ }
++ return 0;
+}
+
+
-+int assign_vcc(char *astr, int encap, int bufsize, struct atm_qos qos)
++int assign_vcc(char *astr, int encap, int payload, int bufsize)
+{
-+ int err;
-+ struct sockaddr_atmpvc addr;
-+ int fd;
-+ struct atm_backend_br2684 be;
-+
-+ memset(&addr, 0, sizeof(addr));
-+ err=text2atm(astr,(struct sockaddr *)(&addr), sizeof(addr), T2A_PVC);
-+ if (err!=0)
-+ syslog(LOG_ERR,"Could not parse ATM parameters (error=%d)\n",err);
-+
++ int err, errno;
++ struct atm_qos qos;
++ struct sockaddr_atmpvc addr;
++ int fd;
++ struct atm_backend_br2684 be;
++
++ memset(&addr, 0, sizeof(addr));
++ err =
++ text2atm(astr, (struct sockaddr *) (&addr), sizeof(addr),
++ T2A_PVC);
++ if (err != 0)
++ syslog(LOG_ERR,
++ "Could not parse ATM parameters (error=%d)\n", err);
++
+#if 0
-+ addr.sap_family = AF_ATMPVC;
-+ addr.sap_addr.itf = itf;
-+ addr.sap_addr.vpi = 0;
-+ addr.sap_addr.vci = vci;
++ addr.sap_family = AF_ATMPVC;
++ addr.sap_addr.itf = itf;
++ addr.sap_addr.vpi = 0;
++ addr.sap_addr.vci = vci;
+#endif
-+ syslog(LOG_INFO,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf,
-+ addr.sap_addr.vpi,
-+ addr.sap_addr.vci,
-+ encap?"VC mux":"LLC");
-+
-+ if ((fd = socket(PF_ATMPVC, SOCK_DGRAM, ATM_AAL5)) < 0)
-+ syslog(LOG_ERR,"failed to create socket %d, reason: %s", errno,strerror(errno));
-+
-+ if (qos.aal == 0) {
-+ qos.aal = ATM_AAL5;
-+ qos.txtp.traffic_class = ATM_UBR;
-+ qos.txtp.max_sdu = 1524;
-+ qos.txtp.pcr = ATM_MAX_PCR;
-+ qos.rxtp = qos.txtp;
-+ }
-+
-+ if ( (err=setsockopt(fd,SOL_SOCKET,SO_SNDBUF, &bufsize ,sizeof(bufsize))) )
-+ syslog(LOG_ERR,"setsockopt SO_SNDBUF: (%d) %s\n",err, strerror(err));
-+
-+ if (setsockopt(fd, SOL_ATM, SO_ATMQOS, &qos, sizeof(qos)) < 0)
-+ syslog(LOG_ERR,"setsockopt SO_ATMQOS %d", errno);
-+
-+ err = connect(fd, (struct sockaddr*)&addr, sizeof(struct sockaddr_atmpvc));
-+
-+ if (err < 0)
-+ fatal("failed to connect on socket", err);
-+
-+ /* attach the vcc to device: */
-+
-+ be.backend_num = ATM_BACKEND_BR2684;
-+ be.ifspec.method = BR2684_FIND_BYIFNAME;
-+ sprintf(be.ifspec.spec.ifname, "nas%d", lastitf);
-+ be.fcs_in = BR2684_FCSIN_NO;
-+ be.fcs_out = BR2684_FCSOUT_NO;
-+ be.fcs_auto = 0;
-+ be.encaps = encap ? BR2684_ENCAPS_VC : BR2684_ENCAPS_LLC;
-+ be.has_vpiid = 0;
-+ be.send_padding = 0;
-+ be.min_size = 0;
-+ err=ioctl (fd, ATM_SETBACKEND, &be);
-+ if (err == 0)
-+ syslog (LOG_INFO,"Interface configured");
-+ else {
-+ syslog (LOG_ERR,"Could not configure interface:%s",strerror(errno));
-+ exit(2);
-+ }
-+ return fd ;
++ syslog(LOG_INFO,
++ "Communicating over ATM %d.%d.%d, encapsulation: %s\n",
++ addr.sap_addr.itf, addr.sap_addr.vpi, addr.sap_addr.vci,
++ encap ? "VC mux" : "LLC");
++
++ if ((fd = socket(PF_ATMPVC, SOCK_DGRAM, ATM_AAL5)) < 0)
++ syslog(LOG_ERR, "failed to create socket %d, reason: %s",
++ errno, strerror(errno));
++
++
++ memset(&qos, 0, sizeof(qos));
++ qos.aal = ATM_AAL5;
++ qos.txtp.traffic_class = ATM_UBR;
++ qos.txtp.max_sdu = 1524;
++ qos.txtp.pcr = ATM_MAX_PCR;
++ qos.rxtp = qos.txtp;
++
++ if ((err =
++ setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsize,
++ sizeof(bufsize))))
++ syslog(LOG_ERR, "setsockopt SO_SNDBUF: (%d) %s\n", err,
++ strerror(err));
++
++ if (setsockopt(fd, SOL_ATM, SO_ATMQOS, &qos, sizeof(qos)) < 0)
++ syslog(LOG_ERR, "setsockopt SO_ATMQOS %d", errno);
++
++ err =
++ connect(fd, (struct sockaddr *) &addr,
++ sizeof(struct sockaddr_atmpvc));
++
++ if (err < 0)
++ fatal("failed to connect on socket", err);
++
++ /* attach the vcc to device: */
++
++ be.backend_num = ATM_BACKEND_BR2684;
++ be.ifspec.method = BR2684_FIND_BYIFNAME;
++ sprintf(be.ifspec.spec.ifname, "nas%d", lastitf);
++ be.fcs_in = BR2684_FCSIN_NO;
++ be.fcs_out = BR2684_FCSOUT_NO;
++ be.fcs_auto = 0;
++ be.encaps = encap ? BR2684_ENCAPS_VC : BR2684_ENCAPS_LLC;
++ be.payload = payload;
++ be.has_vpiid = 0;
++ be.send_padding = 0;
++ be.min_size = 0;
++ err = ioctl(fd, ATM_SETBACKEND, &be);
++ if (err == 0)
++ syslog(LOG_INFO, "Interface configured");
++ else {
++ syslog(LOG_ERR, "Could not configure interface:%s",
++ strerror(errno));
++ exit(2);
++ }
++ return fd;
+}
+
+
++
+void usage(char *s)
+{
-+ printf("usage: %s [-b] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-a [itf.]vpi.vci]*]*\n", s);
-+ exit(1);
++ printf
++ ("usage: %s [-b] [[-c number] [-e 0|1] [-p 0|1] [-t 4|6] [-a [itf.]vpi.vci]*]*\n",
++ s);
++ exit(1);
+}
+
+
+
-+int main (int argc, char **argv)
++int main(int argc, char **argv)
+{
-+ int c, background=0, encap=0, sndbuf=8192;
-+ struct atm_qos reqqos;
-+ lastsock=-1;
-+ lastitf=0;
-+
-+ /* st qos to 0 */
-+ memset(&reqqos, 0, sizeof(reqqos));
-+
-+ openlog (LOG_NAME,LOG_OPTION,LOG_FACILITY);
-+ if (argc>1)
-+ while ((c = getopt(argc, argv,"q:a:bc:e:s:?h")) !=EOF)
-+ switch (c) {
-+ case 'q':
-+ printf ("optarg : %s",optarg);
-+ if (text2qos(optarg,&reqqos,0)) fprintf(stderr,"QOS parameter invalid\n");
-+ break;
-+ case 'a':
-+ assign_vcc(optarg, encap, sndbuf, reqqos);
-+ break;
-+ case 'b':
-+ background=1;
-+ break;
-+ case 'c':
-+ create_br(optarg);
-+ break;
-+ case 'e':
-+ encap=(atoi(optarg));
-+ if(encap<0){
-+ syslog (LOG_ERR, "invalid encapsulation: %s:\n",optarg);
-+ encap=0;
-+ }
-+ break;
-+ case 's':
-+ sndbuf=(atoi(optarg));
-+ if(sndbuf<0){
-+ syslog(LOG_ERR, "Invalid sndbuf: %s, using size of 8192 instead\n",optarg);
-+ sndbuf=8192;
-+ }
-+ break;
-+ case '?':
-+ case 'h':
-+ default:
-+ usage(argv[0]);
-+ }
-+ else
-+ usage(argv[0]);
-+
-+ if (argc != optind) usage(argv[0]);
-+
-+ if(lastsock>=0) close(lastsock);
-+
-+ if (background) {
-+ pid_t pid;
-+
-+ pid=fork();
-+ if (pid < 0) {
-+ fprintf(stderr,"Error detaching\n");
-+ exit(2);
-+ } else if (pid)
-+ exit(0); // This is the parent
-+
-+ // Become a process group and session group leader
-+ if (setsid()<0) {
-+ fprintf (stderr,"Could not set process group\n");
-+ exit(2);
-+ }
-+
-+ // Fork again to let process group leader exit
-+ pid = fork();
-+ if (pid < 0) {
-+ fprintf(stderr,"Error detaching during second fork\n");
-+ exit(2);
-+ } else if (pid)
-+ exit(0); // This is the parent
-+
-+ // Now we're ready for buisness
-+ chdir("/"); // Don't keep directories in use
-+ close(0); close(1); close(2); // Close stdin, -out and -error
-+ /*
-+ Note that this implementation does not keep an open
-+ stdout/err.
-+ If we need them they can be opened now
-+ */
-+
-+ }
-+
-+ syslog (LOG_INFO, "RFC 1483/2684 bridge daemon started\n");
-+ atexit (exitFunc);
-+
-+ while (1) sleep(30); /* to keep the sockets... */
-+ return 0;
-+}
++ int c, background = 0, encap = 0, sndbuf = 8192, payload = 1;
++ char *itfnum = NULL;
+
-diff -ruN linux-atm-2.4.1/configure.in linux-atm-2.4.1.new/configure.in
---- linux-atm-2.4.1/configure.in 2003-04-25 04:17:05.000000000 +0200
-+++ linux-atm-2.4.1.new/configure.in 2005-07-27 15:45:49.532396543 +0200
-@@ -153,26 +153,6 @@
- src/Makefile \
- src/include/Makefile \
- src/lib/Makefile \
-- src/test/Makefile \
-- src/debug/Makefile \
-- src/qgen/Makefile \
-- src/saal/Makefile \
-- src/sigd/Makefile \
-- src/maint/Makefile \
-- src/arpd/Makefile \
-- src/ilmid/Makefile \
-- src/ilmid/asn1/Makefile \
-- src/man/Makefile \
-- src/led/Makefile \
-- src/lane/Makefile \
-- src/mpoad/Makefile \
-- src/switch/Makefile \
-- src/switch/debug/Makefile \
-- src/switch/tcp/Makefile \
-- src/config/Makefile \
-- src/config/init-redhat/Makefile \
-- src/extra/Makefile \
-- src/extra/linux-atm.spec \
-- src/extra/ANS/Makefile
-+ src/br2684/Makefile \
- )
-
-diff -ruN linux-atm-2.4.1/src/br2684/Makefile linux-atm-2.4.1.new/src/br2684/Makefile
---- linux-atm-2.4.1/src/br2684/Makefile 1970-01-01 02:00:00.000000000 +0200
-+++ linux-atm-2.4.1.new/src/br2684/Makefile 2002-07-15 23:44:25.000000000 +0200
-@@ -0,0 +1,13 @@
-+PREFIX=${TI_FILESYSTEM}
++ lastsock = -1;
++ lastitf = 0;
+
-+all: br2684ctl
++ openlog(LOG_NAME, LOG_OPTION, LOG_FACILITY);
++ if (argc > 1)
++ while ((c = getopt(argc, argv, "a:bc:e:s:p:t:?h")) != EOF)
++ switch (c) {
++ case 'a':
++ assign_vcc(optarg, encap, payload, sndbuf);
++ break;
++ case 'b':
++ background = 1;
++ break;
++ case 'c':
++ create_br(optarg, payload);
++ itfnum = strdup(optarg);
++ break;
++ case 'e':
++ encap = (atoi(optarg));
++ if (encap < 0) {
++ syslog(LOG_ERR,
++ "invalid encapsulation: %s:\n",
++ optarg);
++ encap = 0;
++ }
++ break;
++ case 's':
++ sndbuf = (atoi(optarg));
++ if (sndbuf < 0) {
++ syslog(LOG_ERR,
++ "Invalid sndbuf: %s, using size of 8192 instead\n",
++ optarg);
++ sndbuf = 8192;
++ }
++ break;
++ case 'p': /* payload type: routed (0) or bridged (1) */
++ payload = atoi(optarg);
++ break;
++ case '?':
++ case 'h':
++ default:
++ usage(argv[0]);
++ } else
++ usage(argv[0]);
+
-+br2684ctl: br2684ctl.c
-+ gcc -latm -o br2684ctl br2684ctl.c
-+ strip br2684ctl
++ if (argc != optind)
++ usage(argv[0]);
+
-+install: br2684ctl
-+ cp br2684ctl $(PREFIX)/usr/sbin/
++ if (lastsock >= 0)
++ close(lastsock);
+
-+clean:
-+ rm -rf br2684ctl *.o
-diff -ruN linux-atm-2.4.1/src/Makefile.am linux-atm-2.4.1.new/src/Makefile.am
---- linux-atm-2.4.1/src/Makefile.am 2001-10-03 23:14:53.000000000 +0200
-+++ linux-atm-2.4.1.new/src/Makefile.am 2005-07-27 15:33:52.389309711 +0200
-@@ -1,3 +1,2 @@
--SUBDIRS = include lib test debug qgen saal sigd maint arpd ilmid man led lane \
-- mpoad switch config extra
-+SUBDIRS = include lib br2684
-
-
++ if (background) {
++ pid_t pid;
++
++ pid = fork();
++ if (pid < 0) {
++ fprintf(stderr, "Error detaching\n");
++ exit(2);
++ } else if (pid)
++ exit(0); // This is the parent
++
++ // Become a process group and session group leader
++ if (setsid() < 0) {
++ fprintf(stderr, "Could not set process group\n");
++ exit(2);
++ }
++ // Fork again to let process group leader exit
++ pid = fork();
++ if (pid < 0) {
++ fprintf(stderr,
++ "Error detaching during second fork\n");
++ exit(2);
++ } else if (pid)
++ exit(0); // This is the parent
++
++ // Now we're ready for buisness
++ chdir("/"); // Don't keep directories in use
++ close(0);
++ close(1);
++ close(2); // Close stdin, -out and -error
++ /*
++ Note that this implementation does not keep an open
++ stdout/err.
++ If we need them they can be opened now
++ */
++
++ }
++
++ if (itfnum != NULL) {
++ create_pidfile(itfnum);
++ free(itfnum);
++ }
++
++ syslog(LOG_INFO, "RFC 1483/2684 bridge daemon started\n");
++ atexit(exitFunc);
++
++ while (1)
++ sleep(30); /* to keep the sockets... */
++ return 0;
++}
diff --git a/target/linux/generic-2.4/patches/225-atm_br2684.patch b/target/linux/generic-2.4/patches/225-atm_br2684.patch
new file mode 100644
index 000000000..3b01533cd
--- /dev/null
+++ b/target/linux/generic-2.4/patches/225-atm_br2684.patch
@@ -0,0 +1,600 @@
+diff -Nur linux.old/net/atm/br2684.c linux.new/net/atm/br2684.c
+--- linux.old/net/atm/br2684.c 2004-08-08 01:26:06.000000000 +0200
++++ linux.new/net/atm/br2684.c 2005-11-13 00:04:15.000000000 +0100
+@@ -16,12 +16,9 @@
+ #include <linux/ip.h>
+ #include <asm/uaccess.h>
+ #include <net/arp.h>
+-#include <linux/atm.h>
+-#include <linux/atmdev.h>
+
+ #include <linux/atmbr2684.h>
+
+-#include "common.h"
+ #include "ipcommon.h"
+
+ /*
+@@ -55,36 +52,57 @@
+ #define skb_debug(skb) do {} while (0)
+ #endif
+
++#define BR2684_LLC_LEN 3
++#define BR2684_SNAP_LEN 3
++#define BR2684_ETHERTYPE_LEN 2
++#define BR2684_PID_LEN 2
++#define BR2684_PAD_LEN 2
++
++static unsigned char llc_common[] = { 0xaa, 0xaa, 0x03 };
++static unsigned char snap_bridged[] = { 0x00, 0x80, 0xc2 };
++static unsigned char snap_routed[] = { 0x00, 0x00, 0x00 };
++static unsigned char pid_ipv4[] = { 0x00, 0x07 };
++static unsigned char ethertype_ipv4[] = { 0x08, 0x00 };
++static unsigned char ethertype_ipv6[] = { 0x86, 0xdd };
++static unsigned char pad_bridged[] = { 0x00, 0x00 };
++
+ static unsigned char llc_oui_pid_pad[] =
+ { 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
++static unsigned char llc_oui_ipv6[] =
++ { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x86, 0xdd };
++static unsigned char llc_oui_ipv4[] =
++ { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 };
+ #define PADLEN (2)
+
+ enum br2684_encaps {
+- e_vc = BR2684_ENCAPS_VC,
++ e_vc = BR2684_ENCAPS_VC,
+ e_llc = BR2684_ENCAPS_LLC,
+ };
+
++
++
+ struct br2684_vcc {
+- struct atm_vcc *atmvcc;
++ struct atm_vcc *atmvcc;
+ struct br2684_dev *brdev;
+ /* keep old push,pop functions for chaining */
+- void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb);
++ void (*old_push) (struct atm_vcc * vcc, struct sk_buff * skb);
+ /* void (*old_pop)(struct atm_vcc *vcc,struct sk_buff *skb); */
+ enum br2684_encaps encaps;
++ enum br2684_payload payload;
+ struct list_head brvccs;
+ #ifdef CONFIG_ATM_BR2684_IPFILTER
+ struct br2684_filter filter;
+-#endif /* CONFIG_ATM_BR2684_IPFILTER */
++#endif /* CONFIG_ATM_BR2684_IPFILTER */
+ #ifndef FASTER_VERSION
+ unsigned copies_needed, copies_failed;
+-#endif /* FASTER_VERSION */
++#endif /* FASTER_VERSION */
+ };
+
+ struct br2684_dev {
+ struct net_device net_dev;
+ struct list_head br2684_devs;
+ int number;
+- struct list_head brvccs; /* one device <=> one vcc (before xmas) */
++ struct list_head brvccs; /* one device <=> one vcc (before xmas) */
+ struct net_device_stats stats;
+ int mac_was_set;
+ };
+@@ -173,24 +197,84 @@
+ }
+ skb = skb2;
+ }
+- skb_push(skb, minheadroom);
+- if (brvcc->encaps == e_llc)
+- memcpy(skb->data, llc_oui_pid_pad, 10);
+- else
+- memset(skb->data, 0, 2);
+-#endif /* FASTER_VERSION */
++
++ /* This skb_push is a problem: routed packets need less headroom than
++ * bridged packets.
++ */
++
++/* skb_push(skb, minheadroom); */
++ if (brvcc->encaps == e_llc) {
++ int offset = 0;
++ int actual_headroom;
++
++ actual_headroom =
++ BR2684_LLC_LEN +
++ BR2684_SNAP_LEN +
++ ((brvcc->payload == p_bridged) ?
++ (BR2684_PID_LEN + BR2684_PAD_LEN) :
++ BR2684_ETHERTYPE_LEN);
++
++ skb_push(skb, actual_headroom);
++ memcpy(skb->data, llc_common, BR2684_LLC_LEN);
++ offset += BR2684_LLC_LEN;
++
++ if (brvcc->payload == p_bridged) {
++ memcpy(skb->data + offset, snap_bridged,
++ BR2684_SNAP_LEN);
++ offset += BR2684_SNAP_LEN;
++ /* pid_ipv4 is poorly named. should probably be
++ * pid_ethernet
++ */
++ memcpy(skb->data + offset, pid_ipv4,
++ BR2684_PID_LEN);
++ offset += BR2684_PID_LEN;
++ memcpy(skb->data + offset, pad_bridged,
++ BR2684_PAD_LEN);
++ offset += BR2684_PAD_LEN;
++ } else if (brvcc->payload == p_routed) {
++ unsigned short prot =
++ __constant_ntohs(skb->protocol);
++ memcpy(skb->data + offset, snap_routed,
++ BR2684_SNAP_LEN);
++ offset += BR2684_SNAP_LEN;
++
++ switch (prot) {
++ case ETH_P_IP:
++ memcpy(skb->data + offset,
++ ethertype_ipv4,
++ BR2684_ETHERTYPE_LEN);
++ break;
++ case ETH_P_IPV6:
++ memcpy(skb->data + offset,
++ ethertype_ipv6,
++ BR2684_ETHERTYPE_LEN);
++ break;
++ default:
++ dev_kfree_skb(skb);
++ return 0;
++ }
++ offset += BR2684_ETHERTYPE_LEN;
++
++ }
++ } else {
++ skb_push(skb, 2);
++ if (brvcc->payload == p_bridged)
++ memset(skb->data, 0, 2);
++ }
++#endif /* FASTER_VERSION */
+ skb_debug(skb);
+
+ ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
+- DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
++ DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc,
++ atmvcc->dev);
+ if (!atm_may_send(atmvcc, skb->truesize)) {
+ /* we free this here for now, because we cannot know in a higher
+- layer whether the skb point it supplied wasn't freed yet.
+- now, it always is.
+- */
++ layer whether the skb point it supplied wasn't freed yet.
++ now, it always is.
++ */
+ dev_kfree_skb(skb);
+ return 0;
+- }
++ }
+ atomic_add(skb->truesize, &atmvcc->sk->wmem_alloc);
+ ATM_SKB(skb)->atm_options = atmvcc->atm_options;
+ brdev->stats.tx_packets++;
+@@ -428,18 +512,39 @@
+ atm_return(atmvcc, skb->truesize);
+ DPRINTK("skb from brdev %p\n", brdev);
+ if (brvcc->encaps == e_llc) {
++ /* accept packets that have "ipv[46]" in the snap header */
++ /* 8 - 2 == sizeof(llc_oui_ipv6) - BR2684_ETHERTYPE_LEN */
++ if (memcmp(skb->data, llc_oui_ipv6, 8 - 2) == 0) {
++ plen = sizeof(llc_oui_ipv6);
++
++ if (memcmp(skb->data + 6, ethertype_ipv6, 2) == 0)
++ skb->protocol =
++ __constant_htons(ETH_P_IPV6);
++ else if (memcmp(skb->data + 6, ethertype_ipv4, 2)
++ == 0)
++ skb->protocol = __constant_htons(ETH_P_IP);
++ else {
++ brdev->stats.rx_errors++;
++ dev_kfree_skb(skb);
++ return;
++ }
++ skb_pull(skb, plen);
++ skb->nh.raw = skb->data;
++ skb->pkt_type = PACKET_HOST;
++ }
++
+ /* let us waste some time for checking the encapsulation.
+ Note, that only 7 char is checked so frames with a valid FCS
+ are also accepted (but FCS is not checked of course) */
+- if (memcmp(skb->data, llc_oui_pid_pad, 7)) {
++ else if (memcmp(skb->data, llc_oui_pid_pad, 7) == 0) {
++ skb_pull(skb, plen - ETH_HLEN);
++ skb->protocol =
++ eth_type_trans(skb, &brdev->net_dev);
++ } else {
+ brdev->stats.rx_errors++;
+ dev_kfree_skb(skb);
+ return;
+ }
+-
+- /* Strip FCS if present */
+- if (skb->len > 7 && skb->data[7] == 0x01)
+- __skb_trim(skb, skb->len - 4);
+ } else {
+ plen = PADLEN + ETH_HLEN; /* pad, dstmac,srcmac, ethtype */
+ /* first 2 chars should be 0 */
+@@ -448,13 +553,14 @@
+ dev_kfree_skb(skb);
+ return;
+ }
++ skb_pull(skb, plen - ETH_HLEN);
++ skb->protocol = eth_type_trans(skb, &brdev->net_dev);
+ }
+ if (skb->len < plen) {
+ brdev->stats.rx_errors++;
+ dev_kfree_skb(skb); /* dev_ not needed? */
+ return;
+ }
+-
+ #ifdef FASTER_VERSION
+ /* FIXME: tcpdump shows that pointer to mac header is 2 bytes earlier,
+ than should be. What else should I set? */
+@@ -465,30 +571,29 @@
+ skb->protocol = ((u16 *) skb->data)[-1];
+ #else /* some protocols might require this: */
+ skb->protocol = br_type_trans(skb, &brdev->net_dev);
+-#endif /* CONFIG_BR2684_FAST_TRANS */
++#endif /* CONFIG_BR2684_FAST_TRANS */
+ #else
+- skb_pull(skb, plen - ETH_HLEN);
+- skb->protocol = eth_type_trans(skb, &brdev->net_dev);
+-#endif /* FASTER_VERSION */
++ /* skb_pull(skb, plen - ETH_HLEN); */
++ /* skb->protocol = eth_type_trans(skb, &brdev->net_dev); */
++#endif /* FASTER_VERSION */
+ #ifdef CONFIG_ATM_BR2684_IPFILTER
+ if (packet_fails_filter(skb->protocol, brvcc, skb)) {
+ brdev->stats.rx_dropped++;
+ dev_kfree_skb(skb);
+ return;
+ }
+-#endif /* CONFIG_ATM_BR2684_IPFILTER */
++#endif /* CONFIG_ATM_BR2684_IPFILTER */
+ skb->dev = &brdev->net_dev;
+- ATM_SKB(skb)->vcc = atmvcc; /* needed ? */
++ /* ATM_SKB(skb)->vcc = atmvcc; *//* needed ? */
+ DPRINTK("received packet's protocol: %x\n", ntohs(skb->protocol));
+ skb_debug(skb);
+- if (!(brdev->net_dev.flags & IFF_UP)) { /* sigh, interface is down */
++ if (!(brdev->net_dev.flags & IFF_UP)) { /* sigh, interface is down */
+ brdev->stats.rx_dropped++;
+ dev_kfree_skb(skb);
+ return;
+ }
+ brdev->stats.rx_packets++;
+ brdev->stats.rx_bytes += skb->len;
+- memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
+ netif_rx(skb);
+ }
+
+@@ -525,10 +630,10 @@
+ err = -EEXIST;
+ goto error;
+ }
+- if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO ||
+- be.fcs_auto || be.has_vpiid || be.send_padding || (be.encaps !=
+- BR2684_ENCAPS_VC && be.encaps != BR2684_ENCAPS_LLC) ||
+- be.min_size != 0) {
++ if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO
++ || be.fcs_auto || be.has_vpiid || be.send_padding
++ || (be.encaps != BR2684_ENCAPS_VC
++ && be.encaps != BR2684_ENCAPS_LLC) || be.min_size != 0) {
+ err = -EINVAL;
+ goto error;
+ }
+@@ -554,18 +659,21 @@
+ brvcc->atmvcc = atmvcc;
+ atmvcc->user_back = brvcc;
+ brvcc->encaps = (enum br2684_encaps) be.encaps;
++ brvcc->payload = (enum br2684_payload) be.payload;
+ brvcc->old_push = atmvcc->push;
+ barrier();
+ atmvcc->push = br2684_push;
+ skb_queue_head_init(&copy);
+ skb_migrate(&atmvcc->sk->receive_queue, &copy);
+ while ((skb = skb_dequeue(&copy))) {
++#ifdef notdef
+ BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
+ BRPRIV(skb->dev)->stats.rx_packets--;
++#endif
+ br2684_push(atmvcc, skb);
+ }
+ return 0;
+- error:
++ error:
+ write_unlock_irq(&devs_lock);
+ MOD_DEC_USE_COUNT;
+ return err;
+@@ -608,12 +717,25 @@
+
+ if (ni.ifname[0] != '\0') {
+ memcpy(brdev->net_dev.name, ni.ifname,
+- sizeof(brdev->net_dev.name));
+- brdev->net_dev.name[sizeof(brdev->net_dev.name) - 1] = '\0';
++ sizeof(brdev->net_dev.name));
++ brdev->net_dev.name[sizeof(brdev->net_dev.name) - 1] =
++ '\0';
+ } else
+ sprintf(brdev->net_dev.name, "nas%d", brdev->number);
+ DPRINTK("registered netdev %s\n", brdev->net_dev.name);
+- ether_setup(&brdev->net_dev);
++ if (ni.payload == p_routed) {
++ brdev->net_dev.hard_header_len = 0;
++ brdev->net_dev.addr_len = 0;
++ brdev->net_dev.mtu = 1500;
++
++ /* Type PPP seems most suitable */
++ brdev->net_dev.type = ARPHRD_PPP;
++ brdev->net_dev.flags =
++ IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
++ brdev->net_dev.tx_queue_len = 100;
++ } else {
++ ether_setup(&brdev->net_dev);
++ }
+ brdev->mac_was_set = 0;
+ #ifdef FASTER_VERSION
+ my_eth_header = brdev->net_dev.hard_header;
+@@ -677,12 +799,11 @@
+ err = br2684_setfilt(atmvcc, arg);
+ MOD_DEC_USE_COUNT;
+ return err;
+-#endif /* CONFIG_ATM_BR2684_IPFILTER */
++#endif /* CONFIG_ATM_BR2684_IPFILTER */
+ }
+ return -ENOIOCTLCMD;
+ }
+
+-#ifdef CONFIG_PROC_FS
+ /* Never put more than 256 bytes in at once */
+ static int br2684_proc_engine(loff_t pos, char *buf)
+ {
+@@ -692,52 +813,62 @@
+ list_for_each(lhd, &br2684_devs) {
+ brdev = list_entry_brdev(lhd);
+ if (pos-- == 0)
+- return sprintf(buf, "dev %.16s: num=%d, mac=%02X:%02X:"
+- "%02X:%02X:%02X:%02X (%s)\n", brdev->net_dev.name,
+- brdev->number,
+- brdev->net_dev.dev_addr[0],
+- brdev->net_dev.dev_addr[1],
+- brdev->net_dev.dev_addr[2],
+- brdev->net_dev.dev_addr[3],
+- brdev->net_dev.dev_addr[4],
+- brdev->net_dev.dev_addr[5],
+- brdev->mac_was_set ? "set" : "auto");
++ return sprintf(buf,
++ "dev %.16s: num=%d, mac=%02X:%02X:"
++ "%02X:%02X:%02X:%02X (%s)\n",
++ brdev->net_dev.name, brdev->number,
++ brdev->net_dev.dev_addr[0],
++ brdev->net_dev.dev_addr[1],
++ brdev->net_dev.dev_addr[2],
++ brdev->net_dev.dev_addr[3],
++ brdev->net_dev.dev_addr[4],
++ brdev->net_dev.dev_addr[5],
++ brdev->
++ mac_was_set ? "set" : "auto");
+ list_for_each(lhc, &brdev->brvccs) {
+ brvcc = list_entry_brvcc(lhc);
+ if (pos-- == 0)
+- return sprintf(buf, " vcc %d.%d.%d: encaps=%s"
++ return sprintf(buf,
++ " vcc %d.%d.%d: encaps=%s"
++ ", payload=%s"
+ #ifndef FASTER_VERSION
+- ", failed copies %u/%u"
+-#endif /* FASTER_VERSION */
+- "\n", brvcc->atmvcc->dev->number,
+- brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
+- (brvcc->encaps == e_llc) ? "LLC" : "VC"
++ ", failed copies %u/%u"
++#endif /* FASTER_VERSION */
++ "\n",
++ brvcc->atmvcc->dev->number,
++ brvcc->atmvcc->vpi,
++ brvcc->atmvcc->vci,
++ (brvcc->encaps ==
++ e_llc) ? "LLC" : "VC",
++ (brvcc->payload ==
++ p_bridged) ? "bridged" :
++ "routed"
+ #ifndef FASTER_VERSION
+- , brvcc->copies_failed
+- , brvcc->copies_needed
+-#endif /* FASTER_VERSION */
++ , brvcc->copies_failed,
++ brvcc->copies_needed
++#endif /* FASTER_VERSION */
+ );
+ #ifdef CONFIG_ATM_BR2684_IPFILTER
+ #define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte]
+ #define bs(var) b1(var, 0), b1(var, 1), b1(var, 2), b1(var, 3)
+ if (brvcc->filter.netmask != 0 && pos-- == 0)
+- return sprintf(buf, " filter=%d.%d.%d.%d/"
+- "%d.%d.%d.%d\n", bs(prefix), bs(netmask));
++ return sprintf(buf,
++ " filter=%d.%d.%d.%d/"
++ "%d.%d.%d.%d\n", bs(prefix),
++ bs(netmask));
+ #undef bs
+ #undef b1
+-#endif /* CONFIG_ATM_BR2684_IPFILTER */
++#endif /* CONFIG_ATM_BR2684_IPFILTER */
+ }
+ }
+ return 0;
+ }
+
+ static ssize_t br2684_proc_read(struct file *file, char *buf, size_t count,
+- loff_t *pos)
++ loff_t * pos)
+ {
+ unsigned long page;
+ int len = 0, x, left;
+- loff_t n = *pos;
+-
+ page = get_free_page(GFP_KERNEL);
+ if (!page)
+ return -ENOMEM;
+@@ -746,7 +877,7 @@
+ left = count;
+ read_lock(&devs_lock);
+ for (;;) {
+- x = br2684_proc_engine(n, &((char *) page)[len]);
++ x = br2684_proc_engine(*pos, &((char *) page)[len]);
+ if (x == 0)
+ break;
+ if (x > left)
+@@ -761,12 +892,11 @@
+ }
+ len += x;
+ left -= x;
+- n++;
++ (*pos)++;
+ if (left < 256)
+ break;
+ }
+ read_unlock(&devs_lock);
+- *pos = n;
+ if (len > 0 && copy_to_user(buf, (char *) page, len))
+ len = -EFAULT;
+ free_page(page);
+@@ -774,34 +904,32 @@
+ }
+
+ static struct file_operations br2684_proc_operations = {
+- read: br2684_proc_read,
++ read:br2684_proc_read,
+ };
+
+ extern struct proc_dir_entry *atm_proc_root; /* from proc.c */
+-#endif /* CONFIG_PROC_FS */
++
++extern int (*br2684_ioctl_hook) (struct atm_vcc *, unsigned int,
++ unsigned long);
+
+ /* the following avoids some spurious warnings from the compiler */
+ #define UNUSED __attribute__((unused))
+
+ static int __init UNUSED br2684_init(void)
+ {
+-#ifdef CONFIG_PROC_FS
+ struct proc_dir_entry *p;
+ if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
+ return -ENOMEM;
+ p->proc_fops = &br2684_proc_operations;
+-#endif /* CONFIG_PROC_FS */
+- br2684_ioctl_set(br2684_ioctl);
++ br2684_ioctl_hook = br2684_ioctl;
+ return 0;
+ }
+
+ static void __exit UNUSED br2684_exit(void)
+ {
+ struct br2684_dev *brdev;
+- br2684_ioctl_set(NULL);
+-#ifdef CONFIG_PROC_FS
++ br2684_ioctl_hook = NULL;
+ remove_proc_entry("br2684", atm_proc_root);
+-#endif /* CONFIG_PROC_FS */
+ while (!list_empty(&br2684_devs)) {
+ brdev = list_entry_brdev(br2684_devs.next);
+ unregister_netdev(&brdev->net_dev);
+diff -Nur linux.old/net/atm/common.c linux.new/net/atm/common.c
+--- linux.old/net/atm/common.c 2004-02-18 14:36:32.000000000 +0100
++++ linux.new/net/atm/common.c 2005-11-13 00:46:11.000000000 +0100
+@@ -158,6 +158,7 @@
+ }
+ #ifdef CONFIG_ATM_BR2684_MODULE
+ EXPORT_SYMBOL(br2684_ioctl_set);
++EXPORT_SYMBOL(br2684_ioctl_hook);
+ #endif
+ #endif
+
+diff -Nur linux.old/include/linux/atmbr2684.h linux.new/include/linux/atmbr2684.h
+--- linux.old/include/linux/atmbr2684.h 2005-11-13 00:28:19.000000000 +0100
++++ linux.new/include/linux/atmbr2684.h 2005-11-13 00:06:42.000000000 +0100
+@@ -3,6 +3,7 @@
+
+ #include <linux/atm.h>
+ #include <linux/if.h> /* For IFNAMSIZ */
++#include <linux/if_ether.h> /* ETH_P_* */
+
+ /*
+ * Type of media we're bridging (ethernet, token ring, etc) Currently only
+@@ -36,15 +37,24 @@
+ #define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
+
+ /*
++ * Is this VC bridged or routed?
++ */
++
++#define BR2684_PAYLOAD_ROUTED (0)
++#define BR2684_PAYLOAD_BRIDGED (1)
++
++
++/*
+ * This is for the ATM_NEWBACKENDIF call - these are like socket families:
+ * the first element of the structure is the backend number and the rest
+ * is per-backend specific
+ */
+ struct atm_newif_br2684 {
+- atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
+- int media; /* BR2684_MEDIA_* */
+- char ifname[IFNAMSIZ];
+- int mtu;
++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
++ int media; /* BR2684_MEDIA_* */
++ char ifname[IFNAMSIZ];
++ int mtu;
++ int payload; /* bridged or routed */
+ };
+
+ /*
+@@ -68,16 +78,17 @@
+ * is per-backend specific
+ */
+ struct atm_backend_br2684 {
+- atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
+ struct br2684_if_spec ifspec;
+- int fcs_in; /* BR2684_FCSIN_* */
+- int fcs_out; /* BR2684_FCSOUT_* */
+- int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
+- int encaps; /* BR2684_ENCAPS_* */
+- int has_vpiid; /* 1: use vpn_id - Unsupported */
+- __u8 vpn_id[7];
+- int send_padding; /* unsupported */
+- int min_size; /* we will pad smaller packets than this */
++ int fcs_in; /* BR2684_FCSIN_* */
++ int fcs_out; /* BR2684_FCSOUT_* */
++ int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
++ int encaps; /* BR2684_ENCAPS_* */
++ int payload; /* BR2684_PAYLOAD_* */
++ int has_vpiid; /* 1: use vpn_id - Unsupported */
++ __u8 vpn_id[7];
++ int send_padding; /* unsupported */
++ int min_size; /* we will pad smaller packets than this */
+ };
+
+ /*
+@@ -95,7 +106,12 @@
+ struct br2684_filter filter;
+ };
+
++enum br2684_payload {
++ p_routed = BR2684_PAYLOAD_ROUTED,
++ p_bridged = BR2684_PAYLOAD_BRIDGED,
++};
++
+ #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
+ struct br2684_filter_set)
+
+-#endif /* _LINUX_ATMBR2684_H */
++#endif /* _LINUX_ATMBR2684_H */
diff --git a/target/linux/image/ar7/Makefile b/target/linux/image/ar7/Makefile
index f5ad6cc66..0b7378785 100644
--- a/target/linux/image/ar7/Makefile
+++ b/target/linux/image/ar7/Makefile
@@ -27,6 +27,15 @@ $(PKG_BUILD_DIR)/ld.script: src/ld.script.in
sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
-e 's/@@LOADADDR@@/$(LOADADDR)/' <$< >$@
+$(PKG_BUILD_DIR)/cksum.o: $(PKG_BUILD_DIR)/cksum.c
+ $(HOSTCC) -o $@ $<
+
+$(PKG_BUILD_DIR)/ckmain.o: $(PKG_BUILD_DIR)/ckmain.c
+ $(HOSTCC) -o $@ $<
+
+$(PKG_BUILD_DIR)/tichksum: $(PKG_BUILD_DIR)/ckmain.o $(PKG_BUILD_DIR)/cksum.o
+ $(HOSTCC) -o $@ $<
+
$(PKG_BUILD_DIR)/LzmaDecode.o: src/LzmaDecode.c
$(TARGET_CC) $(CFLAGS) -c -o $@ $<