From: ttan on
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.


From: Thomas F. Divine on
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

"ttan" <ttan(a)discussions.microsoft.com> wrote in message
news:E984395D-CCAA-450F-A2FB-C442470380A2(a)microsoft.com...
> 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.
>
>
From: ttan on
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.



"Thomas F. Divine" wrote:

> 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
>
> "ttan" <ttan(a)discussions.microsoft.com> wrote in message
> news:E984395D-CCAA-450F-A2FB-C442470380A2(a)microsoft.com...
> > 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.
> >
> >
From: Thomas F. Divine on
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

"ttan" <ttan(a)discussions.microsoft.com> wrote in message
news:B8242E6C-743C-41D1-8DC9-0D63412D3188(a)microsoft.com...
> 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.
>
>
>
> "Thomas F. Divine" wrote:
>
>> 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
>>
>> "ttan" <ttan(a)discussions.microsoft.com> wrote in message
>> news:E984395D-CCAA-450F-A2FB-C442470380A2(a)microsoft.com...
>> > 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.
>> >
>> >