3

I'm writing a rather elaborated software working on almost-exclusive layer-2 Ethernet. The system is really downcut - kernel has no filesystems, no IP stack (yep, just Ethernet drivers and CONFIG_PACKET - I implemented rudimentary ARP and IP with no fragmentation, no routing tables, etc). I capture and emit packets using PACKET_MMAP, and it works damn well.

I have one little problem. I'd love to capture and emit both VLAN tagged and untagged packets. IOCTLs used by vconfig and friends create new virtual Ethernet device for each vlan. I need no such functionality - I just need a catch-all on one side and emit-as-is on the other.

This could be probably achieved by giving NIC a right punch. I browsed through source code (I have twin VIA Velocity on-board) and found no clues on how to kill VLAN filter.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
  • So, if you don't configure any VLANs on the interface, and do a PF_PACKET socket capture, you aren't seeing both VLAN-tagged and non-VLAN-tagged packets? –  Feb 11 '14 at 02:10
  • If I don't configure VLAN I see only untagged packets (as expected). Tagged ones are discarded somewhere (NIC hardware/NIC driver/kernel). OTOH I'd like to catch all 4096 possibe VLAN tags, so creating 2x4096 virtual NICs is not quite an option... – Pawel Kraszewski Feb 11 '14 at 06:12
  • You can try turning on promiscous mode on your interface, by: – xzhao28 Feb 21 '14 at 10:15
  • @xzhao28 : Neh, cards already operate in promisc mode. I'm sure of it. They operate as a sort of bridge and - additionaly - kernel log confirms switching promisc on. – Pawel Kraszewski Feb 21 '14 at 14:10
  • @Pawel: Then I guess there would be no easy way to acchieve what you want, unless modifying your NIC driver code. I used to do this in my dayjob, just enable all entries in NIC HW vlan table. And "vconfig" just enable one entry – xzhao28 Feb 21 '14 at 15:03
  • @Pawel: I guess, for some NIC, its promisc mode prevail its VLAN func, for some other, its VLAN filtering prevail its promisc mode. I guess your NIC is the latter kind. Well, in my daytime job thing, I just modify my NIC driver to enable all VLAN table entries and promiscous mode at the same time, and we don't use native Linux native VLAN framework and "vconfig", so didn't meet problems like you. – xzhao28 Feb 21 '14 at 15:10

0 Answers0