changed NETSTACK configuration on network layer

This commit is contained in:
Joakim Eriksson 2017-10-06 22:35:32 +02:00
parent adb2f9b010
commit 8cf65ed01a
8 changed files with 38 additions and 32 deletions

View File

@ -51,7 +51,7 @@
#include <sys/socket.h>
#define DEBUG DEBUG_NONE
#define DEBUG DEBUG_FULL
#include "net/ipv6/uip-debug.h"
#ifdef linux
@ -79,13 +79,13 @@ static const struct select_callback tun_select_callback = {
};
#endif /* __CYGWIN__ */
int ssystem(const char *fmt, ...)
static int ssystem(const char *fmt, ...)
__attribute__((__format__ (__printf__, 1, 2)));
int
static int
ssystem(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
int
ssystem(const char *fmt, ...)
static ssystem(const char *fmt, ...)
{
char cmd[128];
va_list ap;
@ -98,7 +98,7 @@ ssystem(const char *fmt, ...)
}
/*---------------------------------------------------------------------------*/
void
static void
cleanup(void)
{
ssystem("ifconfig %s down", config_tundev);
@ -112,7 +112,7 @@ cleanup(void)
}
/*---------------------------------------------------------------------------*/
void
static void
sigcleanup(int signo)
{
fprintf(stderr, "signal %d\n", signo);
@ -120,7 +120,7 @@ sigcleanup(int signo)
}
/*---------------------------------------------------------------------------*/
void
static void
ifconf(const char *tundev, const char *ipaddr)
{
#ifdef linux
@ -138,17 +138,8 @@ ifconf(const char *tundev, const char *ipaddr)
ssystem("ifconfig %s\n", tundev);
}
/*---------------------------------------------------------------------------*/
int
devopen(const char *dev, int flags)
{
char t[32];
strcpy(t, "/dev/");
strncat(t, dev, sizeof(t) - 5);
return open(t, flags);
}
/*---------------------------------------------------------------------------*/
#ifdef linux
int
static int
tun_alloc(char *dev)
{
struct ifreq ifr;
@ -180,7 +171,16 @@ tun_alloc(char *dev)
return fd;
}
#else
int
static int
devopen(const char *dev, int flags)
{
char t[32];
strcpy(t, "/dev/");
strncat(t, dev, sizeof(t) - 5);
return open(t, flags);
}
/*---------------------------------------------------------------------------*/
static int
tun_alloc(char *dev)
{
PRINTF("Opening: %s\n", dev);
@ -190,7 +190,7 @@ tun_alloc(char *dev)
#ifdef __CYGWIN__
/*wpcap process is used to connect to host interface */
void
static void
tun_init()
{
setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */
@ -200,7 +200,7 @@ tun_init()
/*---------------------------------------------------------------------------*/
void
static void
tun_init()
{
setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */
@ -237,7 +237,7 @@ tun_output(uint8_t *data, int len)
return 0;
}
/*---------------------------------------------------------------------------*/
int
static int
tun_input(unsigned char *data, int maxlen)
{
int size;
@ -285,7 +285,7 @@ handle_fd(fd_set *rset, fd_set *wset)
}
#endif /* __CYGWIN_ */
void input(void)
static void input(void)
{
/* should not happen */
PRINTF("Tun6 - input\n");

View File

@ -73,7 +73,7 @@ typedef unsigned short uip_stats_t;
#endif
#ifndef NETSTACK_CONF_MAC
#define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_MAC nullmac_driver
#endif /* NETSTACK_CONF_MAC */
#ifndef NETSTACK_CONF_RADIO

View File

@ -16,6 +16,7 @@ MODULES += $(WITH_WEBSERVER)
CFLAGS += -DWEBSERVER=2
endif
MAKE_NET = MAKE_NET_IPV6
# Custom MAC layer (border_router_mac_driver)
MAKE_MAC = MAKE_MAC_OTHER
include $(CONTIKI)/Makefile.include

View File

@ -33,6 +33,9 @@
#undef UIP_FALLBACK_INTERFACE
#define UIP_FALLBACK_INTERFACE rpl_interface
#undef NETSTACK_CONF_NETWORK
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define SLIP_DEV_CONF_SEND_DELAY (CLOCK_SECOND / 32)
#undef WEBSERVER_CONF_CFS_CONNS

View File

@ -50,8 +50,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#define DEBUG DEBUG_NONE
#define DEBUG DEBUG_FULL
#include "net/ipv6/uip-debug.h"
#ifdef linux
@ -206,7 +205,10 @@ tun_init()
slip_init();
PRINTF("Opening tun interface:%s\n", slip_config_tundev);
tunfd = tun_alloc(slip_config_tundev);
if(tunfd == -1) err(1, "main: open");
select_set_callback(tunfd, &tun_select_callback);

View File

@ -17,8 +17,7 @@ ifeq ($(TARGET),nooliberry)
endif
# custom net layer, but with IPv6 enabled
MAKE_NET = MAKE_NET_OTHER
CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1
MAKE_NET = MAKE_NET_IPv6
CONTIKI_WITH_RPL = 0
MODULES += os/net/ipv6
include $(CONTIKI)/Makefile.include

View File

@ -52,9 +52,8 @@
#define CMD_CONF_HANDLERS slip_radio_cmd_handler
#endif
/* Configuration for the slipradio/network driver. Selected through the Makefile,
with MAKE_NET = MAKE_NET_OTHER */
#define NETSTACK_CONF_OTHER_NETWORK slipnet_driver
/* Configuration for the slipradio/network driver. */
#define NETSTACK_CONF_NETWORK slipnet_driver
#undef NETSTACK_CONF_FRAMER
#define NETSTACK_CONF_FRAMER no_framer

View File

@ -45,15 +45,17 @@
/* Network layer configuration. The NET layer is configured through the Makefile,
via the flag MAC_NET */
#ifdef NETSTACK_CONF_NETWORK
#define NETSTACK_NETWORK NETSTACK_CONF_NETWORK
#else
#if NETSTACK_CONF_WITH_IPV6
#define NETSTACK_NETWORK sicslowpan_driver
#elif NETSTACK_CONF_WITH_NULLNET
#define NETSTACK_NETWORK nullnet_driver
#elif NETSTACK_CONF_WITH_OTHER
#define NETSTACK_NETWORK NETSTACK_CONF_OTHER_NETWORK
#else
#error Unknown NET configuration
#endif
#endif /* NETSTACK_CONF_NETWORK */
/* MAC layer configuration. The MAC layer is configured through the Makefile,
via the flag MAKE_MAC */