Discussion:
PtReceiveNBL how to forward packet.
(too old to reply)
ttan
2010-06-30 00:05:25 UTC
Permalink
Hi,

I'm had IM driver with 2 NICs. How do I forward a packet in PtReceiveNBL?

What I'm trying to do is: If I receive a packet, I do checked if this packet
for me I indicated it up. If it not for me I forward the packet on to
another node.

What I have tried and didn't work:
duplicate the packet and used NdisSendNetBufferLists(pAdapt->BindingHandle,
CurrentNetBufferList,
PortNumber,
SendFlags);
to forward this packet.

Can someone help me to get this work? I'm really appreciated.
Thomas F. Divine
2010-06-30 12:54:55 UTC
Permalink
You need to think of this as if you were creating your own packet
(NET_BUFFER) from scratch. So please read and understand the WDK topics
related to "Sending Network Data".

You will need to construct your own NET_BUFFER (for the packet) and
NET_BUFFER_LIST (the packet list).

You must modify the link and network address headers in your new NET_BUFFER
(packet) to have the correct source and destination addresses. There is no
facility at the NDIS level that will do this for you automatically.

If you study the NET_BUFFER description and buffer management functions
carefully you can associate the payload MDLs of the received NET_BUFFER with
the new NET_BUFFER that you will be sending. A simpler approach might be to
create a copy of the payload in memory that you allocate yourself.

You will need to use the context area of your new NET_BUFFER_LIST (or some
other scheme...) to keep a reference to the original received
NET_BUFFER_LIST.

When your send completes you will need to examine the send NET_BUFFER_LIST
context to fetch the original receive NET_BUFFER_LIST and return it. Then
recycle the NET_BUFFER_LIST and other resources that you allocated to send
the redirected packet.

This chat assumes that you are "forwarding" a packet to a different node on
the network (a remote host).

The Devil is in the details, which you must learn for yourself.

Good luck,

Thomas F. Divine
http://www.pcausa.com
Post by ttan
Hi,
I'm had IM driver with 2 NICs. How do I forward a packet in PtReceiveNBL?
What I'm trying to do is: If I receive a packet, I do checked if this packet
for me I indicated it up. If it not for me I forward the packet on to
another node.
duplicate the packet and used
NdisSendNetBufferLists(pAdapt->BindingHandle,
CurrentNetBufferList,
PortNumber,
SendFlags);
to forward this packet.
Can someone help me to get this work? I'm really appreciated.
ttan
2010-06-30 17:30:22 UTC
Permalink
Thomas, Thank you for your respond.

You must modify the link and network address headers in your new NET_BUFFER
(packet) to have the correct source and destination addresses.

Another question to the statement above?
If I had node A--B--C how do I modify the source and destination addresses
to be able to ping?
When I do a ping I can ping A to B but I can not ping A to C.
Post by Thomas F. Divine
You need to think of this as if you were creating your own packet
(NET_BUFFER) from scratch. So please read and understand the WDK topics
related to "Sending Network Data".
You will need to construct your own NET_BUFFER (for the packet) and
NET_BUFFER_LIST (the packet list).
You must modify the link and network address headers in your new NET_BUFFER
(packet) to have the correct source and destination addresses. There is no
facility at the NDIS level that will do this for you automatically.
If you study the NET_BUFFER description and buffer management functions
carefully you can associate the payload MDLs of the received NET_BUFFER with
the new NET_BUFFER that you will be sending. A simpler approach might be to
create a copy of the payload in memory that you allocate yourself.
You will need to use the context area of your new NET_BUFFER_LIST (or some
other scheme...) to keep a reference to the original received
NET_BUFFER_LIST.
When your send completes you will need to examine the send NET_BUFFER_LIST
context to fetch the original receive NET_BUFFER_LIST and return it. Then
recycle the NET_BUFFER_LIST and other resources that you allocated to send
the redirected packet.
This chat assumes that you are "forwarding" a packet to a different node on
the network (a remote host).
The Devil is in the details, which you must learn for yourself.
Good luck,
Thomas F. Divine
http://www.pcausa.com
Post by ttan
Hi,
I'm had IM driver with 2 NICs. How do I forward a packet in PtReceiveNBL?
What I'm trying to do is: If I receive a packet, I do checked if this packet
for me I indicated it up. If it not for me I forward the packet on to
another node.
duplicate the packet and used
NdisSendNetBufferLists(pAdapt->BindingHandle,
CurrentNetBufferList,
PortNumber,
SendFlags);
to forward this packet.
Can someone help me to get this work? I'm really appreciated.
Thomas F. Divine
2010-06-30 19:44:14 UTC
Permalink
I am afraid that you must study the details of packet addressing yourself.
You must know this. After you do, you can answer for yourself.

Thomas
Post by ttan
Thomas, Thank you for your respond.
You must modify the link and network address headers in your new NET_BUFFER
(packet) to have the correct source and destination addresses.
Another question to the statement above?
If I had node A--B--C how do I modify the source and destination addresses
to be able to ping?
When I do a ping I can ping A to B but I can not ping A to C.
Post by Thomas F. Divine
You need to think of this as if you were creating your own packet
(NET_BUFFER) from scratch. So please read and understand the WDK topics
related to "Sending Network Data".
You will need to construct your own NET_BUFFER (for the packet) and
NET_BUFFER_LIST (the packet list).
You must modify the link and network address headers in your new NET_BUFFER
(packet) to have the correct source and destination addresses. There is no
facility at the NDIS level that will do this for you automatically.
If you study the NET_BUFFER description and buffer management functions
carefully you can associate the payload MDLs of the received NET_BUFFER with
the new NET_BUFFER that you will be sending. A simpler approach might be to
create a copy of the payload in memory that you allocate yourself.
You will need to use the context area of your new NET_BUFFER_LIST (or some
other scheme...) to keep a reference to the original received
NET_BUFFER_LIST.
When your send completes you will need to examine the send
NET_BUFFER_LIST
context to fetch the original receive NET_BUFFER_LIST and return it. Then
recycle the NET_BUFFER_LIST and other resources that you allocated to send
the redirected packet.
This chat assumes that you are "forwarding" a packet to a different node on
the network (a remote host).
The Devil is in the details, which you must learn for yourself.
Good luck,
Thomas F. Divine
http://www.pcausa.com
Post by ttan
Hi,
I'm had IM driver with 2 NICs. How do I forward a packet in PtReceiveNBL?
What I'm trying to do is: If I receive a packet, I do checked if this packet
for me I indicated it up. If it not for me I forward the packet on to
another node.
duplicate the packet and used
NdisSendNetBufferLists(pAdapt->BindingHandle,
CurrentNetBufferList,
PortNumber,
SendFlags);
to forward this packet.
Can someone help me to get this work? I'm really appreciated.
Loading...