Re: bpf_mtap_stripvlan

2014-07-10 Thread Henning Brauer
I committed the bpf chunk, but nothing is using it yet. pls give the
if_vlan.c chunk a spin.

Index: net/if_vlan.c
===
RCS file: /cvs/src/sys/net/if_vlan.c,v
retrieving revision 1.106
diff -u -p -r1.106 if_vlan.c
--- net/if_vlan.c   9 Jul 2014 09:30:49 -   1.106
+++ net/if_vlan.c   9 Jul 2014 14:09:43 -
@@ -213,7 +213,7 @@ vlan_start(struct ifnet *ifp)
 
 #if NBPFILTER  0
if (ifp-if_bpf)
-   bpf_mtap(ifp-if_bpf, m, BPF_DIRECTION_OUT);
+   bpf_mtap_stripvlan(ifp-if_bpf, m, BPF_DIRECTION_OUT);
 #endif
 
/*


* Henning Brauer hb-openbsdt...@ml.bsws.de [2014-07-09 23:46]:
 so dlg noticed that tcpdump on vlan is now somewhat busted,
 specifically dhc* don't work on the any more. the reason is that bpf
 now sees the ether_vlan_header instead of the ether_header. only
 visible if your NIC does NOT have hw vlan tagging.
 reason: while we previously would prepend an ethernet header in
 ether_output and way later in vlan_start throw the ethernet header
 away again, replacing it by an ether_vlan_header, we now add the
 ether_vlan_header in ether_output already. the mtap is in vlan_start,
 aka after.
 now removing the ether_vlan_header and either prepending a new
 ether_header or calling bpf_mtap_ether which adds a fake one didn't
 seem too smart. so I made a bpf_mcopy_stripvlan which, well, cuts
 those extra 4 bytes out.
 
 the if_ethersubr.c chunk eases testing, it'll make us hit the right
 codepath wether the hw has tagging or not. that chunk not to be
 committed of course.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services GmbH, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS. Virtual  Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/



Re: bpf_mtap_stripvlan

2014-07-10 Thread Stuart Henderson
On 2014/07/10 13:11, Henning Brauer wrote:
 I committed the bpf chunk, but nothing is using it yet. pls give the
 if_vlan.c chunk a spin.

I think weerd@ might need something similar for bridge for his tv...

 Index: net/if_vlan.c
 ===
 RCS file: /cvs/src/sys/net/if_vlan.c,v
 retrieving revision 1.106
 diff -u -p -r1.106 if_vlan.c
 --- net/if_vlan.c 9 Jul 2014 09:30:49 -   1.106
 +++ net/if_vlan.c 9 Jul 2014 14:09:43 -
 @@ -213,7 +213,7 @@ vlan_start(struct ifnet *ifp)
  
  #if NBPFILTER  0
   if (ifp-if_bpf)
 - bpf_mtap(ifp-if_bpf, m, BPF_DIRECTION_OUT);
 + bpf_mtap_stripvlan(ifp-if_bpf, m, BPF_DIRECTION_OUT);
  #endif
  
   /*
 
 
 * Henning Brauer hb-openbsdt...@ml.bsws.de [2014-07-09 23:46]:
  so dlg noticed that tcpdump on vlan is now somewhat busted,
  specifically dhc* don't work on the any more. the reason is that bpf
  now sees the ether_vlan_header instead of the ether_header. only
  visible if your NIC does NOT have hw vlan tagging.
  reason: while we previously would prepend an ethernet header in
  ether_output and way later in vlan_start throw the ethernet header
  away again, replacing it by an ether_vlan_header, we now add the
  ether_vlan_header in ether_output already. the mtap is in vlan_start,
  aka after.
  now removing the ether_vlan_header and either prepending a new
  ether_header or calling bpf_mtap_ether which adds a fake one didn't
  seem too smart. so I made a bpf_mcopy_stripvlan which, well, cuts
  those extra 4 bytes out.
  
  the if_ethersubr.c chunk eases testing, it'll make us hit the right
  codepath wether the hw has tagging or not. that chunk not to be
  committed of course.
 
 -- 
 Henning Brauer, h...@bsws.de, henn...@openbsd.org
 BS Web Services GmbH, http://bsws.de, Full-Service ISP
 Secure Hosting, Mail and DNS. Virtual  Dedicated Servers, Root to Fully 
 Managed
 Henning Brauer Consulting, http://henningbrauer.com/
 



Re: bpf_mtap_stripvlan

2014-07-10 Thread Paul de Weerd
On Thu, Jul 10, 2014 at 01:30:29PM +0100, Stuart Henderson wrote:
| On 2014/07/10 13:11, Henning Brauer wrote:
|  I committed the bpf chunk, but nothing is using it yet. pls give the
|  if_vlan.c chunk a spin.
| 
| I think weerd@ might need something similar for bridge for his tv...

I'm testing this diff later today or tomorrow...

-- 
[++-]+++.+++[---].+++[+
+++-].++[-]+.--.[-]
 http://www.weirdnet.nl/ 



Re: bpf_mtap_stripvlan

2014-07-10 Thread Henning Brauer
* Stuart Henderson st...@openbsd.org [2014-07-10 14:30]:
 On 2014/07/10 13:11, Henning Brauer wrote:
  I committed the bpf chunk, but nothing is using it yet. pls give the
  if_vlan.c chunk a spin.
 I think weerd@ might need something similar for bridge for his tv...

the f^(*$@)($#@ bridge needs to die. I was told about some
bridging-between-vlans issue yesterday (have no details tho), peeked
into the bridge code and... found vlan tagging code.

Sigh.

whatever else does the job cannot be worse.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services GmbH, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS. Virtual  Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/



Re: bpf_mtap_stripvlan

2014-07-10 Thread Henning Brauer
* Paul de Weerd we...@weirdnet.nl [2014-07-10 14:33]:
 On Thu, Jul 10, 2014 at 01:30:29PM +0100, Stuart Henderson wrote:
 | On 2014/07/10 13:11, Henning Brauer wrote:
 |  I committed the bpf chunk, but nothing is using it yet. pls give the
 |  if_vlan.c chunk a spin.
 | I think weerd@ might need something similar for bridge for his tv...
 I'm testing this diff later today or tomorrow...

can't help the bridge case, not using bpf.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services GmbH, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS. Virtual  Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/