Netdev List
 help / color / mirror / Atom feed
* Re: recommended way to support duplicate IP addresses on different VLANs?
From: Ben Greear @ 2011-07-11 15:56 UTC (permalink / raw)
  To: Chris Friesen; +Cc: Rémi Denis-Courmont, Chris Friesen, netdev
In-Reply-To: <4E1B1B33.5060300@genband.com>

On 07/11/2011 08:48 AM, Chris Friesen wrote:
> On 07/11/2011 09:04 AM, Rémi Denis-Courmont wrote:
>> Le lundi 11 juillet 2011 17:58:14 Chris Friesen, vous avez écrit :
>>> Hi all,
>>>
>>> We've got a server that sits on multiple VLANs. Each VLAN is segregated
>>> and doesn't know about the others. The IP address ranges in each of the
>>> VLANs may overlap, and the server may be assigned the same IP address in
>>> multiple VLANs.
>
>>> Is there any other way to deal with this scenario?
>
>
>> Or then binding sockets to devices (SO_BINDTODEVICE) might work.
>
> Hmm...SO_BINDTODEVICE looks interesting. I would imagine we'd still need
> to do some funky stuff around ARP handling.

arp_filter should help.

Also, you may want to use conn-trck tables.  This lets packets coming
in one or more interfaces use a specific conn-track cache.  Might help
keep the identical IPs from colliding in their conn tracking.

iptables -t raw -A PREROUTING -i eth0.7 -j CT --zone 7

Thanks,
Ben

>
> Chris
>
>
>


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* Re: [LTP] Update for CAN LTP tests
From: Cyril Hrubis @ 2011-07-11 16:15 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: Subrata Modak, ltp-list, socketcan-users, Oliver Hartkopp,
	Wolfgang Grandegger, netdev
In-Reply-To: <4E19987B.2030507@hartkopp.net>

Hi!
> > Would you also like to send a patch to update the testcases for CAN in LTP
> > (http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/network/can/filter-tests/) ?
> > These tests were originally picked up from:
> > http://svn.berlios.de/wsvn/socketcan/trunk/test/?rev=877&amp;sc=1
> 
> Dear Subrata,
> 
> attached you'll find a major update for the LTP tests dealing with CAN filters
> and the CAN frame flow down to the CAN netdevice and vice versa.
> 
> The patch removes all the obsolete stuff from the source code directory you
> originally picked the tests from. I added two new tools that also reside on
> the referenced SVN:
> 
> tst-filter: New filter test tool in *one* programm (easy to use & handle)
> tst-rcv-own-msgs: Checks the CAN frame flow inside the networking stack
> 
> Additionally the virtual CAN driver needs to be loaded with a special
> commandline option to perform the CAN frame flow test correctly.
> 
> The tests & the scripts are much clearer to me now. If it meets your
> requirements consider to apply this patch to the LTP repository.

Could you pretty please create signed patch(es) (git could create them
for you) so we could commit them into LTP repository.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply

* "tm->when" at /proc/net/tcp shows some negative numbers.
From: Andreas O @ 2011-07-11 16:47 UTC (permalink / raw)
  To: netdev

Dear devnet list,

I am doing some performance improvements on  linux-2.6.33.15 with
real-time support. When my tests fails I observe that "tm->when" at
/proc/net/tcp shows
some negative numbers. That negative number is the difference  of
"timer_expires - jeffies" and in this case timer_expires is smaller
than jiffies.
Does this negative number indicates a bug in the stack?


from /proc/net/tcp

  sl  local_address rem_address   st tx_queue rx_queue tr tm->when
retrnsmt   uid  timeout inode

   0: 0100007F:09A4 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 11905 1 ffff88057b9df9c0 300 0 0 2 -1
   1: 00000000:1BC7 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 14746 1 ffff880579bfac80 300 0 0 2 -1
   2: 0100007F:00C7 00000000:0000 0A 00000000:00000000 00:00000000
00000000     0        0 11734 1 ffff88097a7980c0 300 0 0 2 -1
   3: 00000000:078F 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 14733 1 ffff880974e9acc0 300 0 0 2 -1
   4: 00000000:2710 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 14748 1 ffff88097385e740 300 0 0 2 -1
   5: 00000000:0050 00000000:0000 0A 00000000:00000000 02:0000000E
00000000   499        0 14732 2 ffff88097933d980 300 0 0 2 -1
   6: 14041AAC:0050 FE081AAC:93FD 03 00000000:00000000
01:FFFFFFFFFFFFFFE2 00000000   499        0 0 2 ffff8804dc549dc0
   7: 14041AAC:0050 FA081AAC:B0E0 03 00000000:00000000
01:FFFFFFFFFFFFFFE2 00000000   499        0 0 2 ffff880524d79e40
   8: 14041AAC:0050 F2011AAC:E53F 03 00000000:00000000
01:FFFFFFFFFFFFFFE4 00000000   499        0 0 2 ffff880524d7ccc0
   9: 14041AAC:0050 F2011AAC:C73F 03 00000000:00000000
01:FFFFFFFFFFFFFFE5 00000000   499        0 0 2 ffff880524d5ba40
  10: 14041AAC:0050 FB011AAC:D89A 03 00000000:00000000
01:FFFFFFFFFFFFFFE1 00000000   499        0 0 2 ffff8804a9290b40
  11: 14041AAC:0050 F2011AAC:C9CD 03 00000000:00000000
01:FFFFFFFFFFFFFFE4 00000000   499        0 0 2 ffff8804e6c9af40
  12: 14041AAC:0050 FE081AAC:8EC9 03 00000000:00000000
01:FFFFFFFFFFFFFFE2 00000000   499        0 0 2 ffff8804dc59d940
  13: 14041AAC:0050 FE081AAC:E7C0 03 00000000:00000000
01:FFFFFFFFFFFFFFE2 00000000   499        0 0 2 ffff8804dc798840

  sl  local_address rem_address   st tx_queue rx_queue tr tm->when
retrnsmt   uid  timeout inode
   0: 0100007F:09A4 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 11905 1 ffff88057b9df9c0 300 0 0 2 -1
   1: 00000000:1BC7 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 14746 1 ffff880579bfac80 300 0 0 2 -1
   2: 0100007F:00C7 00000000:0000 0A 00000000:00000000 00:00000000
00000000     0        0 11734 1 ffff88097a7980c0 300 0 0 2 -1
   3: 00000000:078F 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 14733 1 ffff880974e9acc0 300 0 0 2 -1
   4: 00000000:2710 00000000:0000 0A 00000000:00000000 00:00000000
00000000   499        0 14748 1 ffff88097385e740 300 0 0 2 -1
   5: 00000000:0050 00000000:0000 0A 00000000:00000000 02:00000009
00000000   499        0 14732 2 ffff88097933d980 300 0 0 2 -1
   6: 14041AAC:0050 FE081AAC:93FD 03 00000000:00000000
01:FFFFFFFFFFFFFFB5 00000000   499        0 0 2 ffff8804dc549dc0
   7: 14041AAC:0050 FA081AAC:B0E0 03 00000000:00000000
01:FFFFFFFFFFFFFFB5 00000000   499        0 0 2 ffff880524d79e40
   8: 14041AAC:0050 F2011AAC:E53F 03 00000000:00000000
01:FFFFFFFFFFFFFFB7 00000000   499        0 0 2 ffff880524d7ccc0
   9: 14041AAC:0050 F2011AAC:C73F 03 00000000:00000000
01:FFFFFFFFFFFFFFB8 00000000   499        0 0 2 ffff880524d5ba40
  10: 14041AAC:0050 FB011AAC:D89A 03 00000000:00000000
01:FFFFFFFFFFFFFFB4 00000000   499        0 0 2 ffff8804a9290b40
  11: 14041AAC:0050 F2011AAC:C9CD 03 00000000:00000000
01:FFFFFFFFFFFFFFB7 00000000   499        0 0 2 ffff8804e6c9af40
  12: 14041AAC:0050 FE081AAC:8EC9 03 00000000:00000000
01:FFFFFFFFFFFFFFB5 00000000   499        0 0 2 ffff8804dc59d940
  13: 14041AAC:0050 F2081AAC:E7BF 03 00000000:00000000
01:FFFFFFFFFFFFFFB7 00000000   499        0 0 2 ffff8804ce339c40


Any ideas?

Kind regards
Andreas

^ permalink raw reply

* Re: [PATCH] iproute2: fix minor typo in comments
From: Stephen Hemminger @ 2011-07-11 17:12 UTC (permalink / raw)
  To: Gilles Espinasse; +Cc: netdev
In-Reply-To: <1310312737-2296-1-git-send-email-g.esp@free.fr>

Applied

^ permalink raw reply

* Re: [PATCH] iproute2: Remove unreachable code
From: Stephen Hemminger @ 2011-07-11 17:19 UTC (permalink / raw)
  To: Petr Sabata; +Cc: netdev
In-Reply-To: <1307711947-586-1-git-send-email-contyk@redhat.com>

On Fri, 10 Jun 2011 15:19:07 +0200
Petr Sabata <contyk@redhat.com> wrote:

> This patch removes unreachable, useless code.
> 
> Signed-off-by: Petr Sabata <contyk@redhat.com>

Applied

^ permalink raw reply

* Re: [PATCH iproute2] xfrm: Update documentation
From: Stephen Hemminger @ 2011-07-11 17:19 UTC (permalink / raw)
  To: David Ward; +Cc: netdev
In-Reply-To: <201106120405.p5C44N7I010008@outgoing.mit.edu>

On Sat, 11 Jun 2011 22:13:30 -0400
David Ward <david.ward@ll.mit.edu> wrote:

> The ip(8) man page and the "ip xfrm [ XFRM-OBJECT ] help" command output
> are updated to include missing options, fix errors, and improve grammar.
> There are no functional changes made.
> 
> The documentation for the ip command has many different meanings for the
> same formatting symbols (which really needs to be fixed). This patch makes
> consistent use of brackets [ ] to indicate optional parameters, pipes | to
> mean "OR", braces { } to group things together, and dashes - instead of
> underscores _ inside of parameter names. The parameters are listed in the
> order in which they are parsed in the source code.
> 
> There are several parameters and options that are still not mentioned or
> need to be described more thoroughly in the "COMMAND SYNTAX" section of
> the ip(8) man page. I would appreciate help from the developers with this.
> 
> Signed-off-by: David Ward <david.ward@ll.mit.edu>

Applied

^ permalink raw reply

* Re: "tm->when" at /proc/net/tcp shows some negative numbers.
From: Eric Dumazet @ 2011-07-11 17:28 UTC (permalink / raw)
  To: Andreas O; +Cc: netdev
In-Reply-To: <CAAVaN8wcu+=p9sD76s7m3=M6hqPScOsq3WPJmAN5TBp4fAoLGQ@mail.gmail.com>

Le lundi 11 juillet 2011 à 17:47 +0100, Andreas O a écrit :
> Dear devnet list,
> 
> I am doing some performance improvements on  linux-2.6.33.15 with
> real-time support. When my tests fails I observe that "tm->when" at
> /proc/net/tcp shows
> some negative numbers. That negative number is the difference  of
> "timer_expires - jeffies" and in this case timer_expires is smaller
> than jiffies.
> Does this negative number indicates a bug in the stack?
> 
> 

Not necessarly.

If the thread handling timers is delayed (because of other more urgent
RT things), the delay between timer is fired and handled could be long.



^ permalink raw reply

* CAN: major update for the Controller Area Network LTP tests
From: Oliver Hartkopp @ 2011-07-11 17:32 UTC (permalink / raw)
  To: Cyril Hrubis
  Cc: Subrata Modak, ltp-list, socketcan-users, Oliver Hartkopp,
	Wolfgang Grandegger, netdev
In-Reply-To: <20110711161513.GB31575@saboteur.suse.cz>

CAN: major update for the Controller Area Network LTP tests

This update for the LTP tests are dealing with CAN filters and the
CAN frame flow down to the CAN netdevice and vice versa.

The patch removes all the obsolete stuff from the source code directory
that has been originally used to pick the tests from. The two new tools
also reside in the SocketCAN SVN svn://svn.berlios.de/socketcan/trunk/test

tst-filter: New filter test tool in *one* programm (easy to use & handle)
tst-rcv-own-msgs: Checks the CAN frame flow inside the networking stack

Additionally the virtual CAN driver needs to be loaded with a special
commandline option to perform the CAN frame flow test correctly.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

---

diff --git a/testcases/network/can/filter-tests/Makefile b/testcases/network/can/filter-tests/Makefile
index 192c3b0..c88f704 100644
--- a/testcases/network/can/filter-tests/Makefile
+++ b/testcases/network/can/filter-tests/Makefile
@@ -1,43 +1,6 @@
 #
 #  $Id: Makefile,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
 #
-#  Copyright (c) 2002-2007 Volkswagen Group Electronic Research
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions
-#  are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions, the following disclaimer and
-#     the referenced file 'COPYING'.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of Volkswagen nor the names of its contributors
-#     may be used to endorse or promote products derived from this software
-#     without specific prior written permission.
-#
-#  Alternatively, provided that this notice is retained in full, this
-#  software may be distributed under the terms of the GNU General
-#  Public License ("GPL") version 2 as distributed in the 'COPYING'
-#  file from the main directory of the linux kernel source.
-#
-#  The provided data structures and external interfaces from this code
-#  are not restricted to be used by modules with a GPL compatible license.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-#  DAMAGE.
-#
 #  Send feedback to <socketcan-users@lists.berlios.de>
 
 CFLAGS    = -O2 -Wall -Wno-parentheses \
@@ -46,25 +9,7 @@ CFLAGS    = -O2 -Wall -Wno-parentheses \
 	-DPF_CAN=29 \
 	-DAF_CAN=PF_CAN
 
-PROGRAMS =      tst-raw           \
-                tst-raw-filter    \
-                tst-err           \
-                tst-raw-sendto    \
-                tst-packet        \
-                tst-filter-master \
-                tst-filter-server \
-                tst-bcm-cycle     \
-                tst-bcm-server    \
-                tst-bcm-tx_read   \
-                tst-bcm-rtr       \
-                tst-bcm-single    \
-                tst-bcm-filter    \
-                tst-bcm-throttle  \
-                tst-bcm-rx-sendto \
-                tst-bcm-tx-sendto \
-                tst-bcm-dump      \
-                tst-proc          \
-                canecho
+PROGRAMS =      tst-filter tst-rcv-own-msgs
 
 all: $(PROGRAMS)
 
@@ -72,8 +17,8 @@ install:
 	cp -f $(PROGRAMS) /usr/local/bin
 
 clean:
-	rm -f $(PROGRAMS) output_ltp-can.txt output_ltp-can-verify.txt /etc/modprobe.d/vcan
+	rm -f $(PROGRAMS)
 
 distclean:
-	rm -f $(PROGRAMS) *~ output_ltp-can.txt output_ltp-can-verify.txt /etc/modprobe.d/vcan
+	rm -f $(PROGRAMS) *~
 
diff --git a/testcases/network/can/filter-tests/canecho.c b/testcases/network/can/filter-tests/canecho.c
deleted file mode 100644
index e87f063..0000000
--- a/testcases/network/can/filter-tests/canecho.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- *  $Id: canecho.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * canecho.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <libgen.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-
-extern int optind, opterr, optopt;
-
-static int      s = -1;
-static int      running = 1;
-
-void print_usage(char *prg)
-{
-        fprintf(stderr, "Usage: %s [can-interface]\n", prg);
-}
-
-void sigterm(int signo)
-{
-        printf("got signal %d\n", signo);
-        running = 0;
-}
-
-int main(int argc, char **argv)
-{
-        int family = PF_CAN, type = SOCK_RAW, proto = CAN_RAW;
-        int opt;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-        struct can_frame frame;
-        int nbytes, i;
-        int verbose = 0;
-
-        signal(SIGTERM, sigterm);
-        signal(SIGHUP, sigterm);
-
-        while ((opt = getopt(argc, argv, "f:t:p:v")) != -1) {
-                switch (opt) {
-                case 'f':
-                        family = atoi(optarg);
-                        break;
-
-                case 't':
-                        type = atoi(optarg);
-                        break;
-
-                case 'p':
-                        proto = atoi(optarg);
-                        break;
-
-                case 'v':
-                        verbose = 1;
-                        break;
-
-                case '?':
-                        break;
-
-                default:
-                        fprintf(stderr, "Unknown option %c\n", opt);
-                        break;
-                }
-        }
-
-        if (optind == argc) {
-                print_usage(basename(argv[0]));
-                exit(0);
-        }
-
-        printf("interface = %s, family = %d, type = %d, proto = %d\n",
-               argv[optind], family, type, proto);
-        if ((s = socket(family, type, proto)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = family;
-        strcpy(ifr.ifr_name, argv[optind]);
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        while (running) {
-                if ((nbytes = read(s, &frame, sizeof(frame))) < 0) {
-                        perror("read");
-                        return 1;
-                }
-                if (verbose) {
-                        printf("%03X: ", frame.can_id & CAN_EFF_MASK);
-                        if (frame.can_id & CAN_RTR_FLAG) {
-                                printf("remote request");
-                        } else {
-                                printf("[%d]", frame.can_dlc);
-                                for (i = 0; i < frame.can_dlc; i++) {
-                                        printf(" %02X", frame.data[i]);
-                                }
-                        }
-                        printf("\n");
-                }
-                frame.can_id++;
-                write(s, &frame, sizeof(frame));
-        }
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/run_ltp-can_tests.sh b/testcases/network/can/filter-tests/run_ltp-can_tests.sh
index 6d7aafc..8070c9a 100644
--- a/testcases/network/can/filter-tests/run_ltp-can_tests.sh
+++ b/testcases/network/can/filter-tests/run_ltp-can_tests.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 ################################################################################
-## Copyright (c) Oliver Hartkopp <oliver.hartkopp@volkswagen.de>, 2009        ##
+## Copyright (c) Oliver Hartkopp <oliver.hartkopp@volkswagen.de>, 2011        ##
 ## Copyright (c) International Business Machines  Corp., 2009                 ##
 ##                                                                            ##
 ## This program is free software;  you can redistribute it and#or modify      ##
@@ -24,25 +24,34 @@ if [ $(id -ru) -ne 0 ]; then
      exit 1
 fi
 
-cat <<-EOF > /etc/modprobe.d/vcan
-# protocol family PF_CAN
-alias net-pf-29 can
-# protocols in PF_CAN
-alias can-proto-1 can-raw
-alias can-proto-2 can-bcm
-alias can-proto-3 can-tp16
-alias can-proto-4 can-tp20
-alias can-proto-5 can-mcnet
-alias can-proto-6 can-isotp
-EOF
-
+# load needed CAN networklayer modules
 modprobe -f can
 modprobe -f can_raw
-modprobe -f vcan
-ip link add dev vcan0 type vcan
-ifconfig vcan0 up
 
-./tst-filter-server > output_ltp-can.txt &
-./tst-filter-master | tee output_ltp-can-verify.txt
+# ensure the vcan driver to perform the ECHO on driver level
+modprobe -r vcan
+modprobe -f vcan echo=1
+
+VCAN=vcan0
+
+# create virtual CAN device
+ip link add dev $VCAN type vcan || exit 1
+ifconfig $VCAN up
+
+# check precondition for CAN frame flow test
+HAS_ECHO=`ip link show $VCAN | grep -c ECHO`
+
+if [ $HAS_ECHO -ne 1 ]
+then
+    exit 1
+fi
+
+# test of CAN filters on af_can.c 
+./tst-filter $VCAN || exit 1
+
+# test of CAN frame flow down to the netdevice and up again
+./tst-rcv-own-msgs $VCAN || exit 1
+
+exit 0
 
 
diff --git a/testcases/network/can/filter-tests/tst-bcm-cycle.c b/testcases/network/can/filter-tests/tst-bcm-cycle.c
deleted file mode 100644
index 7f4c8ac..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-cycle.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *  $Id: tst-bcm-cycle.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-cycle.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-#define U64_DATA(p) (*(unsigned long long*)(p)->data)
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame[4];
-        } msg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        msg.msg_head.opcode  = TX_SETUP;
-        msg.msg_head.can_id  = 0x42;
-        msg.msg_head.flags   = SETTIMER|STARTTIMER;
-        msg.msg_head.nframes = 1;
-        msg.msg_head.count = 10;
-        msg.msg_head.ival1.tv_sec = 1;
-        msg.msg_head.ival1.tv_usec = 0;
-        msg.msg_head.ival2.tv_sec = 0;
-        msg.msg_head.ival2.tv_usec = 0;
-        msg.frame[0].can_id    = 0x42;
-        msg.frame[0].can_dlc   = 8;
-        U64_DATA(&msg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        if (write(s, &msg, sizeof(msg)) < 0)
-                perror("write");
-
-        printf("Press any key to stop the cycle ...\n");
-
-        getchar();
-
-        msg.msg_head.opcode  = TX_SETUP;
-        msg.msg_head.can_id  = 0x42;
-        msg.msg_head.flags   = SETTIMER|STARTTIMER;
-        msg.msg_head.nframes = 1;
-        msg.msg_head.count = 0;
-        msg.msg_head.ival1.tv_sec = 0;
-        msg.msg_head.ival1.tv_usec = 0;
-        msg.msg_head.ival2.tv_sec = 0;
-        msg.msg_head.ival2.tv_usec = 0;
-        msg.frame[0].can_id    = 0x42;
-        msg.frame[0].can_dlc   = 8;
-        U64_DATA(&msg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        if (write(s, &msg, sizeof(msg)) < 0)
-                perror("write");
-
-        printf("Press any key to close the socket ...\n");
-
-        getchar();
-
-        close(s);
-
-        printf("Press any key to end the program ...\n");
-
-        getchar();
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-dump.c b/testcases/network/can/filter-tests/tst-bcm-dump.c
deleted file mode 100644
index 5004d3a..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-dump.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- *  $Id: tst-bcm-dump.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-dump.c
- *
- * Copyright (c) 2008 Oliver Hartkopp
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the version 2 of the GNU General Public License
- * as published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <time.h>
-#include <libgen.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-#define DEFAULT_IFACE "vcan0"
-#define DEFAULT_CANID 0x42
-
-void print_usage(char *prg)
-{
-        fprintf(stderr, "\nUsage: %s [options]\n", prg);
-        fprintf(stderr, "Options: -i <interface> (CAN interface. Default: '%s')\n", DEFAULT_IFACE);
-        fprintf(stderr, "         -c <can_id>    (used CAN ID. Default: 0x%03X)\n", DEFAULT_CANID);
-        fprintf(stderr, "         -o <timeout>   (Timeout value in nsecs. Default: 0)\n");
-        fprintf(stderr, "         -t <throttle>  (Throttle value in nsecs. Default: 0)\n");
-        fprintf(stderr, "         -q <msgs>      (Quit after receiption of #msgs)\n");
-        fprintf(stderr, "         -s             (set STARTTIMER flag. Default: off)\n");
-        fprintf(stderr, "\n");
-}
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        int nbytes;
-        int i;
-        struct ifreq ifr;
-        char *ifname = DEFAULT_IFACE;
-        canid_t canid = DEFAULT_CANID;
-        int opt;
-        struct timeval tv;
-        unsigned long starttimer = 0;
-        unsigned long long timeout = 0;
-        unsigned long long throttle = 0;
-        unsigned long msgs = 0;
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame;
-        } msg;
-
-        while ((opt = getopt(argc, argv, "i:c:o:t:q:s")) != -1) {
-                switch (opt) {
-
-                case 'i':
-                        ifname = optarg;
-                        break;
-
-                case 'c':
-                        canid = strtoul(optarg, (char **)NULL, 16);
-                        break;
-
-                case 'o':
-                        timeout = strtoull(optarg, (char **)NULL, 10);
-                        break;
-
-                case 't':
-                        throttle = strtoull(optarg, (char **)NULL, 10);
-                        break;
-
-                case 'q':
-                        msgs = strtoul(optarg, (char **)NULL, 10);
-                        break;
-
-                case 's':
-                        starttimer = STARTTIMER;
-                        break;
-
-                case '?':
-                default:
-                        print_usage(basename(argv[0]));
-                        exit(1);
-                        break;
-                }
-        }
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        if (strcmp(ifname, "any") == 0)
-                addr.can_ifindex = 0;
-        else {
-                strcpy(ifr.ifr_name, ifname);
-                if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
-                        perror("SIOCGIFINDEX");
-                        return 1;
-                }
-                addr.can_ifindex = ifr.ifr_ifindex;
-        }
-
-        addr.can_family = PF_CAN;
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        msg.msg_head.opcode             = RX_SETUP;
-        msg.msg_head.can_id             = canid;
-        msg.msg_head.flags              = SETTIMER|RX_FILTER_ID|starttimer;
-        msg.msg_head.ival1.tv_sec       = timeout / 1000000;
-        msg.msg_head.ival1.tv_usec      = timeout % 1000000;
-        msg.msg_head.ival2.tv_sec       = throttle / 1000000;
-        msg.msg_head.ival2.tv_usec      = throttle % 1000000;
-        msg.msg_head.nframes    = 0;
-
-        gettimeofday(&tv, NULL);
-        printf("[%ld.%06ld] ", tv.tv_sec, tv.tv_usec);
-        printf("Writing RX_SETUP with RX_FILTER_ID for can_id <%03X>\n",
-               msg.msg_head.can_id);
-
-        if (write(s, &msg, sizeof(msg)) < 0)
-                perror("write");
-
-        while (1) {
-
-                nbytes = read(s, &msg, sizeof(msg));
-                if (nbytes < 0) {
-                        perror("read");
-                        return 1;
-                }
-                gettimeofday(&tv, NULL);
-                printf("[%ld.%06ld] ", tv.tv_sec, tv.tv_usec);
-
-                if (nbytes == sizeof(msg)) {
-
-                        if (ioctl(s, SIOCGSTAMP, &tv) < 0)
-                                perror("SIOCGSTAMP");
-                        else
-                                printf("(%ld.%06ld) ", tv.tv_sec, tv.tv_usec);
-
-                        if (msg.msg_head.opcode != RX_CHANGED) {
-                                printf("missing RX_CHANGED.\n");
-                                return 1;
-                        }
-
-                        printf("RX_CHANGED ");
-
-                        for (i=0; i < msg.frame.can_dlc; i++)
-                                printf("%02X ", msg.frame.data[i]);
-
-                } else {
-
-                        if (msg.msg_head.opcode != RX_TIMEOUT) {
-                                printf("missing RX_TIMEOUT.\n");
-                                return 1;
-                        }
-
-                        printf("RX_TIMEOUT");
-                }
-
-                printf("\n");
-                fflush(stdout);
-
-                if (msgs && !(--msgs))
-                        break;
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-filter.c b/testcases/network/can/filter-tests/tst-bcm-filter.c
deleted file mode 100644
index 873e871..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-filter.c
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- *  $Id: tst-bcm-filter.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-filter.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-#define U64_DATA(p) (*(unsigned long long*)(p)->data)
-
-int main(int argc, char **argv)
-{
-        int s,nbytes;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct timeval tv;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame[4];
-        } txmsg, rxmsg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x042;
-        txmsg.msg_head.flags   = SETTIMER|RX_FILTER_ID;
-        txmsg.msg_head.ival1.tv_sec = 1;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 0;
-
-        printf("<*>Writing RX_SETUP with RX_FILTER_ID for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        /* test for RX_DELETE */
-        txmsg.msg_head.opcode  = RX_DELETE;
-        txmsg.msg_head.can_id  = 0x042; /* everything we need for RX_DELETE */
-
-        printf("<*>Writing RX_DELETE for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x042;
-        txmsg.msg_head.flags   = SETTIMER|RX_FILTER_ID;
-        txmsg.msg_head.ival1.tv_sec = 1;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 0;
-
-        printf("<*>Writing RX_SETUP with RX_FILTER_ID for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        /* obsolete for TX_SEND ... */
-#if 0
-        txmsg.msg_head.can_id  = 0x43;
-        txmsg.msg_head.flags   = SETTIMER|STARTTIMER|TX_CP_CAN_ID;
-        txmsg.msg_head.count = 0;
-        txmsg.msg_head.ival1.tv_sec = 0;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-#endif
-        txmsg.frame[0].can_id    = 0x43;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<2>Writing TX_SEND with wrong can_id <%03X>\n",
-               txmsg.frame[0].can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<3>Writing TX_SEND with correct can_id <%03X>\n",
-               txmsg.frame[0].can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<3>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        /* growing number of nframes => RX_DELETE instead of simple update */
-        txmsg.msg_head.opcode  = RX_DELETE;
-        txmsg.msg_head.can_id  = 0x042; /* everything we need for RX_DELETE */
-
-        printf("<*>Writing RX_DELETE for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x042;
-        txmsg.msg_head.flags   = SETTIMER|RX_CHECK_DLC;
-        txmsg.msg_head.ival1.tv_sec = 1;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 1;
-        /* txmsg.frame[0].can_dlc   = 8; obsolete for RX_SETUP */
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xFF00000000000000ULL;
-
-        printf("<*>Writing simple RX_SETUP for can_id <%03X> with msgbits 0x%016llX\n",
-               txmsg.msg_head.can_id, U64_DATA(&txmsg.frame[0]));
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<5>Writing TX_SEND with correct can_id <%03X>\n",
-               txmsg.frame[0].can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<5>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<6>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("no changed data\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        /* no change here */
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<7>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("changed relevant msgbits\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<7>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<8>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("changed irrelevant msgbits\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 7;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<9>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("changed Data Length Code DLC\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<9>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = RX_DELETE;
-        txmsg.msg_head.can_id  = 0x042; /* everything we need for RX_DELETE */
-
-        printf("<*>Writing RX_DELETE for can_id <%03X> for RX_SETUP with growing nframes\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        /* no problems ;-) but NOW we try MUX messages ... and timeouts */
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x042;
-        txmsg.msg_head.flags   = SETTIMER|RX_CHECK_DLC;
-        txmsg.msg_head.ival1.tv_sec = 1;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.nframes = 3;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xFF00000000000000ULL;
-        U64_DATA(&txmsg.frame[1]) = (__u64) 0x01000000000000FFULL;
-        U64_DATA(&txmsg.frame[2]) = (__u64) 0x02000000000000FFULL;
-
-        printf("<*>Writing multiplex RX_SETUP for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x4200000000000000ULL;
-
-        printf("<A>Writing TX_SEND with wrong MUX ID 42\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100000000000000ULL;
-
-        printf("<B>Writing TX_SEND with correct MUX ID 01\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<B>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100000000000000ULL;
-
-        printf("<C>Writing TX_SEND with correct MUX ID 01 but no data change\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100001234567800ULL;
-
-        printf("<D>Writing TX_SEND with correct MUX ID 01 but no relevant data change\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100001234567801ULL;
-
-        printf("<E>Writing TX_SEND with correct MUX ID 01 with relevant data change\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<E>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0200000000000000ULL;
-
-        printf("<F>Writing TX_SEND with correct MUX ID 02\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<F>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0200000000000001ULL;
-
-        printf("<10>Writing TX_SEND with correct MUX ID 02 with relevant data change\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<10>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 7;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0200000000000001ULL;
-
-        printf("<11>Writing TX_SEND with correct MUX ID 02 no data change but DLC\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<11>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 7;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0300000000000001ULL;
-
-        printf("<12>Writing TX_SEND with wrong MUX ID 03\n");
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        ioctl(s, SIOCGSTAMP, &tv);
-        printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-        if (rxmsg.msg_head.opcode == RX_TIMEOUT &&
-            nbytes == sizeof(struct bcm_msg_head) &&
-            rxmsg.msg_head.can_id == 0x42) {
-                printf("<-->Received correct RX_TIMEOUT message for can_id <%03X> >> OK!\n",
-                       rxmsg.msg_head.can_id);
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-rtr.c b/testcases/network/can/filter-tests/tst-bcm-rtr.c
deleted file mode 100644
index 955864d..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-rtr.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *  $Id: tst-bcm-rtr.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-rtr.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-#define RTR_SETUP
-
-int main(int argc, char **argv)
-{
-        int s,nbytes;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct timeval tv;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame;
-        } txmsg, rxmsg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-#ifdef RTR_SETUP
-        /* specify CAN-Frame to send as reply to a RTR-request */
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x359 | CAN_RTR_FLAG;
-        txmsg.msg_head.flags   = RX_RTR_FRAME; /* | TX_CP_CAN_ID */;
-        txmsg.msg_head.ival1.tv_sec = 0; /* no timers in RTR-mode */
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 1; /* exact 1 */
-
-        /* the frame to send as reply ... */
-        txmsg.frame.can_id = 0x359; /* 'should' be the same */
-        txmsg.frame.can_dlc = 3;
-        txmsg.frame.data[0] = 0x12;
-        txmsg.frame.data[1] = 0x34;
-        txmsg.frame.data[2] = 0x56;
-
-#else
-        /* normal receiption of RTR-frames in Userspace */
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x359 | CAN_RTR_FLAG;
-        txmsg.msg_head.flags   = RX_FILTER_ID;
-        txmsg.msg_head.ival1.tv_sec = 0;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 0;
-#endif
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        while (1) {
-
-                if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                        perror("read");
-
-                ioctl(s, SIOCGSTAMP, &tv);
-                printf("(%ld.%06ld)   ", tv.tv_sec, tv.tv_usec);
-
-                if (rxmsg.msg_head.opcode == RX_CHANGED &&
-                    nbytes == sizeof(struct bcm_msg_head) + sizeof(struct can_frame) &&
-                    (rxmsg.msg_head.can_id & CAN_SFF_MASK) == 0x359 &&
-                    (rxmsg.frame.can_id & CAN_SFF_MASK) == 0x359) {
-                        printf("RX_CHANGED message for can_id <%03X> RTR = %d\n",
-                               rxmsg.frame.can_id, (rxmsg.frame.can_id & CAN_RTR_FLAG)?1:0);
-                }
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-rx-sendto.c b/testcases/network/can/filter-tests/tst-bcm-rx-sendto.c
deleted file mode 100644
index 7d3dcaf..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-rx-sendto.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *  $Id: tst-bcm-rx-sendto.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-rx-sendto.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-int main(int argc, char **argv)
-{
-        int s,nbytes;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct timeval tv;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame;
-        } txmsg, rxmsg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        addr.can_ifindex = 0; /* bind to 'any' device */
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        memset(&txmsg, 0, sizeof(txmsg)); /* clear timers, nframes, etc. */
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x123;
-        txmsg.msg_head.flags   = RX_FILTER_ID;
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x321;
-        txmsg.msg_head.flags   = RX_FILTER_ID;
-
-        if (sendto(s, &txmsg, sizeof(txmsg), 0, (struct sockaddr*)&addr, sizeof(addr)) < 0)
-                perror("sendto");
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan1");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x424;
-        txmsg.msg_head.flags   = RX_FILTER_ID;
-
-        if (sendto(s, &txmsg, sizeof(txmsg), 0, (struct sockaddr*)&addr, sizeof(addr)) < 0)
-                perror("sendto");
-
-        while (1) {
-                socklen_t len = sizeof(addr);
-                nbytes = recvfrom(s, &rxmsg, sizeof(rxmsg),
-                                  0, (struct sockaddr*)&addr, &len);
-                if (nbytes < 0) {
-                        perror("recvfrom");
-                        return 1;
-                } else if (nbytes < sizeof(rxmsg)) {
-                        fprintf(stderr, "recvfrom: incomplete BCM message from iface %d\n",
-                                addr.can_ifindex);
-                        return 1;
-                } else {
-                        int i;
-
-                        ioctl(s, SIOCGSTAMP, &tv);
-                        printf("(%ld.%06ld) ", tv.tv_sec, tv.tv_usec);
-
-                        ifr.ifr_ifindex = addr.can_ifindex;
-                        ioctl(s, SIOCGIFNAME, &ifr);
-
-                        printf(" %-5s ", ifr.ifr_name);
-                        if (rxmsg.frame.can_id & CAN_EFF_FLAG)
-                                printf("%8X  ", rxmsg.frame.can_id & CAN_EFF_MASK);
-                        else
-                                printf("%3X  ", rxmsg.frame.can_id & CAN_SFF_MASK);
-
-                        printf("[%d] ", rxmsg.frame.can_dlc);
-
-                        for (i = 0; i < rxmsg.frame.can_dlc; i++) {
-                                printf("%02X ", rxmsg.frame.data[i]);
-                        }
-                        if (rxmsg.frame.can_id & CAN_RTR_FLAG)
-                                printf("remote request");
-                        printf("\n");
-                        fflush(stdout);
-                }
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-server.c b/testcases/network/can/filter-tests/tst-bcm-server.c
deleted file mode 100644
index c057780..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-server.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- *  $Id: tst-bcm-server.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-server.c
- *
- * Test programm that implements a socket server which understands ASCII
- * messages for simple broadcast manager frame send commands.
- *
- * < interface command ival_s ival_us can_id can_dlc [data]* >
- *
- * The commands are 'A'dd, 'U'pdate, 'D'elete and 'S'end.
- * e.g.
- *
- * Send the CAN frame 123#1122334455667788 every second on vcan1
- * < vcan1 A 1 0 123 8 11 22 33 44 55 66 77 88 >
- *
- * Send the CAN frame 123#1122334455667788 every 10 usecs on vcan1
- * < vcan1 A 0 10 123 8 11 22 33 44 55 66 77 88 >
- *
- * Send the CAN frame 123#42424242 every 20 msecs on vcan1
- * < vcan1 A 0 20000 123 4 42 42 42 42 >
- *
- * Update the CAN frame 123#42424242 with 123#112233 - no change of timers
- * < vcan1 U 0 0 123 3 11 22 33 >
- *
- * Delete the cyclic send job from above
- * < vcan1 D 0 0 123 0 >
- *
- * Send a single CAN frame without cyclic transmission
- * < can0 S 0 0 123 0 >
- *
- * When the socket is closed the cyclic transmissions are terminated.
- *
- * Authors:
- * Andre Naujoks (the socket server stuff)
- * Oliver Hartkopp (the rest)
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-#include <netinet/in.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-void readmsg(int sock, char *buf, int maxlen) {
-
-        int ptr = 0;
-
-        while (read(sock, buf+ptr, 1) == 1) {
-
-                if (ptr) {
-                        if (*(buf+ptr) == '>') {
-                                *(buf+ptr+1) = 0;
-                                return;
-                        }
-                        if (++ptr > maxlen-2)
-                                ptr = 0;
-                }
-                else
-                        if (*(buf+ptr) == '<')
-                                ptr++;
-        }
-
-        *buf = 0;
-}
-
-int main(int argc, char **argv)
-{
-
-        int sl, sa, sc;
-        struct sockaddr_in  saddr, clientaddr;
-        struct sockaddr_can caddr;
-        struct ifreq ifr;
-        socklen_t sin_size = sizeof(clientaddr);
-
-        char buf[100];
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame;
-        } msg;
-
-        if ((sl = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
-                perror("inetsocket");
-                exit(1);
-        }
-
-        saddr.sin_family = AF_INET;
-        saddr.sin_addr.s_addr = htonl(INADDR_ANY);
-        saddr.sin_port = htons(28600);
-
-        while (bind(sl,(struct sockaddr*)&saddr, sizeof(saddr)) < 0) {
-                printf(".");fflush(NULL);
-                usleep(100000);
-        }
-
-        if (listen(sl,3) != 0) {
-                perror("listen");
-                exit(1);
-        }
-
-        while (1) {
-                sa = accept(sl,(struct sockaddr *)&clientaddr, &sin_size);
-                if (sa > 0) {
-
-                        if (fork())
-                                close(sa);
-                        else
-                                break;
-                }
-                else {
-                        if (errno != EINTR) {
-                                /*
-                                 * If the cause for the error was NOT the signal from
-                                 * a dying child, than give an error
-                                 */
-                                perror("accept");
-                                exit(1);
-                        }
-                }
-        }
-
-        /* open BCM socket */
-
-        if ((sc = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("bcmsocket");
-                return 1;
-        }
-
-        caddr.can_family = PF_CAN;
-        caddr.can_ifindex = 0; /* any device => need for sendto() */
-
-        if (connect(sc, (struct sockaddr *)&caddr, sizeof(caddr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        /* prepare stable settings */
-        msg.msg_head.nframes       = 1;
-        msg.msg_head.count         = 0;
-        msg.msg_head.ival1.tv_sec  = 0;
-        msg.msg_head.ival1.tv_usec = 0;
-
-        while (1) {
-
-                char cmd;
-                int items;
-
-                readmsg(sa, buf, sizeof(buf));
-
-                // printf("read '%s'\n", buf);
-
-                items = sscanf(buf, "< %6s %c %lu %lu %x %hhu "
-                               "%hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx >",
-                               ifr.ifr_name,
-                               &cmd,
-                               &msg.msg_head.ival2.tv_sec,
-                               &msg.msg_head.ival2.tv_usec,
-                               &msg.msg_head.can_id,
-                               &msg.frame.can_dlc,
-                               &msg.frame.data[0],
-                               &msg.frame.data[1],
-                               &msg.frame.data[2],
-                               &msg.frame.data[3],
-                               &msg.frame.data[4],
-                               &msg.frame.data[5],
-                               &msg.frame.data[6],
-                               &msg.frame.data[7]);
-
-                if (items < 6)
-                        break;
-                if (msg.frame.can_dlc > 8)
-                        break;
-                if (items != 6 + msg.frame.can_dlc)
-                        break;
-
-                msg.frame.can_id = msg.msg_head.can_id;
-
-                switch (cmd) {
-                case 'S':
-                        msg.msg_head.opcode = TX_SEND;
-                        break;
-                case 'A':
-                        msg.msg_head.opcode = TX_SETUP;
-                        msg.msg_head.flags |= SETTIMER|STARTTIMER;
-                        break;
-                case 'U':
-                        msg.msg_head.opcode = TX_SETUP;
-                        msg.msg_head.flags  = 0;
-                        break;
-                case 'D':
-                        msg.msg_head.opcode = TX_DELETE;
-                        break;
-
-                default:
-                        printf("unknown command '%c'.\n", cmd);
-                        exit(1);
-                }
-
-                if (!ioctl(sc, SIOCGIFINDEX, &ifr)) {
-                        caddr.can_ifindex = ifr.ifr_ifindex;
-                        sendto(sc, &msg, sizeof(msg), 0,
-                               (struct sockaddr*)&caddr, sizeof(caddr));
-                }
-
-        }
-
-        close(sc);
-        close(sa);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-single.c b/testcases/network/can/filter-tests/tst-bcm-single.c
deleted file mode 100644
index 829343c..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-single.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *  $Id: tst-bcm-single.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-single.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame;
-        } msg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        msg.msg_head.opcode  = TX_SEND;
-        msg.msg_head.can_id  = 0x760;
-        msg.msg_head.flags   = 0;
-        msg.msg_head.nframes = 1;
-        msg.msg_head.count = 0;
-        msg.msg_head.ival1.tv_sec = 0;
-        msg.msg_head.ival1.tv_usec = 0;
-        msg.msg_head.ival2.tv_sec = 0;
-        msg.msg_head.ival2.tv_usec = 0;
-        msg.frame.can_id    = 0x760;
-        msg.frame.can_dlc   = 6;
-        msg.frame.data[0] = 0xA1;
-        msg.frame.data[1] = 0x0F;
-        msg.frame.data[2] = 0x10;
-        msg.frame.data[3] = 0x00;
-        msg.frame.data[4] = 0x00;
-        msg.frame.data[5] = 0x00;
-
-        if (write(s, &msg, sizeof(msg)) < 0)
-                perror("write");
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-throttle.c b/testcases/network/can/filter-tests/tst-bcm-throttle.c
deleted file mode 100644
index 8585ade..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-throttle.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- *  $Id: tst-bcm-throttle.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-throttle.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-#define U64_DATA(p) (*(unsigned long long*)(p)->data)
-#define BCM_1FRAME_LEN (sizeof(struct bcm_msg_head) + sizeof(struct can_frame))
-int main(int argc, char **argv)
-{
-        int s,nbytes;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame[3];
-        } txmsg, rxmsg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x042;
-        txmsg.msg_head.flags   = SETTIMER|RX_FILTER_ID;
-        txmsg.msg_head.ival1.tv_sec = 4;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 2;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 0;
-
-        printf("<*>Writing RX_SETUP with RX_FILTER_ID for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(struct bcm_msg_head)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        /* obsolete for TX_SEND ... */
-#if 0
-        txmsg.msg_head.can_id  = 0x43;
-        txmsg.msg_head.flags   = SETTIMER|STARTTIMER|TX_CP_CAN_ID;
-        txmsg.msg_head.count = 0;
-        txmsg.msg_head.ival1.tv_sec = 0;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-#endif
-        txmsg.frame[0].can_id    = 0x43;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<2>Writing TX_SEND with wrong can_id <%03X>\n",
-               txmsg.frame[0].can_id);
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<3>Writing TX_SEND with correct can_id <%03X>\n",
-               txmsg.frame[0].can_id);
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<3>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        /* growing number of nframes => RX_DELETE instead of simple update */
-        txmsg.msg_head.opcode  = RX_DELETE;
-        txmsg.msg_head.can_id  = 0x042; /* everything we need for RX_DELETE */
-
-        printf("<*>Writing RX_DELETE for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(struct bcm_msg_head)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x042;
-        txmsg.msg_head.flags   = SETTIMER|RX_CHECK_DLC;
-        txmsg.msg_head.ival1.tv_sec = 4;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 2;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 1;
-        /* txmsg.frame[0].can_dlc   = 8; obsolete for RX_SETUP */
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xFF00000000000000ULL;
-
-        printf("<*>Writing simple RX_SETUP for can_id <%03X> with msgbits 0x%016llX\n",
-               txmsg.msg_head.can_id, U64_DATA(&txmsg.frame[0]));
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<5>Writing TX_SEND with correct can_id <%03X>\n",
-               txmsg.frame[0].can_id);
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<5>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<6>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("no changed data\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        /* no change here */
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<7>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("changed relevant msgbits\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<7>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<8>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("changed irrelevant msgbits\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 7;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        printf("<9>Writing TX_SEND with correct can_id <%03X> ",
-               txmsg.frame[0].can_id);
-        printf("changed Data Length Code DLC\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<9>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        /* no problems ;-) but NOW we try MUX messages ... and timeouts */
-
-        /* growing number of nframes => RX_DELETE instead of simple update */
-        txmsg.msg_head.opcode  = RX_DELETE;
-        txmsg.msg_head.can_id  = 0x042; /* everything we need for RX_DELETE */
-
-        printf("<*>Writing RX_DELETE for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(struct bcm_msg_head)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = RX_SETUP;
-        txmsg.msg_head.can_id  = 0x042;
-        txmsg.msg_head.flags   = SETTIMER|RX_CHECK_DLC;
-        txmsg.msg_head.ival1.tv_sec = 4;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 2;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.msg_head.nframes = 3;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0xFF00000000000000ULL;
-        U64_DATA(&txmsg.frame[1]) = (__u64) 0x01000000000000FFULL;
-        U64_DATA(&txmsg.frame[2]) = (__u64) 0x02000000000000FFULL;
-
-        printf("<*>Writing multiplex RX_SETUP for can_id <%03X>\n",
-               txmsg.msg_head.can_id);
-
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x4200000000000000ULL;
-
-        printf("<A>Writing TX_SEND with wrong MUX ID 42\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100000000000000ULL;
-
-        printf("<B>Writing TX_SEND with correct MUX ID 01\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<B>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100000000000000ULL;
-
-        printf("<C>Writing TX_SEND with correct MUX ID 01 but no data change\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100001234567800ULL;
-
-        printf("<D>Writing TX_SEND with correct MUX ID 01 but no relevant data change\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0100001234567801ULL;
-
-        printf("<E>Writing TX_SEND with correct MUX ID 01 with relevant data change\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<E>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0200000000000000ULL;
-
-        printf("<F>Writing TX_SEND with correct MUX ID 02\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<F>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 8;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0200000000000001ULL;
-
-        printf("<10>Writing TX_SEND with correct MUX ID 02 with relevant data change\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<10>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 7;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0200000000000001ULL;
-
-        printf("<11>Writing TX_SEND with correct MUX ID 02 no data change but DLC\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_CHANGED &&
-            nbytes == BCM_1FRAME_LEN &&
-            rxmsg.msg_head.can_id == 0x42 && rxmsg.frame[0].can_id == 0x42) {
-                printf("<11>Received correct RX_CHANGED message for can_id <%03X> >> OK!\n",
-                       rxmsg.frame[0].can_id);
-        }
-
-        txmsg.msg_head.opcode  = TX_SEND;
-        txmsg.msg_head.nframes = 1;
-        txmsg.frame[0].can_id    = 0x42;
-        txmsg.frame[0].can_dlc   = 7;
-        U64_DATA(&txmsg.frame[0]) = (__u64) 0x0300000000000001ULL;
-
-        printf("<12>Writing TX_SEND with wrong MUX ID 03\n");
-
-        if (write(s, &txmsg, BCM_1FRAME_LEN) < 0)
-                perror("write");
-
-        if ((nbytes = read(s, &rxmsg, sizeof(rxmsg))) < 0)
-                perror("read");
-
-        if (rxmsg.msg_head.opcode == RX_TIMEOUT &&
-            nbytes == sizeof(struct bcm_msg_head) &&
-            rxmsg.msg_head.can_id == 0x42) {
-                printf("<-->Received correct RX_TIMEOUT message for can_id <%03X> >> OK!\n",
-                       rxmsg.msg_head.can_id);
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-tx-sendto.c b/testcases/network/can/filter-tests/tst-bcm-tx-sendto.c
deleted file mode 100644
index bb2dbef..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-tx-sendto.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *  $Id: tst-bcm-tx-sendto.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-tx-sendto.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-#define U64_DATA(p) (*(unsigned long long*)(p)->data)
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame;
-        } txmsg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        addr.can_ifindex = 0; /* bind to 'any' device */
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        txmsg.msg_head.opcode  = TX_SETUP;
-        txmsg.msg_head.can_id  = 0x42;
-        txmsg.msg_head.flags   = SETTIMER|STARTTIMER;
-        txmsg.msg_head.nframes = 1;
-        txmsg.msg_head.count = 10;
-        txmsg.msg_head.ival1.tv_sec = 1;
-        txmsg.msg_head.ival1.tv_usec = 0;
-        txmsg.msg_head.ival2.tv_sec = 0;
-        txmsg.msg_head.ival2.tv_usec = 0;
-        txmsg.frame.can_id    = 0x42;
-        txmsg.frame.can_dlc   = 8;
-        U64_DATA(&txmsg.frame) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        /* should cause an error due to ifindex = 0 */
-        if (write(s, &txmsg, sizeof(txmsg)) < 0)
-                perror("write");
-
-        printf("Press any key to send on valid device ...\n");
-        getchar();
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (sendto(s, &txmsg, sizeof(txmsg), 0, (struct sockaddr*)&addr, sizeof(addr)) < 0)
-                perror("sendto");
-
-        printf("Press any key to close the socket ...\n");
-        getchar();
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-bcm-tx_read.c b/testcases/network/can/filter-tests/tst-bcm-tx_read.c
deleted file mode 100644
index 39e9400..0000000
--- a/testcases/network/can/filter-tests/tst-bcm-tx_read.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *  $Id: tst-bcm-tx_read.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-bcm-tx_read.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/bcm.h>
-
-#define U64_DATA(p) (*(unsigned long long*)(p)->data)
-
-int main(int argc, char **argv)
-{
-        int s,i,nbytes;
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-
-        struct {
-                struct bcm_msg_head msg_head;
-                struct can_frame frame[4];
-        } msg;
-
-        if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        addr.can_family = PF_CAN;
-        strcpy(ifr.ifr_name, "vcan2");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        addr.can_ifindex = ifr.ifr_ifindex;
-
-        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("connect");
-                return 1;
-        }
-
-        msg.msg_head.opcode  = TX_SETUP;
-        msg.msg_head.can_id  = 0x42;
-        msg.msg_head.flags   = SETTIMER|STARTTIMER|TX_CP_CAN_ID|TX_COUNTEVT;
-        msg.msg_head.nframes = 1;
-        msg.msg_head.count = 2;
-        msg.msg_head.ival1.tv_sec = 3;
-        msg.msg_head.ival1.tv_usec = 0;
-        msg.msg_head.ival2.tv_sec = 5;
-        msg.msg_head.ival2.tv_usec = 0;
-        msg.frame[0].can_id    = 0xAA;
-        msg.frame[0].can_dlc   = 8;
-        U64_DATA(&msg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        if (write(s, &msg, sizeof(msg)) < 0)
-                perror("write");
-
-        printf("Press any key to stop the cycle ...\n");
-
-        getchar();
-
-        msg.msg_head.opcode  = TX_SETUP;
-        msg.msg_head.can_id  = 0x42;
-        msg.msg_head.flags   = SETTIMER|STARTTIMER|TX_CP_CAN_ID;
-        msg.msg_head.nframes = 1;
-        msg.msg_head.count = 0;
-        msg.msg_head.ival1.tv_sec = 0;
-        msg.msg_head.ival1.tv_usec = 0;
-        msg.msg_head.ival2.tv_sec = 0;
-        msg.msg_head.ival2.tv_usec = 0;
-        msg.frame[0].can_id    = 0xAA;
-        msg.frame[0].can_dlc   = 8;
-        U64_DATA(&msg.frame[0]) = (__u64) 0xdeadbeefdeadbeefULL;
-
-        if (write(s, &msg, sizeof(msg)) < 0)
-                perror("write");
-
-        printf("Press any key to read the entry ...\n");
-
-        getchar();
-
-        msg.msg_head.opcode  = TX_READ;
-        msg.msg_head.can_id  = 0x42;
-        msg.msg_head.nframes = 0;
-
-        if (write(s, &msg, sizeof(msg)) < 0)
-                perror("write");
-
-        printf("Press any key to read from the socket ...\n");
-
-        getchar();
-
-        if ((nbytes = read(s, &msg, sizeof(msg))) < 0)
-                perror("read");
-        for (i = 0; i < nbytes; i++)
-                printf(" %02x", ((unsigned char*)&msg)[i]);
-        putchar('\n');
-
-        printf("Press any key to close the socket ...\n");
-
-        getchar();
-
-        close(s);
-
-        printf("Press any key to end the program ...\n");
-
-        getchar();
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-err.c b/testcases/network/can/filter-tests/tst-err.c
deleted file mode 100644
index 86d0ad1..0000000
--- a/testcases/network/can/filter-tests/tst-err.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- *  $Id: tst-err.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-err.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/raw.h>
-#include <linux/can/error.h>
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct can_filter rfilter;
-        struct can_frame frame;
-        can_err_mask_t err_mask = CAN_ERR_MASK; /* all */
-        int nbytes;
-        struct ifreq ifr;
-        char *ifname = "vcan2";
-        int ifindex;
-        int opt;
-        struct timeval tv;
-
-        while ((opt = getopt(argc, argv, "i:m:")) != -1) {
-                switch (opt) {
-                case 'i':
-                        ifname = optarg;
-                        break;
-                case 'm':
-                        err_mask = strtoul(optarg, (char **)NULL, 16);
-                        break;
-                default:
-                        fprintf(stderr, "Unknown option %c\n", opt);
-                        break;
-                }
-        }
-
-        if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        rfilter.can_id   = CAN_INV_FILTER; /* no normal CAN frames */
-        rfilter.can_mask = 0; /* all: INV(all) == nothing */
-        setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter, sizeof(rfilter));
-
-        setsockopt(s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &err_mask, sizeof(err_mask));
-
-        strcpy(ifr.ifr_name, ifname);
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        ifindex = ifr.ifr_ifindex;
-
-        addr.can_family = AF_CAN;
-        addr.can_ifindex = ifindex;
-
-        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        while (1) {
-
-                if ((nbytes = read(s, &frame, sizeof(struct can_frame))) < 0) {
-                        perror("read");
-                        return 1;
-                } else if (nbytes < sizeof(struct can_frame)) {
-                        fprintf(stderr, "read: incomplete CAN frame\n");
-                        return 1;
-                } else {
-                        if (ioctl(s, SIOCGSTAMP, &tv) < 0)
-                                perror("SIOCGSTAMP");
-                        else
-                                printf("(%ld.%06ld) ", tv.tv_sec, tv.tv_usec);
-
-                        if (frame.can_id & CAN_ERR_BUSOFF)
-                                printf("(bus off) ");
-
-                        if (frame.can_id & CAN_ERR_TX_TIMEOUT)
-                                printf("(tx timeout) ");
-
-                        if (frame.can_id & CAN_ERR_ACK)
-                                printf("(ack) ");
-
-                        if (frame.can_id & CAN_ERR_LOSTARB) {
-                                printf("(lost arb)");
-                                if (frame.data[0])
-                                        printf("[%d]", frame.data[0]);
-                                printf(" ");
-                        }
-
-                        if (frame.can_id & CAN_ERR_CRTL) {
-                                printf("(crtl)");
-                                if (frame.data[1] & CAN_ERR_CRTL_RX_OVERFLOW)
-                                        printf("[RX buffer overflow]");
-                                if (frame.data[1] & CAN_ERR_CRTL_TX_OVERFLOW)
-                                        printf("[TX buffer overflow]");
-                                if (frame.data[1] & CAN_ERR_CRTL_RX_WARNING)
-                                        printf("[RX warning]");
-                                if (frame.data[1] & CAN_ERR_CRTL_TX_WARNING)
-                                        printf("[TX warning]");
-                                printf(" ");
-                        }
-
-                        /* to be continued */
-
-                        printf("\n");
-                        fflush(stdout);
-                }
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-filter-master.c b/testcases/network/can/filter-tests/tst-filter-master.c
deleted file mode 100644
index 42d6e53..0000000
--- a/testcases/network/can/filter-tests/tst-filter-master.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- *  $Id: tst-filter-master.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-filter-master.c
- *
- * Copyright (c) 2008 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct can_filter rfilter;
-        struct can_frame frame;
-        int testcase;
-        int nbytes;
-        struct ifreq ifr;
-        int ifindex;
-
-        if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        strcpy(ifr.ifr_name, "vcan0");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        ifindex = ifr.ifr_ifindex;
-
-        addr.can_family = AF_CAN;
-        addr.can_ifindex = ifindex;
-
-        rfilter.can_id   = 0xFA; /* receive only the filter ack */
-        rfilter.can_mask = CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG;
-        setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter, sizeof(rfilter));
-
-        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        /* send testcases 0 .. 17 and a terminating 18 to quit */
-        for (testcase = 0; testcase < 19; testcase++) {
-
-                printf("Sending testcase %2d ... ", testcase);
-                frame.can_id = 0x0F;
-                frame.can_dlc = 1;
-                frame.data[0] = testcase;
-
-                if (write(s, &frame, sizeof(frame)) < 0) {
-                        perror("write");
-                        exit(1);
-                }
-
-                /* wait for ACK from server */
-                if ((nbytes = read(s, &frame, sizeof(struct can_frame))) < 0) {
-                        perror("read");
-                        exit(1);
-                }
-
-                if (nbytes < sizeof(struct can_frame)) {
-                        fprintf(stderr, "read: incomplete CAN frame\n");
-                        exit(1);
-                }
-
-                if ((frame.can_id != 0xFA) || (frame.can_dlc != 1) ||
-                    (frame.data[0] != testcase)) {
-                        fprintf(stderr, "\nWrong answer from server!\n");
-                        exit(1);
-                }
-
-                printf("acked. ");
-                if (testcase > 17)
-                        break;
-
-                /* interactive mode, when there is any commandline option */
-                if (argc == 2) {
-                        printf("[press enter] ");
-                        getchar();
-                }
-
-                printf("Sending patterns ... ");
-
-                frame.can_dlc = 0;
-
-                frame.can_id = 0x123;
-                if (write(s, &frame, sizeof(frame)) < 0) {
-                        perror("write");
-                        exit(1);
-                }
-                frame.can_id = (0x123 | CAN_RTR_FLAG);
-                if (write(s, &frame, sizeof(frame)) < 0) {
-                        perror("write");
-                        exit(1);
-                }
-                frame.can_id = (0x123 | CAN_EFF_FLAG);
-                if (write(s, &frame, sizeof(frame)) < 0) {
-                        perror("write");
-                        exit(1);
-                }
-                frame.can_id = (0x123 | CAN_EFF_FLAG | CAN_RTR_FLAG);
-                if (write(s, &frame, sizeof(frame)) < 0) {
-                        perror("write");
-                        exit(1);
-                }
-
-                printf("ok\n");
-        }
-
-        printf("Filtertest done.\n");
-
-        close(s);
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-filter-server.c b/testcases/network/can/filter-tests/tst-filter-server.c
deleted file mode 100644
index 46903a5..0000000
--- a/testcases/network/can/filter-tests/tst-filter-server.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- *  $Id: tst-filter-server.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-filter-server.c
- *
- * Copyright (c) 2008 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-#define ID  0x123
-#define FIL 0x7FF
-#define EFF CAN_EFF_FLAG
-#define RTR CAN_RTR_FLAG
-
-canid_t calc_id(int testcase)
-{
-        canid_t id = ID;
-
-        if (testcase & 1)
-                id |= EFF;
-        if (testcase & 2)
-                id |= RTR;
-
-        return id;
-}
-
-canid_t calc_mask(int testcase)
-{
-        canid_t mask = FIL;
-
-        if (testcase > 15)
-                return (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG);
-
-        if (testcase & 4)
-                mask |= EFF;
-        if (testcase & 8)
-                mask |= RTR;
-
-        return mask;
-}
-
-int main(int argc, char **argv)
-{
-        fd_set rdfs;
-        int s, t;
-        struct sockaddr_can addr;
-        struct can_filter rfilter;
-        struct can_frame frame;
-        int testcase = 0;
-        int nbytes, ret;
-        struct ifreq ifr;
-        int ifindex;
-
-        if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                perror("socket");
-                return 1;
-        }
-        if ((t = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        strcpy(ifr.ifr_name, "vcan0");
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        ifindex = ifr.ifr_ifindex;
-
-        addr.can_family = AF_CAN;
-        addr.can_ifindex = ifindex;
-
-        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-        if (bind(t, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        rfilter.can_id   = 0xF; /* receive only the filter requests */
-        rfilter.can_mask = CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG;
-        setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter, sizeof(rfilter));
-
-        /* disable default receive filter on the test socket */
-        setsockopt(t, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0);
-
-        while (1) {
-
-                FD_ZERO(&rdfs);
-                FD_SET(s, &rdfs);
-                FD_SET(t, &rdfs);
-
-                if ((ret = select(t+1, &rdfs, NULL, NULL, NULL)) < 0) {
-                        perror("select");
-                        break;
-                }
-
-                if (FD_ISSET(s, &rdfs)) {
-
-                        if ((nbytes = read(s, &frame, sizeof(struct can_frame))) < 0) {
-                                perror("read");
-                                exit(1);
-                        }
-
-                        if (nbytes < sizeof(struct can_frame)) {
-                                fprintf(stderr, "read: incomplete CAN frame\n");
-                                exit(1);
-                        }
-
-                        if ((frame.can_id != 0xF) || (frame.can_dlc != 1)) {
-                                fprintf(stderr, "\nWrong request from master!\n");
-                                exit(1);
-                        }
-
-                        testcase = frame.data[0];
-
-                        if (testcase < 18) {
-                                rfilter.can_id   = calc_id(testcase);
-                                rfilter.can_mask = calc_mask(testcase);
-                                setsockopt(t, SOL_CAN_RAW, CAN_RAW_FILTER,
-                                           &rfilter, sizeof(rfilter));
-
-                                printf("testcase %2d : can_id = 0x%08X can_mask = 0x%08X\n",
-                                       testcase, rfilter.can_id, rfilter.can_mask);
-                        }
-
-                        frame.can_id = 0xFA; /* filter ack */
-
-                        if (write(s, &frame, sizeof(frame)) < 0) {
-                                perror("write");
-                                exit(1);
-                        }
-
-                        if (testcase > 17)
-                                break;
-                }
-
-                if (FD_ISSET(t, &rdfs)) {
-
-                        if ((nbytes = read(t, &frame, sizeof(struct can_frame))) < 0) {
-                                perror("read");
-                                exit(1);
-                        }
-
-                        if (nbytes < sizeof(struct can_frame)) {
-                                fprintf(stderr, "read: incomplete CAN frame\n");
-                                exit(1);
-                        }
-
-                        printf ("%08X\n", frame.can_id);
-                }
-        }
-
-        printf("testcase %2d : Filtertest done.\n", testcase);
-
-        close(s);
-        close(t);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-filter.c b/testcases/network/can/filter-tests/tst-filter.c
new file mode 100644
index 0000000..a2d46f1
--- /dev/null
+++ b/testcases/network/can/filter-tests/tst-filter.c
@@ -0,0 +1,244 @@
+/*
+ *  $Id: tst-filter.c 1263 2011-07-09 18:00:41Z hartkopp $
+ */
+
+/*
+ * tst-filter.c
+ *
+ * Copyright (c) 2011 Volkswagen Group Electronic Research
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Volkswagen nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * Alternatively, provided that this notice is retained in full, this
+ * software may be distributed under the terms of the GNU General
+ * Public License ("GPL") version 2, in which case the provisions of the
+ * GPL apply INSTEAD OF those given above.
+ *
+ * The provided data structures and external interfaces from this code
+ * are not restricted to be used by modules with a GPL compatible license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * Send feedback to <socketcan-users@lists.berlios.de>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <net/if.h>
+
+#include <linux/can.h>
+#include <linux/can/raw.h>
+
+#define ID 0x123
+#define TC 18 /* # of testcases */
+
+const int rx_res[TC] = {4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1};
+const int rxbits_res[TC] = {4369, 4369, 4369, 4369, 17, 4352, 17, 4352, 257, 257, 4112, 4112, 1, 256, 16, 4096, 1, 256};
+
+canid_t calc_id(int testcase)
+{
+	canid_t id = ID;
+
+	if (testcase & 1)
+		id |= CAN_EFF_FLAG;
+	if (testcase & 2)
+		id |= CAN_RTR_FLAG;
+
+	return id;
+}
+
+canid_t calc_mask(int testcase)
+{
+	canid_t mask = CAN_SFF_MASK;
+
+	if (testcase > 15)
+		return (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG);
+
+	if (testcase & 4)
+		mask |= CAN_EFF_FLAG;
+	if (testcase & 8)
+		mask |= CAN_RTR_FLAG;
+
+	return mask;
+}
+
+int main(int argc, char **argv)
+{
+	fd_set rdfs;
+        struct timeval tv;
+	int s;
+	struct sockaddr_can addr;
+	struct can_filter rfilter;
+	struct can_frame frame;
+	int testcase;
+	int have_rx;
+	int rx;
+	int rxbits, rxbitval;
+	int ret;
+	int recv_own_msgs = 1;
+	struct ifreq ifr;
+
+	/* check command line options */
+	if (argc != 2) {
+		fprintf(stderr, "Usage: %s <device>\n", argv[0]);
+		return 1;
+	}
+
+	if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
+		perror("socket");
+		return 1;
+	}
+
+	strcpy(ifr.ifr_name, argv[1]);
+	if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
+		perror("SIOCGIFINDEX");
+		return 1;
+	}
+	addr.can_family = AF_CAN;
+	addr.can_ifindex = ifr.ifr_ifindex;
+
+	setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS,
+		   &recv_own_msgs, sizeof(recv_own_msgs));
+
+	if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+		perror("bind");
+		return 1;
+	}
+
+	printf("---\n");
+
+	for (testcase = 0; testcase < TC; testcase++) {
+		
+		rfilter.can_id   = calc_id(testcase);
+		rfilter.can_mask = calc_mask(testcase);
+		setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER,
+			   &rfilter, sizeof(rfilter));
+
+		printf("testcase %2d filters : can_id = 0x%08X can_mask = 0x%08X\n",
+		       testcase, rfilter.can_id, rfilter.can_mask);
+
+		printf("testcase %2d sending patterns ... ", testcase);
+
+		frame.can_dlc = 1;
+		frame.data[0] = testcase;
+
+		frame.can_id = ID;
+		if (write(s, &frame, sizeof(frame)) < 0) {
+			perror("write");
+			exit(1);
+		}
+		frame.can_id = (ID | CAN_RTR_FLAG);
+		if (write(s, &frame, sizeof(frame)) < 0) {
+			perror("write");
+			exit(1);
+		}
+		frame.can_id = (ID | CAN_EFF_FLAG);
+		if (write(s, &frame, sizeof(frame)) < 0) {
+			perror("write");
+			exit(1);
+		}
+		frame.can_id = (ID | CAN_EFF_FLAG | CAN_RTR_FLAG);
+		if (write(s, &frame, sizeof(frame)) < 0) {
+			perror("write");
+			exit(1);
+		}
+
+		printf("ok\n");
+
+		have_rx = 1;
+		rx = 0;
+		rxbits = 0;
+
+		while (have_rx) {
+
+			have_rx = 0;
+			FD_ZERO(&rdfs);
+			FD_SET(s, &rdfs);
+			tv.tv_sec = 0;
+			tv.tv_usec = 50000; /* 50ms timeout */
+
+			ret = select(s+1, &rdfs, NULL, NULL, &tv);
+			if (ret < 0) {
+				perror("select");
+				exit(1);
+			}
+
+			if (FD_ISSET(s, &rdfs)) {
+				have_rx = 1;
+				ret = read(s, &frame, sizeof(struct can_frame));
+				if (ret < 0) {
+					perror("read");
+					exit(1);
+				}
+				if ((frame.can_id & CAN_SFF_MASK) != ID) {
+					fprintf(stderr, "received wrong can_id!\n");
+					exit(1);
+				}
+				if (frame.data[0] != testcase) {
+					fprintf(stderr, "received wrong testcase!\n");
+					exit(1);
+				}
+
+				/* test & calc rxbits */
+				rxbitval = 1 << ((frame.can_id & (CAN_EFF_FLAG|CAN_RTR_FLAG|CAN_ERR_FLAG)) >> 28);
+
+				/* only receive a rxbitval once */
+				if ((rxbits & rxbitval) == rxbitval) {
+					fprintf(stderr, "received rxbitval %d twice!\n", rxbitval);
+					exit(1);
+				}
+				rxbits |= rxbitval;
+				rx++;
+
+				printf("testcase %2d rx : can_id = 0x%08X rx = %d rxbits = %d\n",
+				       testcase, frame.can_id, rx, rxbits);
+			}
+		}
+		/* rx timed out -> check the received results */
+		if (rx_res[testcase] != rx) {
+			fprintf(stderr, "wrong rx value in testcase %d : %d (expected %d)\n",
+				testcase, rx, rx_res[testcase]);
+			exit(1);
+		}
+		if (rxbits_res[testcase] != rxbits) {
+			fprintf(stderr, "wrong rxbits value in testcase %d : %d (expected %d)\n",
+				testcase, rxbits, rxbits_res[testcase]);
+			exit(1);
+		}
+		printf("testcase %2d ok\n---\n", testcase);
+	}
+
+	close(s);
+
+	return 0;
+}
diff --git a/testcases/network/can/filter-tests/tst-packet.c b/testcases/network/can/filter-tests/tst-packet.c
deleted file mode 100644
index 12432bb..0000000
--- a/testcases/network/can/filter-tests/tst-packet.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *  $Id: tst-packet.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-packet.c - send and receive CAN frames via PF_PACKET sockets
- *
- * Remark: The sending of CAN frames via PF_PACKET does not work for
- * virtual CAN devices (vcan) as the packet type is not set to
- * PACKET_LOOPBACK by the packet socket, so you'll never get something
- * back (btw the outgoing vcan packet counters are updated correctly).
- *
- * Copyright (c) 2002-2009 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <netinet/in.h>         /* for htons() */
-
-#include <linux/if_packet.h>
-#include <linux/if_ether.h>     /* for ETH_P_CAN */
-#include <linux/can.h>          /* for struct can_frame */
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct can_frame frame;
-        int nbytes, i;
-        static struct ifreq ifr;
-        static struct sockaddr_ll sll;
-        char *ifname = "vcan2";
-        int ifindex;
-        int opt;
-        int send_one_frame = 0;
-
-        while ((opt = getopt(argc, argv, "i:s")) != -1) {
-                switch (opt) {
-
-                case 'i':
-                        ifname = optarg;
-                        break;
-
-                case 's':
-                        send_one_frame = 1;
-                        break;
-
-                default:
-                        fprintf(stderr, "Unknown option %c\n", opt);
-                        break;
-                }
-        }
-
-        s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_CAN));
-        if (s < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        if (strcmp(ifname, "any") == 0)
-                ifindex = 0;
-        else {
-                strcpy(ifr.ifr_name, ifname);
-                ioctl(s, SIOCGIFINDEX, &ifr);
-                ifindex = ifr.ifr_ifindex;
-        }
-
-        sll.sll_family   = AF_PACKET;
-        sll.sll_ifindex  = ifindex;
-        sll.sll_protocol = htons(ETH_P_CAN);
-
-        if (bind(s, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        if (send_one_frame) {
-
-                frame.can_id  = 0x123;
-                frame.can_dlc = 2;
-                frame.data[0] = 0x11;
-                frame.data[1] = 0x22;
-
-                nbytes = write(s, &frame, sizeof(struct can_frame));
-                if (nbytes < 0) {
-                        perror("write");
-                        return 1;
-                }
-                if (nbytes != sizeof(struct can_frame)) {
-                        perror("write_len");
-                        return 1;
-                }
-        }
-
-        while (1) {
-
-                if ((nbytes = read(s, &frame, sizeof(struct can_frame))) < 0) {
-                        perror("read");
-                        return 1;
-                } else if (nbytes < sizeof(struct can_frame)) {
-                        fprintf(stderr, "read: incomplete CAN frame\n");
-                        return 1;
-                } else {
-                        if (frame.can_id & CAN_EFF_FLAG)
-                                printf("%8X  ", frame.can_id & CAN_EFF_MASK);
-                        else
-                                printf("%3X  ", frame.can_id & CAN_SFF_MASK);
-
-                        printf("[%d] ", frame.can_dlc);
-
-                        for (i = 0; i < frame.can_dlc; i++) {
-                                printf("%02X ", frame.data[i]);
-                        }
-                        if (frame.can_id & CAN_RTR_FLAG)
-                                printf("remote request");
-                        printf("\n");
-                        fflush(stdout);
-                }
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-proc.c b/testcases/network/can/filter-tests/tst-proc.c
deleted file mode 100644
index a33c600..0000000
--- a/testcases/network/can/filter-tests/tst-proc.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *  $Id: tst-proc.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-proc.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-#define MAX_RAW 800
-
-int main(int argc, char **argv)
-{
-        int s[MAX_RAW];
-        struct sockaddr_can addr;
-        struct ifreq ifr;
-        int i,numsock;
-
-        if (argc != 2) {
-                fprintf(stderr, "Error: Wrong number of arguments. Try %s <number of created sockets>.\n", argv[0]);
-                exit(1);
-        }
-
-        numsock = atoi(argv[1]);
-
-        if (numsock >= MAX_RAW) {
-                fprintf(stderr, "Error: more than %d sockets to open (see #define MAX_RAW).\n", MAX_RAW);
-                exit(1);
-        }
-
-        printf("\ncreating %d raw sockets ... ", numsock);
-
-        if (numsock) {
-                for (i=0; i < numsock; i++) {
-                        if ((s[i] = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                                perror("socket");
-                                return 1;
-                        }
-
-                        addr.can_family = PF_CAN;
-                        strcpy(ifr.ifr_name, "vcan2");
-                        ioctl(s[i], SIOCGIFINDEX, &ifr);
-                        addr.can_ifindex = ifr.ifr_ifindex;
-
-                        if (bind(s[i], (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                                perror("connect");
-                                return 1;
-                        }
-                }
-        }
-
-        printf("done.\n");
-
-        printf("Waiting for keyboard input ...");
-
-        getchar();
-
-        printf("closing %d raw sockets ... ", numsock);
-
-        if (numsock)
-                for (i=0; i < numsock; i++)
-                        close(s[i]);
-
-        printf("done.\n\n");
-
-    return 0;
-
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-raw-filter.c b/testcases/network/can/filter-tests/tst-raw-filter.c
deleted file mode 100644
index a244ead..0000000
--- a/testcases/network/can/filter-tests/tst-raw-filter.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- *  $Id: tst-raw-filter.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-raw-filter.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-#define MAXFILTERS 32
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct can_filter rfilter[MAXFILTERS];
-        struct can_frame frame;
-        int nbytes, i;
-        struct ifreq ifr;
-        char *ifname = "any";
-        int ifindex;
-        int opt;
-        int peek = 0;
-        int nfilters = 0;
-        int deflt = 0;
-
-        while ((opt = getopt(argc, argv, "i:p:f:d")) != -1) {
-                switch (opt) {
-                case 'i': /* specify different interface than default */
-                        ifname = optarg;
-                        break;
-                case 'p': /* MSG_PEEK 'p' times before consuming the frame */
-                        peek = atoi(optarg);
-                        break;
-                case 'd': /* use default settings from CAN_RAW socket */
-                        deflt = 1;
-                        break;
-                case 'f': /* add this filter can_id:can_mask */
-                        if (nfilters >= MAXFILTERS) {
-                                fputs("too many filters\n", stderr);
-                                break;
-                        }
-                        rfilter[nfilters].can_id = strtoul(strtok(optarg, ":"), NULL, 16);
-                        rfilter[nfilters].can_mask = strtoul(strtok(NULL, ":"), NULL, 16);
-                        nfilters++;
-                        break;
-                default:
-                        fprintf(stderr, "Unknown option %c\n", opt);
-                        break;
-                }
-        }
-
-        if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        if (deflt) {
-                printf("%s: using CAN_RAW socket default filter.\n", argv[0]);
-        } else {
-                printf("%s: setting %d CAN filter(s).\n", argv[0], nfilters);
-                setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter,
-                           sizeof(*rfilter) * nfilters);
-        }
-
-        if (strcmp(ifname, "any") == 0)
-                ifindex = 0;
-        else {
-                strcpy(ifr.ifr_name, ifname);
-                ioctl(s, SIOCGIFINDEX, &ifr);
-                ifindex = ifr.ifr_ifindex;
-        }
-
-        addr.can_family = AF_CAN;
-        addr.can_ifindex = ifindex;
-
-        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        while (1) {
-                socklen_t len = sizeof(addr);
-                int flags;
-
-                if (peek && peek--)
-                        flags = MSG_PEEK;
-                else
-                        flags = 0;
-
-                nbytes = recvfrom(s, &frame, sizeof(struct can_frame),
-                                  flags, (struct sockaddr*)&addr, &len);
-                if (nbytes < 0) {
-                        perror("read");
-                        return 1;
-                } else if (nbytes < sizeof(struct can_frame)) {
-                        fprintf(stderr, "read: incomplete CAN frame from iface %d\n",
-                                addr.can_ifindex);
-                        return 1;
-                } else {
-                        ifr.ifr_ifindex = addr.can_ifindex;
-                        ioctl(s, SIOCGIFNAME, &ifr);
-                        printf(" %-5s ", ifr.ifr_name);
-                        if (frame.can_id & CAN_EFF_FLAG)
-                                printf("%8X  ", frame.can_id & CAN_EFF_MASK);
-                        else
-                                printf("%3X  ", frame.can_id & CAN_SFF_MASK);
-
-                        printf("[%d] ", frame.can_dlc);
-
-                        for (i = 0; i < frame.can_dlc; i++) {
-                                printf("%02X ", frame.data[i]);
-                        }
-                        if (frame.can_id & CAN_RTR_FLAG)
-                                printf("remote request");
-                        if (flags & MSG_PEEK)
-                                printf(" (MSG_PEEK)");
-                        printf("\n");
-                        fflush(stdout);
-                }
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-raw-sendto.c b/testcases/network/can/filter-tests/tst-raw-sendto.c
deleted file mode 100644
index 94808b4..0000000
--- a/testcases/network/can/filter-tests/tst-raw-sendto.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *  $Id: tst-raw-sendto.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-raw-sendto.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct can_frame frame;
-        int nbytes;
-        struct ifreq ifr;
-        char *ifname = "vcan2";
-        int ifindex;
-        int opt;
-
-        while ((opt = getopt(argc, argv, "i:")) != -1) {
-                switch (opt) {
-                case 'i':
-                        ifname = optarg;
-                        break;
-                default:
-                        fprintf(stderr, "Unknown option %c\n", opt);
-                        break;
-                }
-        }
-
-        if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        strcpy(ifr.ifr_name, ifname);
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        ifindex = ifr.ifr_ifindex;
-
-        addr.can_family  = AF_CAN;
-        addr.can_ifindex = 0; /* bind to all interfaces */
-
-        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        /* fill CAN frame */
-        frame.can_id  = 0x123;
-        frame.can_dlc = 3;
-        frame.data[0] = 0x11;
-        frame.data[1] = 0x22;
-        frame.data[2] = 0x33;
-
-        addr.can_family  = AF_CAN;
-        addr.can_ifindex = ifindex; /* send via this interface */
-
-        nbytes = sendto(s, &frame, sizeof(struct can_frame), 0, (struct sockaddr*)&addr, sizeof(addr));
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-raw.c b/testcases/network/can/filter-tests/tst-raw.c
deleted file mode 100644
index fd3958f..0000000
--- a/testcases/network/can/filter-tests/tst-raw.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *  $Id: tst-raw.c,v 1.1 2009/03/02 15:33:55 subrata_modak Exp $
- */
-
-/*
- * tst-raw.c
- *
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Volkswagen nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * Alternatively, provided that this notice is retained in full, this
- * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2, in which case the provisions of the
- * GPL apply INSTEAD OF those given above.
- *
- * The provided data structures and external interfaces from this code
- * are not restricted to be used by modules with a GPL compatible license.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-int main(int argc, char **argv)
-{
-        int s;
-        struct sockaddr_can addr;
-        struct can_filter rfilter[4];
-        struct can_frame frame;
-        int nbytes, i;
-        struct ifreq ifr;
-        char *ifname = "vcan2";
-        int ifindex;
-        int opt;
-
-        /* sockopt test */
-        int loopback = 0;
-        int set_loopback = 0;
-        int recv_own_msgs = 0;
-        int set_recv_own_msgs = 0;
-        int send_one_frame = 0;
-        int ignore_errors = 0;
-
-        while ((opt = getopt(argc, argv, "i:l:r:se")) != -1) {
-                switch (opt) {
-
-                case 'i':
-                        ifname = optarg;
-                        break;
-
-                case 'l':
-                        loopback = atoi(optarg);
-                        set_loopback = 1;
-                        break;
-
-                case 'r':
-                        recv_own_msgs = atoi(optarg);
-                        set_recv_own_msgs = 1;
-                        break;
-
-                case 's':
-                        send_one_frame = 1;
-                        break;
-
-                case 'e':
-                        ignore_errors = 1;
-                        break;
-
-                default:
-                        fprintf(stderr, "Unknown option %c\n", opt);
-                        break;
-                }
-        }
-
-        if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
-                perror("socket");
-                return 1;
-        }
-
-        rfilter[0].can_id   = 0x123;
-        rfilter[0].can_mask = CAN_SFF_MASK;
-        rfilter[1].can_id   = 0x200;
-        rfilter[1].can_mask = 0x700;
-        rfilter[2].can_id   = 0x80123456;
-        rfilter[2].can_mask = 0x1FFFF000;
-        rfilter[3].can_id   = 0x80333333;
-        rfilter[3].can_mask = CAN_EFF_MASK;
-
-        setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter, sizeof(rfilter));
-
-        if (set_loopback)
-                setsockopt(s, SOL_CAN_RAW, CAN_RAW_LOOPBACK, &loopback, sizeof(loopback));
-
-        if (set_recv_own_msgs)
-                setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, &recv_own_msgs, sizeof(recv_own_msgs));
-
-        strcpy(ifr.ifr_name, ifname);
-        ioctl(s, SIOCGIFINDEX, &ifr);
-        ifindex = ifr.ifr_ifindex;
-
-        addr.can_family = AF_CAN;
-        addr.can_ifindex = ifindex;
-
-        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-                perror("bind");
-                return 1;
-        }
-
-        if (send_one_frame) {
-
-                frame.can_id  = 0x123;
-                frame.can_dlc = 2;
-                frame.data[0] = 0x11;
-                frame.data[1] = 0x22;
-
-                nbytes = write(s, &frame, sizeof(struct can_frame));
-        }
-
-        while (1) {
-
-                if ((nbytes = read(s, &frame, sizeof(struct can_frame))) < 0) {
-                        perror("read");
-                        if (!ignore_errors)
-                                return 1;
-                } else if (nbytes < sizeof(struct can_frame)) {
-                        fprintf(stderr, "read: incomplete CAN frame\n");
-                        return 1;
-                } else {
-                        if (frame.can_id & CAN_EFF_FLAG)
-                                printf("%8X  ", frame.can_id & CAN_EFF_MASK);
-                        else
-                                printf("%3X  ", frame.can_id & CAN_SFF_MASK);
-
-                        printf("[%d] ", frame.can_dlc);
-
-                        for (i = 0; i < frame.can_dlc; i++) {
-                                printf("%02X ", frame.data[i]);
-                        }
-                        if (frame.can_id & CAN_RTR_FLAG)
-                                printf("remote request");
-                        printf("\n");
-                        fflush(stdout);
-                }
-        }
-
-        close(s);
-
-    return 0;
-}
\ No newline at end of file
diff --git a/testcases/network/can/filter-tests/tst-rcv-own-msgs.c b/testcases/network/can/filter-tests/tst-rcv-own-msgs.c
new file mode 100644
index 0000000..593e9fb
--- /dev/null
+++ b/testcases/network/can/filter-tests/tst-rcv-own-msgs.c
@@ -0,0 +1,247 @@
+/*
+ *  $Id: tst-rcv-own-msgs.c 1193 2010-08-09 14:00:21Z hartkopp $
+ */
+
+/*
+ * tst-rcv-own-msgs.c
+ *
+ * Copyright (c) 2010 Volkswagen Group Electronic Research
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Volkswagen nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * Alternatively, provided that this notice is retained in full, this
+ * software may be distributed under the terms of the GNU General
+ * Public License ("GPL") version 2, in which case the provisions of the
+ * GPL apply INSTEAD OF those given above.
+ *
+ * The provided data structures and external interfaces from this code
+ * are not restricted to be used by modules with a GPL compatible license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * Send feedback to <socketcan-users@lists.berlios.de>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <net/if.h>
+
+#include <linux/can.h>
+#include <linux/can/raw.h>
+
+
+#define max(a,b) (a > b ? a : b)
+
+struct rxs {
+	int s;
+	int t;
+};
+
+struct rxs test_sockets(int s, int t, canid_t can_id)
+{
+	fd_set rdfs;
+	struct timeval tv;
+	int m = max(s,t)+1;
+	int have_rx = 1;
+	struct can_frame frame;
+	struct rxs rx;
+	int ret;
+
+	frame.can_id = can_id;
+	frame.can_dlc = 0;
+	if (write(s, &frame, sizeof(frame)) < 0) {
+		perror("write");
+		exit(1);
+	}
+
+	rx.s = rx.t = 0;
+
+	while (have_rx) {
+
+		FD_ZERO(&rdfs);
+		FD_SET(s, &rdfs);
+		FD_SET(t, &rdfs);
+		tv.tv_sec = 0;
+		tv.tv_usec = 50000; /* 50ms timeout */
+		have_rx = 0;
+
+		ret = select(m, &rdfs, NULL, NULL, &tv);
+		if (ret < 0) {
+			perror("select");
+			exit(1);
+		}
+
+		if (FD_ISSET(s, &rdfs)) {
+
+			have_rx = 1;
+			ret = read(s, &frame, sizeof(struct can_frame));
+			if (ret < 0) {
+				perror("read");
+				exit(1);
+			}
+			if (frame.can_id != can_id) {
+				fprintf(stderr, "received wrong can_id!\n");
+				exit(1);
+			}
+			rx.s++;
+		}
+
+		if (FD_ISSET(t, &rdfs)) {
+
+			have_rx = 1;
+			ret = read(t, &frame, sizeof(struct can_frame));
+			if (ret < 0) {
+				perror("read");
+				exit(1);
+			}
+			if (frame.can_id != can_id) {
+				fprintf(stderr, "received wrong can_id!\n");
+				exit(1);
+			}
+			rx.t++;
+		}
+	}
+
+	/* timeout */
+
+	return rx;
+}
+
+void setopts(int s, int loopback, int recv_own_msgs)
+{
+	setsockopt(s, SOL_CAN_RAW, CAN_RAW_LOOPBACK,
+		   &loopback, sizeof(loopback));
+	setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS,
+		   &recv_own_msgs, sizeof(recv_own_msgs));
+
+	printf("check loopback %d recv_own_msgs %d ... ",
+	       loopback, recv_own_msgs);
+}
+
+
+int main(int argc, char **argv)
+{
+	int s, t;
+	struct sockaddr_can addr;
+	struct ifreq ifr;
+	struct rxs rx;
+
+	/* check command line options */
+	if (argc != 2) {
+		fprintf(stderr, "Usage: %s <device>\n", argv[0]);
+		return 1;
+	}
+
+	if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
+		perror("socket");
+		return 1;
+	}
+	if ((t = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
+		perror("socket");
+		return 1;
+	}
+
+	strcpy(ifr.ifr_name, argv[1]);
+	if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
+		perror("SIOCGIFINDEX");
+		return 1;
+	}
+	addr.can_ifindex = ifr.ifr_ifindex;
+	addr.can_family = AF_CAN;
+
+	if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+		perror("bind");
+		return 1;
+	}
+	if (bind(t, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+		perror("bind");
+		return 1;
+	}
+
+	printf("Starting PF_CAN frame flow test.\n");
+	printf("checking socket default settings ... ");
+	rx = test_sockets(s, t, 0x340);
+	if (rx.s == 0 && rx.t == 1)
+		printf("ok.\n");
+	else {
+		printf("failure!\n");
+		return 1;
+	}
+
+	/* check loopback 0 recv_own_msgs 0 */
+	setopts(s, 0, 0);
+	rx = test_sockets(s, t, 0x341);
+	if (rx.s == 0 && rx.t == 0)
+		printf("ok.\n");
+	else {
+		printf("failure!\n");
+		return 1;
+	}
+
+	/* check loopback 0 recv_own_msgs 1 */
+	setopts(s, 0, 1);
+	rx = test_sockets(s, t, 0x342);
+	if (rx.s == 0 && rx.t == 0)
+		printf("ok.\n");
+	else {
+		printf("failure!\n");
+		return 1;
+	}
+
+	/* check loopback 1 recv_own_msgs 0 */
+	setopts(s, 1, 0);
+	rx = test_sockets(s, t, 0x343);
+	if (rx.s == 0 && rx.t == 1)
+		printf("ok.\n");
+	else {
+		printf("failure!\n");
+		return 1;
+	}
+
+	/* check loopback 1 recv_own_msgs 1 */
+	setopts(s, 1, 1);
+	rx = test_sockets(s, t, 0x344);
+	if (rx.s == 1 && rx.t == 1)
+		printf("ok.\n");
+	else {
+		printf("failure!\n");
+		return 1;
+	}
+
+	printf("PF_CAN frame flow test was successful.\n");
+
+	close(s);
+	close(t);
+
+	return 0;
+}

^ permalink raw reply related

* Re: [PATCH] iproute2: Check getline() return code correctly
From: Stephen Hemminger @ 2011-07-11 17:37 UTC (permalink / raw)
  To: Petr Sabata; +Cc: netdev
In-Reply-To: <1307710167-28868-1-git-send-email-contyk@redhat.com>

On Fri, 10 Jun 2011 14:49:27 +0200
Petr Sabata <contyk@redhat.com> wrote:

> The current implementation is always false, no matter what happens.
> 
> Signed-off-by: Petr Sabata <contyk@redhat.com>
> ---
>  lib/utils.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/utils.c b/lib/utils.c
> index 1b42222..76cadea 100644
> --- a/lib/utils.c
> +++ b/lib/utils.c
> @@ -702,7 +702,7 @@ ssize_t getcmdline(char **linep, size_t *lenp, FILE *in)
>  		size_t len1 = 0;
>  		size_t cc1;
>  
> -		if ((cc1 = getline(&line1, &len1, in)) < 0) {
> +		if ((cc1 = getline(&line1, &len1, in)) == (size_t)-1) {
>  			fprintf(stderr, "Missing continuation line\n");
>  			return cc1;
>  		}

The correct fix is to make cc1 a signed variable.

^ permalink raw reply

* Crash in e1000e driver, 3.0-rc6+
From: Ben Greear @ 2011-07-11 18:10 UTC (permalink / raw)
  To: netdev

This is lightly patched with some NFS related patches.  This was
shortly after boot..I don't think we had even done any real NFS
work yet.

The warning we see fairly often..the crash below is new.

I just pulled and re-built, so it's possible that the code listings
below are not 100% accurate.


Reading symbols from /home/greearb/kernel/2.6/linux-3.0.x64-dbg-nfs/drivers/net/e1000e/e1000e.ko...done.
(gdb) l *(e1000e_reinit_locked+0x5f)
0x11696 is in e1000_reset_task (/home/greearb/git/linux-3.0-nfs/drivers/net/e1000e/netdev.c:4933).
4928		adapter->tx_timeout_count++;
4929		schedule_work(&adapter->reset_task);
4930	}
4931	
4932	static void e1000_reset_task(struct work_struct *work)
4933	{
4934		struct e1000_adapter *adapter;
4935		adapter = container_of(work, struct e1000_adapter, reset_task);
4936	
4937		/* don't run the task if already down */
(gdb) l *(e1000_alloc_rx_buffers+0x58)
0x12ab6 is in e1000_alloc_rx_buffers (/home/greearb/git/linux-3.0-nfs/drivers/net/e1000e/netdev.c:540).
535	
536		i = rx_ring->next_to_use;
537		buffer_info = &rx_ring->buffer_info[i];
538	
539		while (cleaned_count--) {
540			skb = buffer_info->skb;
541			if (skb) {
542				skb_trim(skb, 0);
543				goto map_skb;
544			}
(gdb)


------------[ cut here ]------------
WARNING: at /home/greearb/git/linux-3.0-nfs/drivers/net/e1000e/netdev.c:3723 e1000_close+0x3a/0x107 [e1000e]()
Hardware name: X7DBU
Modules linked in: macvlan pktgen iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi fuse ip6table_filter ip6_tables ebtable_nat ]
Pid: 2404, comm: ip Not tainted 3.0.0-rc6+ #20
Call Trace:
  [<ffffffff81049f72>] warn_slowpath_common+0x80/0x98
  [<ffffffff81049f9f>] warn_slowpath_null+0x15/0x17
  [<ffffffffa024e25e>] e1000_close+0x3a/0x107 [e1000e]
  [<ffffffff813c30e9>] __dev_close_many+0x9b/0xcc
  [<ffffffff813c3149>] __dev_close+0x2f/0x44
  [<ffffffff813c154a>] __dev_change_flags+0xb9/0x13c
  [<ffffffff813c39b3>] dev_change_flags+0x1c/0x51
  [<ffffffff813d1071>] do_setlink+0x2b8/0x78b
  [<ffffffff810c57fe>] ? __perf_event_task_sched_out+0x30b/0x33e
  [<ffffffff813d186f>] rtnl_newlink+0x261/0x4b2
  [<ffffffff813d16ac>] ? rtnl_newlink+0x9e/0x4b2
  [<ffffffff8147d801>] ? __mutex_lock_common+0x3bc/0x46d
  [<ffffffff81041b91>] ? get_parent_ip+0x11/0x41
  [<ffffffff81481c8d>] ? sub_preempt_count+0x92/0xa6
  [<ffffffff813d0ad5>] rtnetlink_rcv_msg+0x1cf/0x1ec
  [<ffffffff813d0906>] ? rtnetlink_rcv+0x28/0x28
  [<ffffffff813e49b4>] netlink_rcv_skb+0x3e/0x8f
  [<ffffffff813d08ff>] rtnetlink_rcv+0x21/0x28
  [<ffffffff813e478f>] netlink_unicast+0xe9/0x152
  [<ffffffff813e4f56>] netlink_sendmsg+0x240/0x25e
  [<ffffffff813b4716>] ? rcu_read_unlock+0x21/0x23
  [<ffffffff813af67a>] __sock_sendmsg_nosec+0x58/0x61
  [<ffffffff813b0db5>] __sock_sendmsg+0x3d/0x48
  [<ffffffff813b1631>] sock_sendmsg+0xa3/0xbc
  [<ffffffff8107b06e>] ? lock_release_non_nested+0x9d/0x227
  [<ffffffff810e646f>] ? might_fault+0x4e/0x9e
  [<ffffffff810e64b8>] ? might_fault+0x97/0x9e
  [<ffffffff813baf02>] ? copy_from_user+0x2a/0x2c
  [<ffffffff813bb2d4>] ? verify_iovec+0x4f/0xa3
  [<ffffffff813b1e03>] __sys_sendmsg+0x1d8/0x243
  [<ffffffff8106b7f0>] ? up_read+0x1e/0x36
  [<ffffffff8111a3c6>] ? fcheck_files+0xb7/0xee
  [<ffffffff8111a4e9>] ? fget_light+0x35/0xac
  [<ffffffff813b1fc6>] sys_sendmsg+0x3d/0x5b
  [<ffffffff81484d52>] system_call_fastpath+0x16/0x1b
---[ end trace cddc6b4ca68ac6e8 ]---
e1000e: eth3 NIC Link is Down
e1000e: eth10 NIC Link is Down
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa024ea92>] e1000_alloc_rx_buffers+0x58/0x14a [e1000e]
PGD 0
Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
CPU 0
Modules linked in: macvlan pktgen iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi fuse ip6table_filter ip6_tables ebtable_nat ]

Pid: 2367, comm: kworker/0:2 Tainted: G        W   3.0.0-rc6+ #20 Supermicro X7DBU/X7DBU
RIP: 0010:[<ffffffffa024ea92>]  [<ffffffffa024ea92>] e1000_alloc_rx_buffers+0x58/0x14a [e1000e]
RSP: 0018:ffff8801143ddc70  EFLAGS: 00010206
RAX: ffff880128b08090 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000100 RSI: 00000000000000ff RDI: ffff880122d3c900
RBP: ffff8801143ddcc0 R08: ffff8801143ddb80 R09: ffff8801143ddbe0
R10: dead000000200200 R11: dead000000100100 R12: ffff880122d3c900
R13: 0000000000000000 R14: ffff880122818558 R15: 00000000000000ff
FS:  0000000000000000(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000008 CR3: 0000000001a03000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process kworker/0:2 (pid: 2367, threadinfo ffff8801143dc000, task ffff8801259267e0)
Stack:
  ffff880122d3c900 ffff880122d3c000 000005f222818558 ffff880128b08090
  ffff8801143ddca0 ffff880122d3c900 ffff880122818558 0000000000001000
  0000000004008002 ffffffffa024d672 ffff8801143ddcf0 ffffffffa024a795
Call Trace:
  [<ffffffffa024d672>] ? e1000e_reinit_locked+0x5f/0x5f [e1000e]
  [<ffffffffa024a795>] e1000_configure+0x507/0x510 [e1000e]
  [<ffffffffa024a7af>] e1000e_up+0x11/0xc9 [e1000e]
  [<ffffffffa024d665>] e1000e_reinit_locked+0x52/0x5f [e1000e]
  [<ffffffffa024dd0e>] e1000_reset_task+0x69c/0x6ab [e1000e]
  [<ffffffff8106128e>] ? process_one_work+0x17b/0x41d
  [<ffffffff81041b91>] ? get_parent_ip+0x11/0x41
  [<ffffffffa024d672>] ? e1000e_reinit_locked+0x5f/0x5f [e1000e]
  [<ffffffff81061343>] process_one_work+0x230/0x41d
  [<ffffffff8106128e>] ? process_one_work+0x17b/0x41d
  [<ffffffff8106379f>] worker_thread+0x133/0x217
  [<ffffffff8106366c>] ? manage_workers+0x191/0x191
  [<ffffffff81066f9c>] kthread+0x7d/0x85
  [<ffffffff81485ee4>] kernel_thread_helper+0x4/0x10
  [<ffffffff8147f0d8>] ? retint_restore_args+0x13/0x13
  [<ffffffff81066f1f>] ? __init_kthread_worker+0x56/0x56
  [<ffffffff81485ee0>] ? gs_change+0x13/0x13
Code: 00 00 89 45 c4 41 0f b7 5e 18 48 8b 87 28 05 00 00 41 89 dd 48 05 90 00 00 00 4d 6b ed 28 4d 03 6e 20 48 89 45 c8 e9 d5 00 00
  8b 45 08 48 85 c0 74 14 48 89 c7 31 f6 48 89 45 b0 e8 29 85
RIP  [<ffffffffa024ea92>] e1000_alloc_rx_buffers+0x58/0x14a [e1000e]
  RSP <ffff8801143ddc70>
CR2: 0000000000000008
---[ end trace cddc6b4ca68ac6e9 ]---

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* Bridging behavior apparently changed around the Fedora 14 time
From: Greg Scott @ 2011-07-11 18:25 UTC (permalink / raw)
  To: netdev; +Cc: Lynn Hanson, Joe Whalen

I ran into a strange situation - I am using a firewall set up as a
bridge.  Physical device eth1 is the private LAN side, eth0 is the
public Internet side.  I setup bridge br0 to bridge eth0 and eth1
together.  I need a bridge because this site has a couple of nodes on
the LAN side that need real public IP Addresses.  

This site also has a few web and ftp sites.  These are NATed behind the
firewall, but internal users need to see them the same way as the rest
of the world.  So I use some iptables SNAT and DNAT rules to make this
happen.  Device br0 has the relevant public IP Address(es) and then NATs
to the appropriate private IP Address(es).  The ruleset works and the
system has been up and running for several years.  

I recently replaced the old system with a new one running Fedora 14 and
that's when the weird behavior started.  

Now, when internal people try to look at those web/ftp sites using the
public IP Addresses, they get nowhere.  Unless I watch with tcpdump -
and then while I'm watching , all works as it should.  With some help,
we figured out the reason it works when watching with tcpdump - because
tcpdump puts the device being monitored into promiscuous mode.  

And, sure enough, when I do:
    ip link set br0 promisc on

everything works as it should.

Looking at "ip link show", it looks like bridge br0 takes on the MAC
address of physical NIC eth0.  But the internal LAN is connected to
physical eth1.  I wonder if this behavior is different than the older
version?  If the MAC Address for bridge br0 is different than the
physical device I'm actually connected to, I wonder if bridging "thinks"
I'm trying to hit a foreign MAC Address - especially since I'm doing
both SNAT and DNAT on the same packet?  

[root@ehac-fw2011 ~]# ip link show eth1
4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 00:0d:88:31:d8:24 brd ff:ff:ff:ff:ff:ff
[root@ehac-fw2011 ~]# ip link show eth0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 00:03:47:3a:59:79 brd ff:ff:ff:ff:ff:ff
[root@ehac-fw2011 ~]#
[root@ehac-fw2011 ~]# ip link show br0
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc prio state
UNKNOWN
    link/ether 00:03:47:3a:59:79 brd ff:ff:ff:ff:ff:ff

[root@ehac-fw2011 ~]# brctl show macs br0
bridge name     bridge id               STP enabled     interfaces
br0             8000.0003473a5979       no              eth0
                                                        eth1
Hmmmm - so a packet comes in on eth1, with a destination MAC Address
belonging to physical eth0.  So eth1 throws it away because it "thinks"
this is a foreign MAC Address?  But this all worked before, so what's
different?  Or were earlier bridges in promiscuous mode by default and
now they're not?  Have I stumbled across a new bridging bug?  Is the
best workaround to just put br0 into promiscuous mode?

Thanks

- Greg Scott

^ permalink raw reply

* Re: [PATCH 2/3] iwlegacy: Add missing comma between constant string array
From: John W. Linville @ 2011-07-11 18:35 UTC (permalink / raw)
  To: Joe Perches; +Cc: Stanislaw Gruszka, linux-wireless, netdev, linux-kernel
In-Reply-To: <36f8b5d1a32b8702941ebeda7a406188af132e9e.1310187270.git.joe@perches.com>

How is this array indexed?  Aren't you changing the index of the
later strings?

On Fri, Jul 08, 2011 at 11:20:24PM -0700, Joe Perches wrote:
> Multiple quoted strings are concatenated without comma separators.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/wireless/iwlegacy/iwl4965-base.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
> index 46242d2..1433466 100644
> --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
> +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
> @@ -1484,7 +1484,7 @@ static const char * const desc_lookup_text[] = {
>  	"NMI_INTERRUPT_DATA_ACTION_PT",
>  	"NMI_TRM_HW_ER",
>  	"NMI_INTERRUPT_TRM",
> -	"NMI_INTERRUPT_BREAK_POINT"
> +	"NMI_INTERRUPT_BREAK_POINT",
>  	"DEBUG_0",
>  	"DEBUG_1",
>  	"DEBUG_2",
> -- 
> 1.7.6.131.g99019
> 
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [PATCH 3/3] iwlagn: Add missing comma between constant string array
From: John W. Linville @ 2011-07-11 18:35 UTC (permalink / raw)
  To: Joe Perches
  Cc: Wey-Yi Guy, Intel Linux Wireless, linux-wireless, netdev,
	linux-kernel
In-Reply-To: <2c8a6e15b0f320e4b4b761ae6434862fc3c15924.1310187270.git.joe@perches.com>

How is this array indexed?  Aren't you changing the index of the 
later strings?

On Fri, Jul 08, 2011 at 11:20:25PM -0700, Joe Perches wrote:
> Multiple quoted strings are concatenated without comma separators.
> 
> Make the array const while there.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/wireless/iwlwifi/iwl-agn.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> index 7e6c463..de1a0c1 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -1563,7 +1563,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
>  	release_firmware(ucode_raw);
>  }
>  
> -static const char *desc_lookup_text[] = {
> +static const char * const desc_lookup_text[] = {
>  	"OK",
>  	"FAIL",
>  	"BAD_PARAM",
> @@ -1587,7 +1587,7 @@ static const char *desc_lookup_text[] = {
>  	"NMI_INTERRUPT_DATA_ACTION_PT",
>  	"NMI_TRM_HW_ER",
>  	"NMI_INTERRUPT_TRM",
> -	"NMI_INTERRUPT_BREAK_POINT"
> +	"NMI_INTERRUPT_BREAK_POINT",
>  	"DEBUG_0",
>  	"DEBUG_1",
>  	"DEBUG_2",
> -- 
> 1.7.6.131.g99019
> 
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [PATCH] iproute2: fix minor typo in comments
From: Nicolas de Pesloüan @ 2011-07-11 19:31 UTC (permalink / raw)
  To: Gilles Espinasse; +Cc: netdev, shemminger
In-Reply-To: <1310312737-2296-1-git-send-email-g.esp@free.fr>

Le 10/07/2011 17:45, Gilles Espinasse a écrit :
> Signed-off-by: Gilles Espinasse<g.esp@free.fr>

[...]

> -#check if we need dont our internal header ..
> +#check if we dont need our internal header ..

While you fix this one, "dont" should become "don't".

	Nicolas.


^ permalink raw reply

* [PATCH] [PATCH] Fix deadlock in af_packet while stressing raw ethernet socket interface
From: Ronny Meeus @ 2011-06-11  5:04 UTC (permalink / raw)
  To: netdev

I was running a test: 1 application was sending raw Ethernet packets on a physical looped interface while a second application was receiving packets, so the latter application receives each packet 2 times (once while sending from the context of the first application and a second time while receiving from the hardware).
After some time, the test blocks due to a spinlock reentrance issue in af_packet. Both the sending application and the softIRQ receiving packets enter the spinlock code. After applying the patch below, the issue is resolved.

Signed-off-by: Ronny Meeus <ronny.meeus@gmail.com>

---
 net/packet/af_packet.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -r ab5136256418 -r 78567a0a1d29 net/packet/af_packet.c
--- a/net/packet/af_packet.c	Fri Jun 10 20:31:07 2011 +0200
+++ b/net/packet/af_packet.c	Sat Jun 11 07:03:55 2011 +0200
@@ -618,11 +618,11 @@
 	/* drop conntrack reference */
 	nf_reset(skb);
 
-	spin_lock(&sk->sk_receive_queue.lock);
+	spin_lock_bh(&sk->sk_receive_queue.lock);
 	po->stats.tp_packets++;
 	skb->dropcount = atomic_read(&sk->sk_drops);
 	__skb_queue_tail(&sk->sk_receive_queue, skb);
-	spin_unlock(&sk->sk_receive_queue.lock);
+	spin_unlock_bh(&sk->sk_receive_queue.lock);
 	sk->sk_data_ready(sk, skb->len);
 	return 0;
 
@@ -718,7 +718,7 @@
 			snaplen = 0;
 	}
 
-	spin_lock(&sk->sk_receive_queue.lock);
+	spin_lock_bh(&sk->sk_receive_queue.lock);
 	h.raw = packet_current_frame(po, &po->rx_ring, TP_STATUS_KERNEL);
 	if (!h.raw)
 		goto ring_is_full;
@@ -730,7 +730,7 @@
 	}
 	if (!po->stats.tp_drops)
 		status &= ~TP_STATUS_LOSING;
-	spin_unlock(&sk->sk_receive_queue.lock);
+	spin_unlock_bh(&sk->sk_receive_queue.lock);
 
 	skb_copy_bits(skb, 0, h.raw + macoff, snaplen);
 
@@ -816,7 +816,7 @@
 
 ring_is_full:
 	po->stats.tp_drops++;
-	spin_unlock(&sk->sk_receive_queue.lock);
+	spin_unlock_bh(&sk->sk_receive_queue.lock);
 
 	sk->sk_data_ready(sk, 0);
 	kfree_skb(copy_skb);

^ permalink raw reply

* [PATCH] e1000e: remove e1000_queue_stats
From: Eric Dumazet @ 2011-07-11 20:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jeff Kirsher, Jesse Brandeburg

struct e1000_queue_stats is not used, lets remove it

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/e1000e/e1000.h |    7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c1e7f94..e9d6e0a 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -199,11 +199,6 @@ enum e1000_boards {
 	board_pch2lan,
 };
 
-struct e1000_queue_stats {
-	u64 packets;
-	u64 bytes;
-};
-
 struct e1000_ps_page {
 	struct page *page;
 	u64 dma; /* must be u64 - written to hw */
@@ -257,8 +252,6 @@ struct e1000_ring {
 	int set_itr;
 
 	struct sk_buff *rx_skb_top;
-
-	struct e1000_queue_stats stats;
 };
 
 /* PHY register snapshot values */



^ permalink raw reply related

* Re: Bridging behavior apparently changed around the Fedora 14 time
From: Stephen Hemminger @ 2011-07-11 20:07 UTC (permalink / raw)
  To: Greg Scott; +Cc: netdev, Lynn Hanson, Joe Whalen
In-Reply-To: <925A849792280C4E80C5461017A4B8A2A040F0@mail733.InfraSupportEtc.com>

On Mon, 11 Jul 2011 13:25:46 -0500
"Greg Scott" <GregScott@Infrasupport.com> wrote:

> I ran into a strange situation - I am using a firewall set up as a
> bridge.  Physical device eth1 is the private LAN side, eth0 is the
> public Internet side.  I setup bridge br0 to bridge eth0 and eth1
> together.  I need a bridge because this site has a couple of nodes on
> the LAN side that need real public IP Addresses.  
> 
> This site also has a few web and ftp sites.  These are NATed behind the
> firewall, but internal users need to see them the same way as the rest
> of the world.  So I use some iptables SNAT and DNAT rules to make this
> happen.  Device br0 has the relevant public IP Address(es) and then NATs
> to the appropriate private IP Address(es).  The ruleset works and the
> system has been up and running for several years.  
> 
> I recently replaced the old system with a new one running Fedora 14 and
> that's when the weird behavior started.  
> 
> Now, when internal people try to look at those web/ftp sites using the
> public IP Addresses, they get nowhere.  Unless I watch with tcpdump -
> and then while I'm watching , all works as it should.  With some help,
> we figured out the reason it works when watching with tcpdump - because
> tcpdump puts the device being monitored into promiscuous mode.  
> 
> And, sure enough, when I do:
>     ip link set br0 promisc on
> 
> everything works as it should.

Please provide more configuration information like:
  - NIC type
  - iptables and bridge and address configuration

Do you have reverse path filtering enabled/disabled?


^ permalink raw reply

* RE: [PATCH] e1000e: remove e1000_queue_stats
From: Allan, Bruce W @ 2011-07-11 20:18 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev, Kirsher, Jeffrey T, Brandeburg, Jesse
In-Reply-To: <1310414440.2860.9.camel@edumazet-laptop>

>-----Original Message-----
>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On
>Behalf Of Eric Dumazet
>Sent: Monday, July 11, 2011 1:01 PM
>To: David Miller
>Cc: netdev; Kirsher, Jeffrey T; Brandeburg, Jesse
>Subject: [PATCH] e1000e: remove e1000_queue_stats
>
>struct e1000_queue_stats is not used, lets remove it
>
>Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>---
> drivers/net/e1000e/e1000.h |    7 -------
> 1 file changed, 7 deletions(-)
>
>diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
>index c1e7f94..e9d6e0a 100644
>--- a/drivers/net/e1000e/e1000.h
>+++ b/drivers/net/e1000e/e1000.h
>@@ -199,11 +199,6 @@ enum e1000_boards {
> 	board_pch2lan,
> };
>
>-struct e1000_queue_stats {
>-	u64 packets;
>-	u64 bytes;
>-};
>-
> struct e1000_ps_page {
> 	struct page *page;
> 	u64 dma; /* must be u64 - written to hw */
>@@ -257,8 +252,6 @@ struct e1000_ring {
> 	int set_itr;
>
> 	struct sk_buff *rx_skb_top;
>-
>-	struct e1000_queue_stats stats;
> };
>
> /* PHY register snapshot values */

Nothing further needed.

Acked-by: Bruce Allan <bruce.w.allan@intel.com>

^ permalink raw reply

* RE: Bridging behavior apparently changed around the Fedora 14 time
From: Greg Scott @ 2011-07-11 20:41 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Lynn Hanson, Joe Whalen
In-Reply-To: <20110711130729.607d461e@nehalam.ftrdhcpuser.net>

> Please provide more configuration information like:
>  - NIC type
>  - iptables and bridge and address configuration

The NICs are 3Com 3C905B's.  The iptables config is complex - I'll paste
in the relevant pieces.  Note that it all works as expected when I put
the br0 device into promiscuous mode.  I included all the layer 2 MAC
address info in the original email.  

> Do you have reverse path filtering enabled/disabled?

rp_filter doesn't seem to effect the behavior one way or the other.
I've tried with rp_filter set to both 0 and 1 on eth0, eth1, and br0
with no change in behavior.  

Here are the relevant parts of my rc.firewall script:

.
.
.
echo "Setting up aliases for public IP addresses"

/sbin/ifconfig ${BR_IFACE}:0 $PUBLIC_GRE_IP netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
#/sbin/ifconfig ${BR_IFACE}:1 $PUBLIC_EMAIL_IP netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
# EMAIL and GRE share the same IP Address
/sbin/ifconfig ${BR_IFACE}:2 ${PUBLIC_FTP_IP[0]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
/sbin/ifconfig ${BR_IFACE}:3 ${PUBLIC_FTP_IP[1]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
/sbin/ifconfig ${BR_IFACE}:4 ${PUBLIC_FTP_IP[2]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
/sbin/ifconfig ${BR_IFACE}:5 ${PUBLIC_FTP_IP[3]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
#/sbin/ifconfig ${BR_IFACE}:6 ${PUBLIC_VTC_IP[0]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
#/sbin/ifconfig ${BR_IFACE}:7 ${PUBLIC_VTC_IP[1]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
# The VTC devices are now bridged.  They have their own IP Addresses.
#/sbin/ifconfig ${BR_IFACE}:8 ${PUBLIC_WEB_IP[0]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
#/sbin/ifconfig ${BR_IFACE}:9 ${PUBLIC_WEB_IP[1]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
#/sbin/ifconfig ${BR_IFACE}:10 ${PUBLIC_WEB_IP[2]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
#/sbin/ifconfig ${BR_IFACE}:11 ${PUBLIC_WEB_IP[3]} netmask $INET_NETMASK
broadcast $INET_BCAST_ADDRESS
# Web and FTP sites have the same addresses.

echo "ARPinging the world so everyone knows our MAC Addresses"
/sbin/arping -A $INET_IP -c 1 -I $BR_IFACE
/sbin/arping -A $PUBLIC_GRE_IP -c 1 -I $BR_IFACE
for ADR in "${PUBLIC_FTP_IP[@]}"; do
    /sbin/arping -A $ADR -c 1 -I $BR_IFACE
done
for ADR in "${PUBLIC_WWW_IP[@]}"; do
    /sbin/arping -A $ADR -c 1 -I $BR_IFACE
done

/sbin/arping -A $TRUSTED1_IP -c 1 -I $BR_IFACE

/sbin/arping -A $DMZ_IP -c 1 -I $DMZ_IFACE
.
.
.
echo "	MASQUERADING requests to the internally hosted server apps"
echo "	(Email - SMTP, POP3, IMAP, OWA)"
$IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 25 -d $PRIVATE_EMAIL_IP -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 110 -d $PRIVATE_EMAIL_IP -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 143 -d $PRIVATE_EMAIL_IP -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 80 -d $PRIVATE_EMAIL_IP -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 443 -d $PRIVATE_EMAIL_IP -j MASQUERADE

echo "	(Internally hosted ftp sites)"
for ADR in "${PUBLIC_FTP_IP[@]}"; do
    $IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 21 -d $ADR -j MASQUERADE
done

echo "	(Internally hosted web sites)"
for ADR in "${PUBLIC_WWW_IP[@]}"; do
    $IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 80 -d $ADR -j MASQUERADE
    $IPTABLES -t nat -A POSTROUTING -s $TRUSTED1_IP_RANGE -o $BR_IFACE \
	-p TCP --dport 443 -d $ADR -j MASQUERADE
done
.
.
.
echo "	FTP sites (port 21 inbound)"
for ADR in "${PRIVATE_FTP_IP[@]}"; do
    $IPTABLES -A FORWARD -p TCP --dport 21 -s 0/0 -d $ADR -j allowed 
done

echo "	Web (HTTP) sites (port 80 inbound)"
for ADR in "${PRIVATE_WWW_IP[@]}"; do
    $IPTABLES -A FORWARD -p TCP --dport 80 -s 0/0 -d $ADR -j allowed 
done
.
.
.

echo "	FTP sites (TCP port 21)"
for ((i = 0 ; i < ${#PUBLIC_FTP_IP[@]} ; i++ ))
do
    $IPTABLES -t nat -A PREROUTING -d ${PUBLIC_FTP_IP[i]} \
	-p tcp --dport 21 -j DNAT --to ${PRIVATE_FTP_IP[i]}
	# -m mark --mark 1 (from the Internet) removed so we
	# DNAT for internal users also.
done

echo "	Web (HTTP) sites (TCP port 80)"
for ((i = 0 ; i < ${#PUBLIC_WWW_IP[@]} ; i++ ))
do
    $IPTABLES -t nat -A PREROUTING -d ${PUBLIC_WWW_IP[i]} \
	-p tcp --dport 80 -j DNAT --to ${PRIVATE_WWW_IP[i]}
	# -m mark --mark 1 (from the Internet) removed so we
	# DNAT for internal users also.
done

echo "  Email - SMTP, POP3, IMAP, OWA; provision for internal users"
$IPTABLES -t nat -A PREROUTING -d $PUBLIC_EMAIL_IP \
		-p tcp --dport 25 -j DNAT --to $PRIVATE_EMAIL_IP
$IPTABLES -t nat -A PREROUTING -d $PUBLIC_EMAIL_IP \
		-p tcp --dport 110 -j DNAT --to $PRIVATE_EMAIL_IP
$IPTABLES -t nat -A PREROUTING -d $PUBLIC_EMAIL_IP \
		-p tcp --dport 143 -j DNAT --to $PRIVATE_EMAIL_IP
$IPTABLES -t nat -A PREROUTING -d $PUBLIC_EMAIL_IP \
		-p tcp --dport 80 -j DNAT --to $PRIVATE_EMAIL_IP
$IPTABLES -t nat -A PREROUTING -d $PUBLIC_EMAIL_IP \
		-p tcp --dport 443 -j DNAT --to $PRIVATE_EMAIL_IP


As a benchmark test, from an internal host, I'll do telnet {public IP}
80.  And then listen in another window on the firewall with tcpdump.
Once we came across the promiscuous mode theory, we tried tcpdump with
-e and -p.  -e shows layer 2 stuff and -p does not put the device into
promiscuous mode.  Here is what we found:

For my testing, from a CMD window on the server hosting the website, I
do:

telnet aa.bb.115.151 80 (aa.bb obfuscated first 2 IP Address octets),
and then watch with tcpdump on the firewall.  

Also on the firewall, I did this:
echo "0" > /proc/sys/net/ipv4/conf/eth0/rp_filter
echo "0" > /proc/sys/net/ipv4/conf/eth1/rp_filter
echo "0" > /proc/sys/net/ipv4/conf/br0/rp_filter

So that turned of any possible rp_filtering.  

And then on the firewall:
/usr/sbin/tcpdump -p -e -i br0 host aa.bb.115.151 -nn -vv

while the telnet was running in another window.

Nothing - no output, no matter what value I use for any of the rp_filter
files.  Nothing from my telnet session to port 80 hits bridge br0 on the
firewall.  

But here's the curious part - looking at physical interface eth1, I see
these packets when I do the same telnet test:

[root@ehac-fw2011 ~]# /usr/sbin/tcpdump -p -e -i eth1 host aa.bb.115.151
-nn -vv
tcpdump: WARNING: eth1: no IPv4 address assigned
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size
65535 bytes
14:51:33.412280 00:0f:20:f7:06:18 > 00:03:47:3a:59:79, ethertype IPv4
(0x0800), length 62: (tos 0x0, ttl 128, id 18631, offset 0, flags [DF],
proto TCP (6), length 48)
    192.168.10.2.54092 > aa.bb.115.151.80: Flags [S], cksum 0xddb2
(correct), seq 4146878900, win 65535, options [mss 1460,nop,nop,sackOK],
length 0
14:51:39.427928 00:0f:20:f7:06:18 > 00:03:47:3a:59:79, ethertype IPv4
(0x0800), length 62: (tos 0x0, ttl 128, id 18733, offset 0, flags [DF],
proto TCP (6), length 48)
    192.168.10.2.54092 > aa.bb.115.151.80: Flags [S], cksum 0xddb2
(correct), seq 4146878900, win 65535, options [mss 1460,nop,nop,sackOK],
length 0 ^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel
[root@ehac-fw2011 ~]#


So for some reason, the bridging stuff is apparently not passing from
eth1 to br0.  The single, one and only change to make this work is:

ip link set br0 promisc on

When I do above, then the internal packets to external IP Addresses flow
out to the firewall and back in as expected.  

Did bridging used to put the bridge device into promiscuous mode by
default and now it doesn't?  Just trying to figure out what's different.


thanks

- Greg Scott

^ permalink raw reply

* sch_generic warn_on (timed out)
From: Dave Jones @ 2011-07-11 20:48 UTC (permalink / raw)
  To: netdev

We've recieved quite a few bug reports in Fedora recently concerning this warning in
sch_generic..

            WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n",
                      dev->name, netdev_drivername(dev, drivername, 64), i);

https://bugzilla.redhat.com/show_bug.cgi?id=702723 is our 'master bug' that we're
duping all others against. It seems to be showing up on a variety of different
hardware (r8169, atl1c, ipheth, e1000e, 8139too). Do all these drivers need
fixing ? or is it just 'crap hardware' ?

note that I've only been looking through fedora 15 bugs so far (which is still on 2.6.38),
but looking at the commit log for sch_generic, it doesn't seem that there's anything
obvious that needs backporting.

thanks,

	Dave

^ permalink raw reply

* Re: Bridging behavior apparently changed around the Fedora 14 time
From: Stephen Hemminger @ 2011-07-11 20:49 UTC (permalink / raw)
  To: Greg Scott; +Cc: netdev, Lynn Hanson, Joe Whalen
In-Reply-To: <925A849792280C4E80C5461017A4B8A2A040F3@mail733.InfraSupportEtc.com>

On Mon, 11 Jul 2011 15:41:35 -0500
"Greg Scott" <GregScott@Infrasupport.com> wrote:

> The NICs are 3Com 3C905B's.  The iptables config is complex - I'll paste
> in the relevant pieces.  Note that it all works as expected when I put
> the br0 device into promiscuous mode.  I included all the layer 2 MAC
> address info in the original email.  
> 
> > Do you have reverse path filtering enabled/disabled?  
> 
> rp_filter doesn't seem to effect the behavior one way or the other.
> I've tried with rp_filter set to both 0 and 1 on eth0, eth1, and br0
> with no change in behavior.  

What about console dmesg output.
Because you can fix by putting in promiscuous mode, I suspect the
problem is outside of the bridge itself, could be the drivers.
The bridge itself puts the device into promiscuous mode already.

Lastly, the Fedora and upstream kernels are not exactly the same.
Please retest with a standard upstream kernel (like 2.6.39.2).

^ permalink raw reply

* RE: Bridging behavior apparently changed around the Fedora 14 time
From: Greg Scott @ 2011-07-11 21:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Lynn Hanson, Joe Whalen
In-Reply-To: <20110711134938.5178797c@nehalam.ftrdhcpuser.net>

> What about console dmesg output.

I should probably turn off all firewall logging so I don't fill the ring
buffer with my log messages in, like, the first couple minutes after a
boot.  :)

> Please retest with a standard upstream kernel (like 2.6.39.2).

That's gonna take a while to put together a whole test environment with
the latest kernel.org kernel.

> The bridge itself puts the device into promiscuous mode already.

Uhmmmm - no it didn't.  Remember, I put br0 into promiscuous mode myself
by hand - take a look at this.  Note eth0 and eth1 are not in
promiscuous mode.  I wonder how it would behave if I put the physical
devices into promiscuous mode and left br0 alone?  This I can easily
test during off hours.  

[root@ehac-fw2011 gregs]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state
DOWN qlen 1000
    link/ether 00:0e:7f:2d:d0:6e brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 00:03:47:3a:59:79 brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 00:0d:88:31:d8:24 brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc prio
state UNKNOWN
    link/ether 00:03:47:3a:59:79 brd ff:ff:ff:ff:ff:ff
[root@ehac-fw2011 gregs]#
  
- Greg


^ permalink raw reply

* Re: [PATCH 1/2] neigh: Store hash shift instead of mask.
From: David Miller @ 2011-07-11 21:08 UTC (permalink / raw)
  To: mirqus; +Cc: roland, johnwheffner, mj, netdev
In-Reply-To: <CAHXqBFLk5ze9y7htyO+9z7=qcznNjXeuJK5Rs1t2ym=vLqDy5Q@mail.gmail.com>

From: Michał Mirosław <mirqus@gmail.com>
Date: Mon, 11 Jul 2011 13:58:41 +0200

> 2011/7/11 David Miller <davem@davemloft.net>:
>> And mask the hash function result by simply shifting
>> down the "->hash_shift" most significant bits.
>>
>> Currently which bits we use is arbitrary since jhash
>> produces entropy evenly across the whole hash function
>> result.
>>
>> But soon we'll be using universal hashing functions,
>> and in those cases more entropy exists in the higher
>> bits than the lower bits, because they use multiplies.
> 
> You could use some evil shift tricks to cut some instructions if you like. ;-)

If these were fast paths I would seriously consider it :-)

But they really are not.

^ permalink raw reply

* Re: Bridging behavior apparently changed around the Fedora 14 time
From: Stephen Hemminger @ 2011-07-11 21:10 UTC (permalink / raw)
  To: Greg Scott; +Cc: netdev, Lynn Hanson, Joe Whalen
In-Reply-To: <925A849792280C4E80C5461017A4B8A2A040F6@mail733.InfraSupportEtc.com>

On Mon, 11 Jul 2011 16:08:14 -0500
"Greg Scott" <GregScott@Infrasupport.com> wrote:

> > What about console dmesg output.
> 
> I should probably turn off all firewall logging so I don't fill the ring
> buffer with my log messages in, like, the first couple minutes after a
> boot.  :)
> 
> > Please retest with a standard upstream kernel (like 2.6.39.2).
> 
> That's gonna take a while to put together a whole test environment with
> the latest kernel.org kernel.
> 
> > The bridge itself puts the device into promiscuous mode already.

The bridge code calls dev_set_promiscuity() which should
be changing device mode. But it could be that netdev core is 
resetting/changing/breaking that.


^ permalink raw reply

* Re: Bridging behavior apparently changed around the Fedora 14 time
From: Ben Greear @ 2011-07-11 21:16 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Greg Scott, netdev, Lynn Hanson, Joe Whalen
In-Reply-To: <20110711141028.19f0de46@nehalam.ftrdhcpuser.net>

On 07/11/2011 02:10 PM, Stephen Hemminger wrote:
> On Mon, 11 Jul 2011 16:08:14 -0500
> "Greg Scott"<GregScott@Infrasupport.com>  wrote:
>
>>> What about console dmesg output.
>>
>> I should probably turn off all firewall logging so I don't fill the ring
>> buffer with my log messages in, like, the first couple minutes after a
>> boot.  :)
>>
>>> Please retest with a standard upstream kernel (like 2.6.39.2).
>>
>> That's gonna take a while to put together a whole test environment with
>> the latest kernel.org kernel.
>>
>>> The bridge itself puts the device into promiscuous mode already.
>
> The bridge code calls dev_set_promiscuity() which should
> be changing device mode. But it could be that netdev core is
> resetting/changing/breaking that.

Last time I checked, 'ifconfig' and similar output didn't
show promisc when NIC was actually promisc, unless the user
specified the promisc-ness.

You can read /sys/class/net/dev/eth0/flags and
see if flag 0x100 is set..if so, it's promisc.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox