diff --git a/net/Kconfig b/net/Kconfig index 05feed11f0..76807288ad 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -138,18 +138,7 @@ config NET_STATISTICS ---help--- uIP statistics on or off -config NET_ROUTE - bool "Routing table suport" - default n - ---help--- - Build in support for a routing table. See include/net/route.h - -config NET_MAXROUTES - int "Routing table size" - default 4 - depends on NET_ROUTE - ---help--- - The size of the routing table (in entries). +source "net/route/Kconfig" config NET_MULTICAST bool "Multi-cast Tx support" diff --git a/net/Makefile b/net/Makefile index ab34e09f6e..f81257483c 100644 --- a/net/Makefile +++ b/net/Makefile @@ -62,13 +62,6 @@ SOCK_CSRCS += net_timeo.c net_dsec2timeval.c net_timeval2dsec.c endif endif -# Routing table support - -ifeq ($(CONFIG_NET_ROUTE),y) -SOCK_CSRCS += net_addroute.c net_allocroute.c net_delroute.c -SOCK_CSRCS += net_foreachroute.c net_router.c netdev_router.c -endif - # Support for network access using streams ifneq ($(CONFIG_NFILE_STREAMS),0) @@ -101,6 +94,7 @@ include tcp/Make.defs include udp/Make.defs include pkt/Make.defs include uip/Make.defs +include route/Make.defs endif ASRCS = $(SOCK_ASRCS) $(NETDEV_ASRCS) $(NET_ASRCS) diff --git a/net/arp/arp_inout.c b/net/arp/arp_inout.c index 9f5bd26c35..9cb4d6b15e 100644 --- a/net/arp/arp_inout.c +++ b/net/arp/arp_inout.c @@ -67,7 +67,7 @@ #include #include -#include "net_route.h" +#include "route/route.h" #ifdef CONFIG_NET_ARP diff --git a/net/net_sockets.c b/net/net_sockets.c index 66800f3824..df19c216a5 100644 --- a/net/net_sockets.c +++ b/net/net_sockets.c @@ -53,8 +53,8 @@ #include #include -#include "net_route.h" #include "net.h" +#include "route/route.h" /**************************************************************************** * Pre-processor Definitions diff --git a/net/netdev_findbyaddr.c b/net/netdev_findbyaddr.c index 99bdc9d9fd..7915f4a833 100644 --- a/net/netdev_findbyaddr.c +++ b/net/netdev_findbyaddr.c @@ -47,8 +47,8 @@ #include -#include "net_route.h" #include "net.h" +#include "route/route.h" /**************************************************************************** * Pre-processor Definitions diff --git a/net/netdev_ioctl.c b/net/netdev_ioctl.c index 3c7e4eedad..1505e668fe 100644 --- a/net/netdev_ioctl.c +++ b/net/netdev_ioctl.c @@ -64,7 +64,7 @@ #endif #include "net.h" -#include "net_route.h" +#include "route/route.h" /**************************************************************************** * Pre-processor Definitions diff --git a/net/route/Kconfig b/net/route/Kconfig new file mode 100644 index 0000000000..07b61d92dd --- /dev/null +++ b/net/route/Kconfig @@ -0,0 +1,23 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +menu "Routing Table Configuration" + +config NET_ROUTE + bool "Routing table support" + default n + ---help--- + Build in support for a routing table. See include/net/route.h + +if NET_ROUTE + +config NET_MAXROUTES + int "Routing table size" + default 4 + ---help--- + The size of the routing table (in entries). + +endif # NET_ROUTE +endmenu # ARP Configuration diff --git a/net/route/Make.defs b/net/route/Make.defs new file mode 100644 index 0000000000..1f6eef3a05 --- /dev/null +++ b/net/route/Make.defs @@ -0,0 +1,50 @@ +############################################################################ +# net/route/Make.defs +# +# Copyright (C) 2014 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_NET),y) +ifeq ($(CONFIG_NET_ROUTE),y) + +# Routing table support + +SOCK_CSRCS += net_addroute.c net_allocroute.c net_delroute.c +SOCK_CSRCS += net_foreachroute.c net_router.c netdev_router.c + +# Include routing table build support + +DEPPATH += --dep-path route +VPATH += :route + +endif +endif diff --git a/net/net_addroute.c b/net/route/net_addroute.c similarity index 98% rename from net/net_addroute.c rename to net/route/net_addroute.c index 7db5504d8e..a29e5b4619 100644 --- a/net/net_addroute.c +++ b/net/route/net_addroute.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_addroute.c + * net/route/net_addroute.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -47,7 +47,7 @@ #include #include "net.h" -#include "net_route.h" +#include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/net_allocroute.c b/net/route/net_allocroute.c similarity index 98% rename from net/net_allocroute.c rename to net/route/net_allocroute.c index 69fdd56b98..bcb82be2b0 100644 --- a/net/net_allocroute.c +++ b/net/route/net_allocroute.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_allocroute.c + * net/route/net_allocroute.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -46,7 +46,7 @@ #include #include "net.h" -#include "net_route.h" +#include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/net_delroute.c b/net/route/net_delroute.c similarity index 98% rename from net/net_delroute.c rename to net/route/net_delroute.c index 1d4571c52c..d1c84aa54c 100644 --- a/net/net_delroute.c +++ b/net/route/net_delroute.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_delroute.c + * net/route/net_delroute.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -44,7 +44,7 @@ #include #include "net.h" -#include "net_route.h" +#include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/net_foreachroute.c b/net/route/net_foreachroute.c similarity index 98% rename from net/net_foreachroute.c rename to net/route/net_foreachroute.c index 2b22abc901..fb2b7e87b5 100644 --- a/net/net_foreachroute.c +++ b/net/route/net_foreachroute.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_foreachroute.c + * net/route/net_foreachroute.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -45,7 +45,7 @@ #include #include "net.h" -#include "net_route.h" +#include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/net_router.c b/net/route/net_router.c similarity index 99% rename from net/net_router.c rename to net/route/net_router.c index 4851c08ec4..37fa91036a 100644 --- a/net/net_router.c +++ b/net/route/net_router.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_router.c + * net/route/net_router.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -44,7 +44,7 @@ #include #include "net.h" -#include "net_route.h" +#include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/netdev_router.c b/net/route/netdev_router.c similarity index 98% rename from net/netdev_router.c rename to net/route/netdev_router.c index bcb47b3abb..9074d733c1 100644 --- a/net/netdev_router.c +++ b/net/route/netdev_router.c @@ -1,7 +1,7 @@ /**************************************************************************** - * net/netdev_router.c + * net/route/netdev_router.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ #include #include "net.h" -#include "net_route.h" +#include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/net_route.h b/net/route/route.h similarity index 97% rename from net/net_route.h rename to net/route/route.h index e6484ce936..140afdf5d0 100644 --- a/net/net_route.h +++ b/net/route/route.h @@ -1,7 +1,7 @@ /**************************************************************************** - * net/net_route.h + * net/route/route.h * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __NET_NET_ROUTE_H -#define __NET_NET_ROUTE_H +#ifndef __NET_ROUTE_ROUTE_H +#define __NET_ROUTE_ROUTE_H /**************************************************************************** * Included Files @@ -260,4 +260,4 @@ int net_foreachroute(route_handler_t handler, FAR void *arg); #endif #endif /* CONFIG_NET_ROUTE */ -#endif /* __NET_NET_ROUTE_H */ +#endif /* __NET_ROUTE_ROUTE_H */ diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c index 97cf9053f5..929ca1c9b1 100644 --- a/net/tcp/tcp_send.c +++ b/net/tcp/tcp_send.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net//tcp_send.c + * net/tcp/tcp_send.c * * Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt