# packets seen by tcpdump but not on ethernet



## schmurfy (Oct 22, 2010)

Hello,
I came upon a really strange and highly annoying problem and I now am trying for some days trying to reproduce it but sadly cannot, it only happens on remote sites...

My setup is as follow:
- soekris NET4501 box
- FreeBSD 8.0
- netgraph enabled with a rather simple graph shown below
- no firewall enabled (I use pf but disabled it to ensure it was not the problem source)

The symptoms are that a "tcpdump -plni sis0" see outgoing packets to the ethernet interface but on the other side the computers do not receive them (I managed to reproduce once in my test environment and the network card led was not even blinking). The packets trying to go out on the interface are dhcp answer but I reproduced it with a simple ping, after ensuring that the route taken was the righ one ( route -n get <ip> ).

At first I looked at netgraph for a possible cause but my graph is not so complex and the packets pass all the way throught ith and seem to be dropped after exiting it (after some tests my undestanding is that tcpdump listen between the lower hook of the netgraph ether node and the actual physical network, correct me if I am wrong on that).



My netgraph configuration filter incoming dhcp requests from sis0 interface and:
- send them to ngeth0 if they match a specific pattern
- send them to ngeth1 otherwise
On the other way all packets from ngeth0 and ngeth1 are forwarded to the lower hook of sis0 to reach the network.

This works very well in tests but for some reasons it can fails too as said above, after reviewing my netgraph config I cannot find any flaw in it yet I have packets dropped, it may have nothing to do with netgraph but if that is the case it is even scarier :\

Here is my netgraph config (I think a schema is far more easier to read than the text version):






And for the explanations:
bpf0 contains the filter "dst port 67 and dst 255.255.255.255" which match dhcp requests, if it does not match the packet is not touched and go to sis0:upper hook.

bpf1 contains a filter matching specific equipments by checking the text fields of the dhcp request, if it match packet goes to ngeth0 otherwise ngeth1.


Any help will be greatly appreciated, I now have a complete embedded platform but having some packets dropped is not an option when installed on a client's site and I am completely lost on what could cause that.


----------



## schmurfy (Oct 26, 2010)

I found the answer, I will write it here for anyone who might come here with similar problem:

The default ethernet address of virtual interfaces (ng_eiface) is 00:00:00:00:00:00, with a schema like mine above any packet written to ngeth0 or ngeth1 will exit sis0 with this ethernet address.

After it exits through sis0 it all depends on the equipments behind the box, some switch seems to not care much about a packet with a null ethernet address where others drop them, the simple solution is to enable autosrc on the sis0 ng_ether node:

[CMD="ngctl"] msg sis0: setautosrc 1[/CMD]

All packets exiting through sis0 after this change will get the sis0 ethernet address.

The problem is that when you observe that you will get different behavior with different hardware switch with leads to a debugging nightmare x(


----------

