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