contrib: make remove dependency to custom olsrd
[project/luci.git] / contrib / package / olsrd-luci / patches / 139-olsrd-magicarprefresh.patch
1 --- a/lib/arprefresh/src/olsrd_arprefresh.c
2 +++ b/lib/arprefresh/src/olsrd_arprefresh.c
3 @@ -34,6 +34,8 @@
4   * Plugin to refresh the local ARP cache from received OLSR broadcasts
5   */
6  
7 +#undef ARPREFRESH_DEBUG
8 +
9  #include <stdio.h>
10  #include <string.h>
11  #include <stdlib.h>
12 @@ -46,6 +48,9 @@
13  #include <netinet/ip.h>
14  #include <netinet/udp.h>
15  #include <netpacket/packet.h>
16 +#ifdef ARPREFRESH_DEBUG
17 +#include <arpa/inet.h>
18 +#endif
19  #include <linux/types.h>
20  #include <linux/filter.h>
21  #include <unistd.h>
22 @@ -54,7 +59,6 @@
23  #include "kernel_routes.h"
24  #include "scheduler.h"
25  
26 -#undef ARPREFRESH_DEBUG
27  #define PLUGIN_INTERFACE_VERSION 5
28  
29  /****************************************************************************
30 @@ -129,7 +133,13 @@
31        memcpy(&req.in_pa.sin_addr, &buf.ip.saddr, sizeof(buf.ip.saddr));
32        req.arp.arp_ha.sa_family = AF_LOCAL;
33        memcpy(&req.arp.arp_ha.sa_data, &buf.eth.h_source, sizeof(buf.eth.h_source));
34 -      req.arp.arp_flags = ATF_COM;
35 +      /*
36 +       * Currently, temp arp entries work partially under linux-2.6 (the entries
37 +       * are timed out after a short period, not after the default 5 minutes. Under
38 +       * linux 2.4 this does not work. The ATF_MAGIC triggers a hack in the Freifunk
39 +       * firmware's kernel. ATF_MACIG seem not to be used anywhere...
40 +       */
41 +      req.arp.arp_flags = ATF_COM | ATF_MAGIC;
42        if_indextoname(from.sll_ifindex, req.arp.arp_dev);
43  #ifdef ARPREFRESH_DEBUG
44        {