[Olsr-dev] Adding interface argument to packet_transform_function
Kelvin Tran
(spam-protected)
Wed Apr 16 17:21:48 CEST 2008
Hi,
I think it will make the Packet Transform handler a more flexible API
interface if it provides the interface argument, especially in the
case where OLSR run on multiple interfaces.
Below is the patch for olsrd-0.5.4 I have created and tested.
It will be nice if this can be merged into next release.
diff -BurN olsrd-0.5.4_etx/src/net_olsr.h olsrd-0.5.4_l2etx/src/
net_olsr.h
--- olsrd-0.5.4_etx/src/net_olsr.h 2007-09-16 17:20:16.000000000
-0400
+++ olsrd-0.5.4_l2etx/src/net_olsr.h 2008-02-11 18:51:26.000000000
-0500
@@ -50,7 +50,9 @@
#include <arpa/inet.h>
#include <net/if.h>
-typedef int (*packet_transform_function)(olsr_u8_t *, int *);
+/* K.tran 01/08/2008 - Add interface argument to
packet_transform_function
+ so users know which interface the packet is for */
+typedef int (*packet_transform_function)(olsr_u8_t *, int *, struct
interface *);
diff -BurN olsrd-0.5.4_etx/src/net_olsr.c olsrd-0.5.4_l2etx/src/
net_olsr.c
--- olsrd-0.5.4_etx/src/net_olsr.c 2007-09-16 17:20:16.000000000
-0400
+++ olsrd-0.5.4_l2etx/src/net_olsr.c 2008-02-11 17:35:52.000000000
-0500
@@ -394,7 +394,7 @@
*/
for (tmp_ptf_list = ptf_list; tmp_ptf_list != NULL; tmp_ptf_list
= tmp_ptf_list->next)
{
- tmp_ptf_list->function(ifp->netbuf.buff, &ifp->netbuf.pending);
+ tmp_ptf_list->function(ifp->netbuf.buff, &ifp->netbuf.pending,
ifp);
}
/*
Thanks,
/K.tran
More information about the Olsr-dev
mailing list