Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Duplicate packets and foward into two NIC: (8 Items)
   
Duplicate packets and foward into two NIC  
I try to duplicate packets and foward into two NIC using pfil, the source code as follow. But the pfil can't catch 
ethernet header. Is any one help me how can catch ethernet header using pfil.
Attachment: Text portmirror140206.rar 632.23 KB
Re: Duplicate packets and foward into two NIC  
See the support ticket for a response.

On 14-02-16 10:38 PM, rich lee wrote:
> I try to duplicate packets and foward into two NIC using pfil, the source code as follow. But the pfil can't catch 
ethernet header. Is any one help me how can catch ethernet header using pfil.
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post108826
> To cancel your subscription to this discussion, please e-mail general-networking-unsubscribe@community.qnx.com

Re: Duplicate packets and foward into two NIC  
I am interesting in this topic, too

The attached jpgs shows that the duplicated outgoing packet did not include the source Ethernet MAC address of the 2nd 
interface. It is very strange situation that the Ethernet driver did not prefix MAC and pass it out directly. 

Does the pfil of QNX is 100% equal to FreeBSD? 
Re: Duplicate packets and foward into two NIC  
The issue was that in the sample provided there's an expectation that 
the full frame was being passed to the output hook in this particular 
case the IP packet was in the mbuf, need to set AF_INET and to set the 
destination IP address so the stack resolves it and prepends the 
ethernet header prior to sending the packet. See the attached sample.
Attachment: Text portmirror.c 6.55 KB
Re: Duplicate packets and foward into two NIC  
The pointer *p address null, so the program crash. What should I write for this pointer? Take destination ip 192.168.1.1
 for example, how to fill-in this p pointer? Or, do you mean take ip from output_hook mbuf?  
Re: Duplicate packets and foward into two NIC  
My patch missed a line:

Add p = mtod(m1, char*); after line 89 (memset()). I have updated the 
support ticket with this same response. See attached file which has the 
correct patch.


Sorry about that.


On 14-02-20 07:24 PM, rich lee wrote:
> The pointer *p address null, so the program crash. What should I write for this pointer? Take destination ip 192.168.1
.1 for example, how to fill-in this p pointer? Or, do you mean take ip from output_hook mbuf?
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post108966
> To cancel your subscription to this discussion, please e-mail general-networking-unsubscribe@community.qnx.com

Attachment: Text portmirror.c 6.57 KB
Re: Duplicate packets and foward into two NIC  
Use new program to send  two NIC  is OK now. But when I break the original line, the mirror line also stop to work. I 
hope when i break the original line , the mirror line can still transmit. How can i do? 
Re: Duplicate packets and foward into two NIC  
I am not sure I understand what you are asking, but I attached and 
updated and simpler version of the port mirroring module. Again it is 
provided as-is, but it works a lot better than my initial version.

On 14-05-08 03:22 AM, rich lee wrote:
> Use new program to send  two NIC  is OK now. But when I break the original line, the mirror line also stop to work. I 
hope when i break the original line , the mirror line can still transmit. How can i do?
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post110211
> To cancel your subscription to this discussion, please e-mail general-networking-unsubscribe@community.qnx.com

Attachment: Text mirror.c 3.21 KB