lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] New Hook IP function for output packages


From: Stian Skjelstad
Subject: Re: [lwip-devel] New Hook IP function for output packages
Date: Sat, 14 Jan 2023 00:31:32 +0100

Hi Daniel

First minor detail that comes to my mind is that not packets are ipv4 packets - you do have ARP.

Secondly, ip4_output() is not the lowest entry point for sending ipv4 packets, but just a helper. ICMP and IGMP ip4_output_if() directly

I think that if you want a precice hook, ip_output_if()/ip_output_if_opt() is a better location.


Stian Skjelstad


On Fri, Jan 13, 2023 at 8:34 PM Daniel Lastanao <daniel13lm@gmail.com> wrote:
I already wrote a thread a few months ago about implementing the functions  LWIP_HOOK_IP4_OUTPUT and LWIP_HOOK_IP6_OUTPUT. Now that I´m implementing it. I define these functions in ip4_output and in ip6_output as follows. 

ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
           u8_t ttl, u8_t tos, u8_t proto)
{
  struct netif *netif;

  ...

  #ifdef LWIP_HOOK_IP4_OUTPUT
  if (LWIP_HOOK_IP4_OUTPUT(p, src, dest, ttl, tos, proto, netif)) {
    /* the packet has been eaten */
    return ERR_OK;
  }
#endif
  return ip4_output_if(p, src, dest, ttl, tos, proto, netif);
}


I try to see if these functions work by printing a sentence each time the ESP32 sends a package and the program does not enter the function every time the esp32 sends a packet.

The function is defined in the opt.h file and in my files to use it in my main.cpp.

All help is welcome.
_______________________________________________
lwip-devel mailing list
lwip-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]