aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn
diff options
context:
space:
mode:
authorjjako <jjako>2004-09-17 11:30:40 +0000
committerjjako <jjako>2004-09-17 11:30:40 +0000
commit0fe0df0079873a7c1cdad3ddcea116267e1379d2 (patch)
treecce712b3dfcdffef34c33f62d50fc2e7ff756de2 /ggsn
parent12f9e6e26325db3d18c43517dc1f486a3f1da42d (diff)
qos length bugfix and apple support plus header cleanup
Diffstat (limited to 'ggsn')
-rw-r--r--ggsn/cmdline.ggo11
-rw-r--r--ggsn/ggsn.c14
-rw-r--r--ggsn/ippool.c6
-rw-r--r--ggsn/syserr.c7
-rw-r--r--ggsn/syserr.h5
-rw-r--r--ggsn/tun.c28
-rw-r--r--ggsn/tun.h5
7 files changed, 30 insertions, 46 deletions
diff --git a/ggsn/cmdline.ggo b/ggsn/cmdline.ggo
index ca4e2c7..e7e0f66 100644
--- a/ggsn/cmdline.ggo
+++ b/ggsn/cmdline.ggo
@@ -1,16 +1,13 @@
# OpenGGSN - Gateway GPRS Support Node
-# Copyright (C) 2002, 2003 Mondru AB.
+# Copyright (C) 2002, 2003, 2004 Mondru AB.
#
# The contents of this file may be used under the terms of the GNU
# General Public License Version 2, provided that the above copyright
# notice and this permission notice is included in all copies or
# substantial portions of the software.
-#
-# The initial developer of the original code is
-# Jens Jakobsen <jj@openggsn.org>
-#
-# Contributor(s):
-
+#
+# Use "gengetopt --conf-parser < cmdline.ggo"
+# to generate cmdline.c and cmdline.h
option "fg" f "Run in foreground" flag off
option "debug" d "Run in debug mode" flag off
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index a59d545..5d60b90 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -1,17 +1,12 @@
/*
* OpenGGSN - Gateway GPRS Support Node
- * Copyright (C) 2002, 2003 Mondru AB.
+ * Copyright (C) 2002, 2003, 2004 Mondru AB.
*
* The contents of this file may be used under the terms of the GNU
* General Public License Version 2, provided that the above copyright
* notice and this permission notice is included in all copies or
* substantial portions of the software.
*
- * The initial developer of the original code is
- * Jens Jakobsen <jj@openggsn.org>
- *
- * Contributor(s):
- *
*/
/* ggsn.c
@@ -22,6 +17,11 @@
#define _GNU_SOURCE 1 /* strdup() prototype, broken arpa/inet.h */
#endif
+#include "../config.h"
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#include <syslog.h>
#include <ctype.h>
@@ -47,8 +47,6 @@
#include <time.h>
-#include "config.h"
-
#include "tun.h"
#include "ippool.h"
#include "syserr.h"
diff --git a/ggsn/ippool.c b/ggsn/ippool.c
index a942bce..efd927e 100644
--- a/ggsn/ippool.c
+++ b/ggsn/ippool.c
@@ -9,6 +9,12 @@
*
*/
+#include "../config.h"
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
#include <sys/types.h>
#include <netinet/in.h> /* in_addr */
#include <stdlib.h> /* calloc */
diff --git a/ggsn/syserr.c b/ggsn/syserr.c
index 7223414..8418956 100644
--- a/ggsn/syserr.c
+++ b/ggsn/syserr.c
@@ -1,17 +1,12 @@
/*
* Syslog functions.
- * Copyright (C) 2003 Mondru AB.
+ * Copyright (C) 2003, 2004 Mondru AB.
*
* The contents of this file may be used under the terms of the GNU
* General Public License Version 2, provided that the above copyright
* notice and this permission notice is included in all copies or
* substantial portions of the software.
*
- * The initial developer of the original code is
- * Jens Jakobsen <jj@openggsn.org>
- *
- * Contributor(s):
- *
*/
#include <stdarg.h>
diff --git a/ggsn/syserr.h b/ggsn/syserr.h
index ae07848..5a41817 100644
--- a/ggsn/syserr.h
+++ b/ggsn/syserr.h
@@ -7,11 +7,6 @@
* notice and this permission notice is included in all copies or
* substantial portions of the software.
*
- * The initial developer of the original code is
- * Jens Jakobsen <jj@openggsn.org>
- *
- * Contributor(s):
- *
*/
#ifndef _SYSERR_H
diff --git a/ggsn/tun.c b/ggsn/tun.c
index 3436972..576e32e 100644
--- a/ggsn/tun.c
+++ b/ggsn/tun.c
@@ -1,17 +1,12 @@
/*
* TUN interface functions.
- * Copyright (C) 2002, 2003 Mondru AB.
+ * Copyright (C) 2002, 2003, 2004 Mondru AB.
*
* The contents of this file may be used under the terms of the GNU
* General Public License Version 2, provided that the above copyright
* notice and this permission notice is included in all copies or
* substantial portions of the software.
*
- * The initial developer of the original code is
- * Jens Jakobsen <jj@openggsn.org>
- *
- * Contributor(s):
- *
*/
/*
@@ -55,6 +50,9 @@
#include <net/if.h>
#include <net/if_tun.h>
+#elif defined (__APPLE__)
+#include <net/if.h>
+
#elif defined (__sun__)
#include <stropts.h>
#include <sys/sockio.h>
@@ -336,7 +334,7 @@ int tun_addaddr(struct tun_t *this,
this->addrs++;
return 0;
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD__) || defined (__APPLE__)
int fd;
struct ifaliasreq areq;
@@ -415,7 +413,7 @@ int tun_setaddr(struct tun_t *this,
#if defined(__linux__)
ifr.ifr_netmask.sa_family = AF_INET;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined (__APPLE__)
((struct sockaddr_in *) &ifr.ifr_addr)->sin_len =
sizeof (struct sockaddr_in);
((struct sockaddr_in *) &ifr.ifr_dstaddr)->sin_len =
@@ -467,7 +465,7 @@ int tun_setaddr(struct tun_t *this,
((struct sockaddr_in *) &ifr.ifr_netmask)->sin_addr.s_addr =
netmask->s_addr;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined (__APPLE__)
((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr =
netmask->s_addr;
@@ -494,7 +492,7 @@ int tun_setaddr(struct tun_t *this,
/* TODO: How does it work on Solaris? */
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined (__APPLE__)
tun_sifflags(this, IFF_UP | IFF_RUNNING); /* TODO */
return tun_addroute(this, addr, addr, netmask);
#else
@@ -543,7 +541,7 @@ int tun_addroute(struct tun_t *this,
close(fd);
return 0;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined (__APPLE__)
struct {
struct rt_msghdr rt;
@@ -610,7 +608,7 @@ int tun_new(struct tun_t **tun)
#if defined(__linux__)
struct ifreq ifr;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined (__APPLE__)
char devname[IFNAMSIZ+5]; /* "/dev/" + ifname */
int devnum;
struct ifaliasreq areq;
@@ -657,7 +655,7 @@ int tun_new(struct tun_t **tun)
ioctl((*tun)->fd, TUNSETNOCSUM, 1); /* Disable checksums */
return 0;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined (__APPLE__)
/* Find suitable device */
for (devnum = 0; devnum < 255; devnum++) { /* TODO 255 */
@@ -784,7 +782,7 @@ int tun_set_cb_ind(struct tun_t *this,
int tun_decaps(struct tun_t *this)
{
-#if defined(__linux__) || defined (__FreeBSD__)
+#if defined(__linux__) || defined (__FreeBSD__) || defined (__APPLE__)
unsigned char buffer[PACKET_MAX];
int status;
@@ -825,7 +823,7 @@ int tun_decaps(struct tun_t *this)
int tun_encaps(struct tun_t *tun, void *pack, unsigned len)
{
-#if defined(__linux__) || defined (__FreeBSD__)
+#if defined(__linux__) || defined (__FreeBSD__) || defined (__APPLE__)
return write(tun->fd, pack, len);
diff --git a/ggsn/tun.h b/ggsn/tun.h
index 8d4618d..eb82162 100644
--- a/ggsn/tun.h
+++ b/ggsn/tun.h
@@ -7,11 +7,6 @@
* notice and this permission notice is included in all copies or
* substantial portions of the software.
*
- * The initial developer of the original code is
- * Jens Jakobsen <jj@openggsn.org>
- *
- * Contributor(s):
- *
*/
#ifndef _TUN_H