public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX
@ 2009-01-13 10:52 Antoine van Gelder
  2009-01-13 18:46 ` [B.A.T.M.A.N.] " Sven Eckelmann
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Antoine van Gelder @ 2009-01-13 10:52 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


[-- Attachment #1.1: Type: text/plain, Size: 114 bytes --]

Some additional includes are required to compile the B.A.T.M.A.N.  
visualization daemon under FreeBSD and OSX.



[-- Attachment #1.2: platform.patch --]
[-- Type: application/octet-stream, Size: 737 bytes --]

Index: vis.c
===================================================================
--- vis.c	(revision 1178)
+++ vis.c	(working copy)
@@ -23,6 +23,9 @@
 
 
 #include <fcntl.h>
+#if defined(__FreeBSD__) || defined (__APPLE__)
+  #include <sys/socket.h>
+#endif
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <sys/select.h>
Index: vis.h
===================================================================
--- vis.h	(revision 1178)
+++ vis.h	(working copy)
@@ -25,6 +25,12 @@
 #include <pthread.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#if defined(__FreeBSD__) || defined (__APPLE__)
+  #include <netinet/in.h>
+#endif
+#if defined(__APPLE__)
+  #include <sys/time.h>
+#endif
 #include <arpa/inet.h>
 #include <errno.h>
 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX
  2009-01-13 10:52 [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX Antoine van Gelder
@ 2009-01-13 18:46 ` Sven Eckelmann
  2009-01-13 21:29   ` Antoine van Gelder
  2009-01-13 18:46 ` [B.A.T.M.A.N.] [PATCH] Fix compilation on freebsd Sven Eckelmann
  2009-01-13 20:45 ` [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX Simon Wunderlich
  2 siblings, 1 reply; 15+ messages in thread
From: Sven Eckelmann @ 2009-01-13 18:46 UTC (permalink / raw)
  To: b.a.t.m.a.n

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 13 January 2009 11:52:35 Antoine van Gelder wrote:
> Some additional includes are required to compile the B.A.T.M.A.N.
> visualization daemon under FreeBSD and OSX.
Hm, the headers are also needed on other plattforms. In linux we have deep includes in some headers but this must not be always that way. I would say that they should be included in all supported plattforms.
Maybe you can have a look at my patch so I didn't messed up the osx support (dont have an OS X here to test it).

Best regards,
	Sven

PS: Interested in porting batmand again to *bsd plattforms?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkls4VMACgkQqQGwKVlMoDviDACfY11IQ9KlbHK/tQdLBhjrXwAj
QFMAni4jyaTT7TKqeNt6hiaKiLkQ400d
=BqO1
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH] Fix compilation on freebsd
  2009-01-13 10:52 [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX Antoine van Gelder
  2009-01-13 18:46 ` [B.A.T.M.A.N.] " Sven Eckelmann
@ 2009-01-13 18:46 ` Sven Eckelmann
  2009-01-13 19:00   ` Outback Dingo
  2009-01-13 20:45 ` [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX Simon Wunderlich
  2 siblings, 1 reply; 15+ messages in thread
From: Sven Eckelmann @ 2009-01-13 18:46 UTC (permalink / raw)
  To: b.a.t.m.a.n

FreeBSD doesn't include as much deep includes in their socket headers
as the linux ones does. To support building on freebsd we must include
them explicit.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
CC: Antoine van Gelder <antoine@7degrees.co.za>
---
 vis-advanced/vis.c |    2 +-
 vis-advanced/vis.h |    2 ++
 vis/vis.c          |    2 +-
 vis/vis.h          |    2 ++
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/vis-advanced/vis.c b/vis-advanced/vis.c
index 721d690..69f69b8 100644
--- a/vis-advanced/vis.c
+++ b/vis-advanced/vis.c
@@ -23,10 +23,10 @@
 
 
 #include <fcntl.h>
+#include <sys/socket.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <sys/select.h>
-#include <sys/time.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/vis-advanced/vis.h b/vis-advanced/vis.h
index 6f6793e..a060c83 100644
--- a/vis-advanced/vis.h
+++ b/vis-advanced/vis.h
@@ -25,6 +25,8 @@
 #include <pthread.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#include <sys/time.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <errno.h>
 
diff --git a/vis/vis.c b/vis/vis.c
index 05f4096..c488365 100644
--- a/vis/vis.c
+++ b/vis/vis.c
@@ -23,10 +23,10 @@
 
 
 #include <fcntl.h>
+#include <sys/socket.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <sys/select.h>
-#include <sys/time.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/vis/vis.h b/vis/vis.h
index 8953b70..1f343d8 100644
--- a/vis/vis.h
+++ b/vis/vis.h
@@ -25,7 +25,9 @@
 #include <pthread.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#include <sys/time.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
 #include <errno.h>
 
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] Fix compilation on freebsd
  2009-01-13 18:46 ` [B.A.T.M.A.N.] [PATCH] Fix compilation on freebsd Sven Eckelmann
@ 2009-01-13 19:00   ` Outback Dingo
  0 siblings, 0 replies; 15+ messages in thread
From: Outback Dingo @ 2009-01-13 19:00 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]

Very COOL...!!

On Wed, Jan 14, 2009 at 1:46 AM, Sven Eckelmann <sven.eckelmann@gmx.de>wrote:

> FreeBSD doesn't include as much deep includes in their socket headers
> as the linux ones does. To support building on freebsd we must include
> them explicit.
>
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> CC: Antoine van Gelder <antoine@7degrees.co.za>
> ---
>  vis-advanced/vis.c |    2 +-
>  vis-advanced/vis.h |    2 ++
>  vis/vis.c          |    2 +-
>  vis/vis.h          |    2 ++
>  4 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/vis-advanced/vis.c b/vis-advanced/vis.c
> index 721d690..69f69b8 100644
> --- a/vis-advanced/vis.c
> +++ b/vis-advanced/vis.c
> @@ -23,10 +23,10 @@
>
>
>  #include <fcntl.h>
> +#include <sys/socket.h>
>  #include <net/if.h>
>  #include <sys/ioctl.h>
>  #include <sys/select.h>
> -#include <sys/time.h>
>  #include <unistd.h>
>  #include <stdlib.h>
>  #include <stdio.h>
> diff --git a/vis-advanced/vis.h b/vis-advanced/vis.h
> index 6f6793e..a060c83 100644
> --- a/vis-advanced/vis.h
> +++ b/vis-advanced/vis.h
> @@ -25,6 +25,8 @@
>  #include <pthread.h>
>  #include <sys/socket.h>
>  #include <sys/types.h>
> +#include <sys/time.h>
> +#include <netinet/in.h>
>  #include <arpa/inet.h>
>  #include <errno.h>
>
> diff --git a/vis/vis.c b/vis/vis.c
> index 05f4096..c488365 100644
> --- a/vis/vis.c
> +++ b/vis/vis.c
> @@ -23,10 +23,10 @@
>
>
>  #include <fcntl.h>
> +#include <sys/socket.h>
>  #include <net/if.h>
>  #include <sys/ioctl.h>
>  #include <sys/select.h>
> -#include <sys/time.h>
>  #include <unistd.h>
>  #include <stdlib.h>
>  #include <stdio.h>
> diff --git a/vis/vis.h b/vis/vis.h
> index 8953b70..1f343d8 100644
> --- a/vis/vis.h
> +++ b/vis/vis.h
> @@ -25,7 +25,9 @@
>  #include <pthread.h>
>  #include <sys/socket.h>
>  #include <sys/types.h>
> +#include <sys/time.h>
>  #include <arpa/inet.h>
> +#include <netinet/in.h>
>  #include <errno.h>
>
>
> --
> 1.6.0.6
>
> _______________________________________________
> B.A.T.M.A.N mailing list
> B.A.T.M.A.N@open-mesh.net
> https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
>

[-- Attachment #2: Type: text/html, Size: 3223 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX
  2009-01-13 10:52 [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX Antoine van Gelder
  2009-01-13 18:46 ` [B.A.T.M.A.N.] " Sven Eckelmann
  2009-01-13 18:46 ` [B.A.T.M.A.N.] [PATCH] Fix compilation on freebsd Sven Eckelmann
@ 2009-01-13 20:45 ` Simon Wunderlich
  2 siblings, 0 replies; 15+ messages in thread
From: Simon Wunderlich @ 2009-01-13 20:45 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

Hello guys,

thank you very much for the patches! I've applied Svens patch because it
is more general (including these headers in any case should not hurt).
Compatibility patches are highly appreciated, we still have tickets open
requesting Mac OS X support ... :)

best regards
	Simon


On Tue, Jan 13, 2009 at 12:52:35PM +0200, Antoine van Gelder wrote:
> Some additional includes are required to compile the B.A.T.M.A.N.  
> visualization daemon under FreeBSD and OSX.
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX
  2009-01-13 18:46 ` [B.A.T.M.A.N.] " Sven Eckelmann
@ 2009-01-13 21:29   ` Antoine van Gelder
  2009-01-14  0:45     ` Sven Eckelmann
  0 siblings, 1 reply; 15+ messages in thread
From: Antoine van Gelder @ 2009-01-13 21:29 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


On 13 Jan 2009, at 20:46 , Sven Eckelmann wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Tuesday 13 January 2009 11:52:35 Antoine van Gelder wrote:
>> Some additional includes are required to compile the B.A.T.M.A.N.
>> visualization daemon under FreeBSD and OSX.
> Hm, the headers are also needed on other plattforms. In linux we  
> have deep includes in some headers but this must not be always that  
> way. I would say that they should be included in all supported  
> plattforms.
> Maybe you can have a look at my patch so I didn't messed up the osx  
> support (dont have an OS X here to test it).


Compiles fine under FreeBSD and OSX, tx!


> PS: Interested in porting batmand again to *bsd plattforms?


Possibly - it would be nice to have the option to mesh with a beastie :)

Do you have a rough idea of what broke since it last worked ?

  - antoine



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX
  2009-01-13 21:29   ` Antoine van Gelder
@ 2009-01-14  0:45     ` Sven Eckelmann
  2009-01-14  0:59       ` [B.A.T.M.A.N.] [PATCH] Sync definitions in bsd/* with definitions in os.h Sven Eckelmann
                         ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Sven Eckelmann @ 2009-01-14  0:45 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 558 bytes --]

On Tuesday 13 January 2009 22:29:25 Antoine van Gelder wrote:
> On 13 Jan 2009, at 20:46 , Sven Eckelmann wrote:
> > PS: Interested in porting batmand again to *bsd plattforms?
>
> Possibly - it would be nice to have the option to mesh with a beastie :)
>
> Do you have a rough idea of what broke since it last worked ?
Don't know when it worked the last time but it doesnt compile at the moment.

There are also some parts marked as "not implemented" in bsd/route.c
You must check if all functions in bsd/*.c are in sync with linux/*.c

Best regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH] Sync definitions in bsd/* with definitions in os.h
  2009-01-14  0:45     ` Sven Eckelmann
@ 2009-01-14  0:59       ` Sven Eckelmann
  2009-01-14  1:36       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2009-01-14  0:59 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/bsd/kernel.c |    9 ++-------
 batman/bsd/tun.c    |    6 +++---
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/batman/bsd/kernel.c b/batman/bsd/kernel.c
index 505f551..0a126d4 100644
--- a/batman/bsd/kernel.c
+++ b/batman/bsd/kernel.c
@@ -35,7 +35,7 @@
 #include "../os.h"
 #include "../batman.h"
 
-void set_forwarding(int state)
+void set_forwarding(int32_t state)
 {
 	int mib[4];
 
@@ -56,7 +56,7 @@ void set_forwarding(int state)
 		err(1, "Cannot change net.inet.ip.forwarding");
 }
 
-int get_forwarding(void)
+int32_t get_forwarding(void)
 {
 	int state;
 	size_t len;
@@ -138,11 +138,6 @@ int8_t bind_to_iface( int32_t udp_recv_sock, char *dev )
 	return 1;
 }
 
-int8_t use_kernel_module( char *dev )
-{
-	return -1;
-}
-
 int32_t use_gateway_module(void)
 {
 	return -1;
diff --git a/batman/bsd/tun.c b/batman/bsd/tun.c
index d38b954..7d4c79c 100644
--- a/batman/bsd/tun.c
+++ b/batman/bsd/tun.c
@@ -51,7 +51,7 @@
  * this string is assumed to be dev_name_size bytes large.
  */
 #if defined(__OpenBSD__) || defined(__Darwin__)
-int open_tun_any(char *dev_name, size_t dev_name_size)
+static int open_tun_any(char *dev_name, size_t dev_name_size)
 {
 	int i;
 	int fd;
@@ -72,7 +72,7 @@ int open_tun_any(char *dev_name, size_t dev_name_size)
 	return -1;
 }
 #elif defined(__FreeBSD__)
-int open_tun_any(char *dev_name, size_t dev_name_size)
+static int open_tun_any(char *dev_name, size_t dev_name_size)
 {
 	int fd;
 	struct stat buf;
@@ -90,7 +90,7 @@ int open_tun_any(char *dev_name, size_t dev_name_size)
 #endif
 
 /* Probe for tun interface availability */
-int8_t probe_tun()
+int8_t probe_tun(uint8_t print_to_stderr)
 {
 	int fd;
 	fd = open_tun_any(NULL, 0);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX
  2009-01-14  0:45     ` Sven Eckelmann
  2009-01-14  0:59       ` [B.A.T.M.A.N.] [PATCH] Sync definitions in bsd/* with definitions in os.h Sven Eckelmann
@ 2009-01-14  1:36       ` Sven Eckelmann
  2009-02-06 18:00         ` [B.A.T.M.A.N.] [PATCH] Introduce get_tunneled_(protocol|udpdest) for better portability Sven Eckelmann
  2009-02-06 18:00         ` [B.A.T.M.A.N.] [PATCH] Add bsd-stubs for nat functionality Sven Eckelmann
  2009-01-14 10:56       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
                         ` (2 subsequent siblings)
  4 siblings, 2 replies; 15+ messages in thread
From: Sven Eckelmann @ 2009-01-14  1:36 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]



On Wednesday 14 January 2009 01:45:26 Sven Eckelmann wrote:
> On Tuesday 13 January 2009 22:29:25 Antoine van Gelder wrote:
> > On 13 Jan 2009, at 20:46 , Sven Eckelmann wrote:
> > > PS: Interested in porting batmand again to *bsd plattforms?
> >
> > Possibly - it would be nice to have the option to mesh with a beastie :)
> >
> > Do you have a rough idea of what broke since it last worked ?
>
> Don't know when it worked the last time but it doesnt compile at the
> moment.
>
> There are also some parts marked as "not implemented" in bsd/route.c
> You must check if all functions in bsd/*.c are in sync with linux/*.c

The biggest problem seems to be posix/tunnel.c - it uses struct iphdr from 
netinet/ip.h. FreeBSD will give you struct ip which has completely different 
names. So you have to find a good way to get both versions for linux and for 
bsd without creating a big mess.
You have also to include netinet/in_systm.h before including netinet/ip.h

Maybe the best way would be to add a function to get the protocol of the 
tunneled packet (from buffer) and a function to get the destination. After 
copying the implementation for linux you have to implement it for freebsd.

I hope that the rest compiles and links fine and the time to test it begins 
afterwards :D

Best regards,
	Sven


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX
  2009-01-14  0:45     ` Sven Eckelmann
  2009-01-14  0:59       ` [B.A.T.M.A.N.] [PATCH] Sync definitions in bsd/* with definitions in os.h Sven Eckelmann
  2009-01-14  1:36       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
@ 2009-01-14 10:56       ` Sven Eckelmann
  2009-01-14 14:55         ` Antoine van Gelder
  2009-01-14 10:58       ` [B.A.T.M.A.N.] [PATCH] Suppress warning about unused parameter in bsd/*.c Sven Eckelmann
  2009-01-18 20:17       ` [B.A.T.M.A.N.] Compile batmand under FreeBSD and OSX (Was: Compile vis) Antoine van Gelder
  4 siblings, 1 reply; 15+ messages in thread
From: Sven Eckelmann @ 2009-01-14 10:56 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

On Wednesday 14 January 2009 01:45:26 Sven Eckelmann wrote:
> There are also some parts marked as "not implemented" in bsd/route.c
> You must check if all functions in bsd/*.c are in sync with linux/*.c
You should also check what needs to be ported from rev629 for the "ip source 
patch"

Best regards,
	Sven


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH] Suppress warning about unused parameter in bsd/*.c
  2009-01-14  0:45     ` Sven Eckelmann
                         ` (2 preceding siblings ...)
  2009-01-14 10:56       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
@ 2009-01-14 10:58       ` Sven Eckelmann
  2009-01-18 20:17       ` [B.A.T.M.A.N.] Compile batmand under FreeBSD and OSX (Was: Compile vis) Antoine van Gelder
  4 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2009-01-14 10:58 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/bsd/kernel.c |   10 +++++-----
 batman/bsd/route.c  |   12 ++++++------
 batman/bsd/tun.c    |    6 +++---
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/batman/bsd/kernel.c b/batman/bsd/kernel.c
index 0a126d4..b98c06f 100644
--- a/batman/bsd/kernel.c
+++ b/batman/bsd/kernel.c
@@ -76,7 +76,7 @@ int32_t get_forwarding(void)
 	return state;
 }
 
-void set_send_redirects(int32_t state, char* dev)
+void set_send_redirects(int32_t state, char* BATMANUNUSED(dev))
 {
 	int mib[4];
 
@@ -97,7 +97,7 @@ void set_send_redirects(int32_t state, char* dev)
 		err(1, "Cannot change net.inet.ip.redirect");
 }
 
-int32_t get_send_redirects(char *dev)
+int32_t get_send_redirects(char *BATMANUNUSED(dev))
 {
 	int state;
 	size_t len;
@@ -117,20 +117,20 @@ int32_t get_send_redirects(char *dev)
 	return state;
 }
 
-void set_rp_filter( int32_t state, char* dev )
+void set_rp_filter( int32_t BATMANUNUSED(state), char* BATMANUNUSED(dev) )
 {
 	/* On BSD, reverse path filtering should be disabled in the firewall. */
 	return;
 }
 
-int32_t get_rp_filter( char *dev )
+int32_t get_rp_filter( char *BATMANUNUSED(dev) )
 {
 	/* On BSD, reverse path filtering should be disabled in the firewall. */
 	return 0;
 }
 
 
-int8_t bind_to_iface( int32_t udp_recv_sock, char *dev )
+int8_t bind_to_iface( int32_t BATMANUNUSED(udp_recv_sock), char *BATMANUNUSED(dev) )
 {
 	/* XXX: Is binding a socket to a specific
 	 * interface possible in *BSD?
diff --git a/batman/bsd/route.c b/batman/bsd/route.c
index 953e995..8c9de48 100644
--- a/batman/bsd/route.c
+++ b/batman/bsd/route.c
@@ -139,8 +139,8 @@ static uint32_t get_dev_addr(char *dev)
 	return addr->sin_addr.s_addr;
 }
 
-void add_del_route(uint32_t dest, uint8_t netmask, uint32_t router, uint32_t src_ip,
-		int32_t ifi, char *dev, uint8_t rt_table, int8_t route_type, int8_t del)
+void add_del_route(uint32_t dest, uint8_t netmask, uint32_t router, uint32_t BATMANUNUSED(src_ip),
+		int32_t BATMANUNUSED(ifi), char *dev, uint8_t BATMANUNUSED(rt_table), int8_t BATMANUNUSED(route_type), int8_t del)
 {
 	char dest_str[16], router_str[16];
 	struct rt_msg msg;
@@ -203,20 +203,20 @@ void add_del_route(uint32_t dest, uint8_t netmask, uint32_t router, uint32_t src
 }
 
 
-void add_del_rule(uint32_t network, uint8_t netmask, int8_t rt_table,
-		uint32_t prio, char *iif, int8_t dst_rule, int8_t del )
+void add_del_rule(uint32_t BATMANUNUSED(network), uint8_t BATMANUNUSED(netmask), int8_t BATMANUNUSED(rt_table),
+		uint32_t BATMANUNUSED(prio), char *BATMANUNUSED(iif), int8_t BATMANUNUSED(dst_rule), int8_t BATMANUNUSED(del) )
 {
 	fprintf(stderr, "add_del_rule: not implemented\n");
 	return;
 }
 
-int add_del_interface_rules( int8_t del )
+int add_del_interface_rules( int8_t BATMANUNUSED(del) )
 {
 	fprintf(stderr, "add_del_interface_rules: not implemented\n");
 	return 0;
 }
 
-int flush_routes_rules( int8_t rt_table )
+int flush_routes_rules( int8_t BATMANUNUSED(rt_table) )
 {
 	fprintf(stderr, "flush_routes_rules: not implemented\n");
 	return 0;
diff --git a/batman/bsd/tun.c b/batman/bsd/tun.c
index 7d4c79c..b44dac3 100644
--- a/batman/bsd/tun.c
+++ b/batman/bsd/tun.c
@@ -90,7 +90,7 @@ static int open_tun_any(char *dev_name, size_t dev_name_size)
 #endif
 
 /* Probe for tun interface availability */
-int8_t probe_tun(uint8_t print_to_stderr)
+int8_t probe_tun(uint8_t BATMANUNUSED(print_to_stderr))
 {
 	int fd;
 	fd = open_tun_any(NULL, 0);
@@ -105,7 +105,7 @@ int8_t del_dev_tun(int32_t fd)
 	return close(fd);
 }
 
-int8_t set_tun_addr(int32_t fd, uint32_t tun_addr, char *tun_ifname)
+int8_t set_tun_addr(int32_t BATMANUNUSED(fd), uint32_t tun_addr, char *tun_ifname)
 {
 	int so;
 	struct ifreq ifr_tun;
@@ -136,7 +136,7 @@ int8_t set_tun_addr(int32_t fd, uint32_t tun_addr, char *tun_ifname)
 }
 
 int8_t add_dev_tun(struct batman_if *batman_if, uint32_t tun_addr,
-		char *tun_dev, size_t tun_dev_size, int32_t *fd, int32_t *ifi)
+		char *tun_dev, size_t tun_dev_size, int32_t *fd, int32_t *BATMANUNUSED(ifi))
 {
 	int so;
 	struct ifreq ifr_tun, ifr_if;
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX
  2009-01-14 10:56       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
@ 2009-01-14 14:55         ` Antoine van Gelder
  0 siblings, 0 replies; 15+ messages in thread
From: Antoine van Gelder @ 2009-01-14 14:55 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On 14 Jan 2009, at 12:56 , Sven Eckelmann wrote:

> On Wednesday 14 January 2009 01:45:26 Sven Eckelmann wrote:
>> There are also some parts marked as "not implemented" in bsd/route.c
>> You must check if all functions in bsd/*.c are in sync with linux/*.c
> You should also check what needs to be ported from rev629 for the  
> "ip source
> patch"


Thanks Sven, you've given me a pretty clear picture of how to proceed!

I'm going to take a look at it over the weekend and see how far I get.

  - antoine


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] Compile batmand under FreeBSD and OSX (Was: Compile vis)
  2009-01-14  0:45     ` Sven Eckelmann
                         ` (3 preceding siblings ...)
  2009-01-14 10:58       ` [B.A.T.M.A.N.] [PATCH] Suppress warning about unused parameter in bsd/*.c Sven Eckelmann
@ 2009-01-18 20:17       ` Antoine van Gelder
  4 siblings, 0 replies; 15+ messages in thread
From: Antoine van Gelder @ 2009-01-18 20:17 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Kobus Roux, Ajay Makan


On 14 Jan 2009, at 02:45 , Sven Eckelmann wrote:

> On Tuesday 13 January 2009 22:29:25 Antoine van Gelder wrote:
>> On 13 Jan 2009, at 20:46 , Sven Eckelmann wrote:
>>> PS: Interested in porting batmand again to *bsd plattforms?
>>
>> Possibly - it would be nice to have the option to mesh with a  
>> beastie :)
>>
>> Do you have a rough idea of what broke since it last worked ?
> Don't know when it worked the last time but it doesnt compile at the  
> moment.



Fun weekend :)

batmand compiles under FreeBSD now but Darwin (Mac OSX) support is  
still broken.

 From what I can make out it looks like net/if_tun.h mysteriously got  
renditioned at some point on the road to Leopard.

Not sure what the best strategy would be moving forward. Any advice/ 
suggestions ?  http://tuntaposx.sourceforge.net perhaps ?

Some more information at: http://lists.apple.com/archives/Darwin-development/2000/Oct/msg00033.html


> There are also some parts marked as "not implemented" in bsd/route.c
> You must check if all functions in bsd/*.c are in sync with linux/*.c


These are the functions to manage the policy routing rules - I've had  
some limited success running batmand with the --policy-routing-script  
option but this is going to have to wait till next weekend to finish up.

Best
antoine


--
http://7degrees.co.za
"Libré software for human education."


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH] Introduce get_tunneled_(protocol|udpdest) for better portability
  2009-01-14  1:36       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
@ 2009-02-06 18:00         ` Sven Eckelmann
  2009-02-06 18:00         ` [B.A.T.M.A.N.] [PATCH] Add bsd-stubs for nat functionality Sven Eckelmann
  1 sibling, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2009-02-06 18:00 UTC (permalink / raw)
  To: b.a.t.m.a.n

FreeBSD has different definition of udp and ip headers then systems with
glibc. To support both a two new static functions were introduced.

 * get_tunneled_protocol - get protocol of inside the tunneled ip packet
 * get_tunneled_udpdest - get udp port of tunneled udp/ip packet

New systems can easily introduced in that way without changing the real
code.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/posix/tunnel.c |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/batman/posix/tunnel.c b/batman/posix/tunnel.c
index a576bb9..44a4ff0 100644
--- a/batman/posix/tunnel.c
+++ b/batman/posix/tunnel.c
@@ -28,6 +28,7 @@
 #include <arpa/inet.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
+#include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
@@ -70,6 +71,28 @@ void init_bh_ports(void)
 
 
 
+static uint8_t get_tunneled_protocol(const unsigned char *buff)
+{
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Darwin__)
+	return ((struct ip *)(buff + 1))->ip_p;
+#else
+	return ((struct iphdr *)(buff + 1))->protocol;
+#endif
+}
+
+
+
+static uint16_t get_tunneled_udpdest(const unsigned char *buff)
+{
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Darwin__)
+	return ((struct udphdr *)(buff + 1 + ((struct ip *)(buff + 1))->ip_hl*4))->uh_dport;
+#else
+	return ((struct udphdr *)(buff + 1 + ((struct iphdr *)(buff + 1))->ihl*4))->dest;
+#endif
+}
+
+
+
 static int8_t get_tun_ip(struct sockaddr_in *gw_addr, int32_t udp_sock, uint32_t *tun_addr)
 {
 	struct sockaddr_in sender_addr;
@@ -257,7 +280,7 @@ void *client_to_gw_tun(void *arg)
 					if (write(tun_fd, buff + 1, buff_len - 1) < 0)
 						debug_output(0, "Error - can't write packet: %s\n", strerror(errno));
 
-					if (((struct iphdr *)(buff + 1))->protocol != IPPROTO_ICMP) {
+					if (get_tunneled_protocol(buff) != IPPROTO_ICMP) {
 						gw_state = GW_STATE_VERIFIED;
 						gw_state_time = current_time;
 					}
@@ -305,11 +328,11 @@ void *client_to_gw_tun(void *arg)
 
 				ignore_packet = 0;
 
-				if (((struct iphdr *)(buff + 1))->protocol == IPPROTO_UDP) {
+				if (get_tunneled_protocol(buff) == IPPROTO_UDP) {
 
 					for (i = 0; i < (int)(sizeof(bh_udp_ports)/sizeof(short)); i++) {
 
-						if (((struct udphdr *)(buff + 1 + ((struct iphdr *)(buff + 1))->ihl*4))->dest == bh_udp_ports[i]) {
+						if (get_tunneled_udpdest(buff) == bh_udp_ports[i]) {
 
 							ignore_packet = 1;
 							break;
@@ -318,7 +341,7 @@ void *client_to_gw_tun(void *arg)
 
 					}
 
-				} else if (((struct iphdr *)(buff + 1))->protocol == IPPROTO_ICMP) {
+				} else if (get_tunneled_protocol(buff) == IPPROTO_ICMP) {
 
 					ignore_packet = 1;
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH] Add bsd-stubs for nat functionality
  2009-01-14  1:36       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
  2009-02-06 18:00         ` [B.A.T.M.A.N.] [PATCH] Introduce get_tunneled_(protocol|udpdest) for better portability Sven Eckelmann
@ 2009-02-06 18:00         ` Sven Eckelmann
  1 sibling, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2009-02-06 18:00 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/bsd/tun.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/batman/bsd/tun.c b/batman/bsd/tun.c
index b44dac3..3e75c4c 100644
--- a/batman/bsd/tun.c
+++ b/batman/bsd/tun.c
@@ -89,6 +89,20 @@ static int open_tun_any(char *dev_name, size_t dev_name_size)
 }
 #endif
 
+/* Probe for iptables binary availability */
+int probe_nat_tool(void) {
+	fprintf(stderr, "probe_nat_tool: not implemented\n");
+	return -1;
+}
+
+void add_nat_rule(char *BATMANUNUSED(dev)) {
+	fprintf(stderr, "add_nat_rule: not implemented\n");
+}
+
+void del_nat_rule(char *BATMANUNUSED(dev)) {
+	fprintf(stderr, "del_nat_rule: not implemented\n");
+}
+
 /* Probe for tun interface availability */
 int8_t probe_tun(uint8_t BATMANUNUSED(print_to_stderr))
 {
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-02-06 18:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-13 10:52 [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX Antoine van Gelder
2009-01-13 18:46 ` [B.A.T.M.A.N.] " Sven Eckelmann
2009-01-13 21:29   ` Antoine van Gelder
2009-01-14  0:45     ` Sven Eckelmann
2009-01-14  0:59       ` [B.A.T.M.A.N.] [PATCH] Sync definitions in bsd/* with definitions in os.h Sven Eckelmann
2009-01-14  1:36       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
2009-02-06 18:00         ` [B.A.T.M.A.N.] [PATCH] Introduce get_tunneled_(protocol|udpdest) for better portability Sven Eckelmann
2009-02-06 18:00         ` [B.A.T.M.A.N.] [PATCH] Add bsd-stubs for nat functionality Sven Eckelmann
2009-01-14 10:56       ` [B.A.T.M.A.N.] Compile vis under FreeBSD and OSX Sven Eckelmann
2009-01-14 14:55         ` Antoine van Gelder
2009-01-14 10:58       ` [B.A.T.M.A.N.] [PATCH] Suppress warning about unused parameter in bsd/*.c Sven Eckelmann
2009-01-18 20:17       ` [B.A.T.M.A.N.] Compile batmand under FreeBSD and OSX (Was: Compile vis) Antoine van Gelder
2009-01-13 18:46 ` [B.A.T.M.A.N.] [PATCH] Fix compilation on freebsd Sven Eckelmann
2009-01-13 19:00   ` Outback Dingo
2009-01-13 20:45 ` [B.A.T.M.A.N.] [PATCH] Compile vis under FreeBSD and OSX Simon Wunderlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox