Passing ARP replies to host

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing ARP replies to host

Amena El Homsi
 Hi,

LwIP processes the ARP requests and replies updated the ARP table, then it calls pbuf_free().
Is there a way to send the ARP reply to the host when the host requested lwIP to send an ARP request?

I was thinking to use raw pcb and define a raw callback function that will inform the host of the result of the ARP request, however raw_input() is not called unless ip4_input is called and since the arp will be processed by etharp_input I will not be able to use raw_pcb.

Thanks,
--

Amena El-Homsi
Computer & Communication Engineer
Dipl. Eng,  M.S.

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing ARP replies to host

goldsimon@gmx.de
On 05.11.2018 16:35, Amena El Homsi wrote:
> LwIP processes the ARP requests and replies updated the ARP table,
> then it calls pbuf_free().
> Is there a way to send the ARP reply to the host when the host
> requested lwIP to send an ARP request?

No.

> I was thinking to use raw pcb and define a raw callback function that
> will inform the host of the result of the ARP request, however
> raw_input() is not called unless ip4_input is called and since the arp
> will be processed by etharp_input I will not be able to use raw_pcb.

As you have found out yourself, raw pcbs are raw IP pcbs, not raw
network packets. It's like that in the socket world...

Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing ARP replies to host

Amena El Homsi
Thanks for your reply. So if I want to support it I have to add some changes to etharp.c file. Is there a plan to support such feature?

On Mon, Nov 5, 2018 at 6:27 PM [hidden email] <[hidden email]> wrote:
On 05.11.2018 16:35, Amena El Homsi wrote:
> LwIP processes the ARP requests and replies updated the ARP table,
> then it calls pbuf_free().
> Is there a way to send the ARP reply to the host when the host
> requested lwIP to send an ARP request?

No.

> I was thinking to use raw pcb and define a raw callback function that
> will inform the host of the result of the ARP request, however
> raw_input() is not called unless ip4_input is called and since the arp
> will be processed by etharp_input I will not be able to use raw_pcb.

As you have found out yourself, raw pcbs are raw IP pcbs, not raw
network packets. It's like that in the socket world...

Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


--

Amena El-Homsi
Computer & Communication Engineer
Dipl. Eng,  M.S.

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing ARP replies to host

David M. Zar
I had the need for the same functionality.

In etharp.c, at the end of etharp_input, put something like this:

  arp_callback(&sipaddr, (const struct eth_addr*)&hdr->shwaddr, netif->num, hdr->opcode, p);

arp_callback is defined in my code and passes whatever is needed by the callback. Just be sure to NOT free the packet in etharp_input but then do it in your code (or free it after the callback returns in etharp_input).

Dave

On 11/5/2018 10:49 AM, Amena El Homsi wrote:
Thanks for your reply. So if I want to support it I have to add some changes to etharp.c file. Is there a plan to support such feature?

On Mon, Nov 5, 2018 at 6:27 PM [hidden email] <[hidden email]> wrote:
On 05.11.2018 16:35, Amena El Homsi wrote:
> LwIP processes the ARP requests and replies updated the ARP table,
> then it calls pbuf_free().
> Is there a way to send the ARP reply to the host when the host
> requested lwIP to send an ARP request?

No.

> I was thinking to use raw pcb and define a raw callback function that
> will inform the host of the result of the ARP request, however
> raw_input() is not called unless ip4_input is called and since the arp
> will be processed by etharp_input I will not be able to use raw_pcb.

As you have found out yourself, raw pcbs are raw IP pcbs, not raw
network packets. It's like that in the socket world...

Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


--

Amena El-Homsi
Computer & Communication Engineer
Dipl. Eng,  M.S.


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing ARP replies to host

goldsimon@gmx.de
In reply to this post by Amena El Homsi


Am 5. November 2018 17:49:42 MEZ schrieb Amena El Homsi <[hidden email]>:
>Thanks for your reply. So if I want to support it I have to add some
>changes to etharp.c file.

Yes.

> Is there a plan to support such feature?

No, but I'm not opposed to accepting patches adding hooks for such things (see the other hooks in opt.h).


Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing ARP replies to host

Martin Kortmann
In reply to this post by David M. Zar
Hi,

I have to copy and modify the code of etharp.c since several years.
My problem with etharp.c is: My Ssstem includes one microcontroller (with lwip running on it) and several FPGAs. All of them are communicating via TCP/UDP, so i need one instance who can deliver the right ARP responses. And this one is the microcontroller. Unfortunately, the ARP implementation of lwip cannot be extended for this type of response. So i have to copy the code and modify it on every release of lwip.

Martin

Am 05.11.2018 um 19:08 schrieb David M. Zar <[hidden email]>:

I had the need for the same functionality.

In etharp.c, at the end of etharp_input, put something like this:

  arp_callback(&sipaddr, (const struct eth_addr*)&hdr->shwaddr, netif->num, hdr->opcode, p);

arp_callback is defined in my code and passes whatever is needed by the callback. Just be sure to NOT free the packet in etharp_input but then do it in your code (or free it after the callback returns in etharp_input).

Dave

On 11/5/2018 10:49 AM, Amena El Homsi wrote:
Thanks for your reply. So if I want to support it I have to add some changes to etharp.c file. Is there a plan to support such feature?

On Mon, Nov 5, 2018 at 6:27 PM [hidden email] <[hidden email]> wrote:
On 05.11.2018 16:35, Amena El Homsi wrote:
> LwIP processes the ARP requests and replies updated the ARP table,
> then it calls pbuf_free().
> Is there a way to send the ARP reply to the host when the host
> requested lwIP to send an ARP request?

No.

> I was thinking to use raw pcb and define a raw callback function that
> will inform the host of the result of the ARP request, however
> raw_input() is not called unless ip4_input is called and since the arp
> will be processed by etharp_input I will not be able to use raw_pcb.

As you have found out yourself, raw pcbs are raw IP pcbs, not raw
network packets. It's like that in the socket world...

Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


--

Amena El-Homsi
Computer & Communication Engineer
Dipl. Eng,  M.S.


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing ARP replies to host

goldsimon@gmx.de


Am 5. November 2018 19:15:51 MEZ schrieb Martin Kortmann <[hidden email]>:

>Hi,
>
>I have to copy and modify the code of etharp.c since several years.
>My problem with etharp.c is: My Ssstem includes one microcontroller
>(with lwip running on it) and several FPGAs. All of them are
>communicating via TCP/UDP, so i need one instance who can deliver the
>right ARP responses. And this one is the microcontroller.
>Unfortunately, the ARP implementation of lwip cannot be extended for
>this type of response. So i have to copy the code and modify it on
>every release of lwip.

It sounds like what you need would be the same extension as would be required for ppp proxy app support.

If you have an interest in getting this supported, why don't you post a patch? Lwip lives from people contributing useful things back!


Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing ARP replies to host

Amena El Homsi
In reply to this post by David M. Zar
Thanks Dave I will try your suggestion.

On Mon, Nov 5, 2018 at 8:09 PM David M. Zar <[hidden email]> wrote:
I had the need for the same functionality.

In etharp.c, at the end of etharp_input, put something like this:

  arp_callback(&sipaddr, (const struct eth_addr*)&hdr->shwaddr, netif->num, hdr->opcode, p);

arp_callback is defined in my code and passes whatever is needed by the callback. Just be sure to NOT free the packet in etharp_input but then do it in your code (or free it after the callback returns in etharp_input).

Dave

On 11/5/2018 10:49 AM, Amena El Homsi wrote:
Thanks for your reply. So if I want to support it I have to add some changes to etharp.c file. Is there a plan to support such feature?

On Mon, Nov 5, 2018 at 6:27 PM [hidden email] <[hidden email]> wrote:
On 05.11.2018 16:35, Amena El Homsi wrote:
> LwIP processes the ARP requests and replies updated the ARP table,
> then it calls pbuf_free().
> Is there a way to send the ARP reply to the host when the host
> requested lwIP to send an ARP request?

No.

> I was thinking to use raw pcb and define a raw callback function that
> will inform the host of the result of the ARP request, however
> raw_input() is not called unless ip4_input is called and since the arp
> will be processed by etharp_input I will not be able to use raw_pcb.

As you have found out yourself, raw pcbs are raw IP pcbs, not raw
network packets. It's like that in the socket world...

Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


--

Amena El-Homsi
Computer & Communication Engineer
Dipl. Eng,  M.S.


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


--

Amena El-Homsi
Computer & Communication Engineer
Dipl. Eng,  M.S.

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users