From 4b919a56642ccd0a44920feace872aeb5b7a62cf Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Sat, 11 Mar 2017 05:55:21 -0800 Subject: Attached hosts allow this config to function: set int ip address loop0 169.254.1.1/32 (the default GW address for attached hosts) set int unnumbered af_packet0 use loop0 ('enable' IP on the host interface) ip route add 192.168.1.1/32 via af_packet0 (where to find the host) repeat for each host and host interface. Inter-host communication is throught the /32 routes. To allow this: 1 - attached host routes have the ATTACHED flag set, so the ARP code accepts then as legitimate sources 2 - unnumbered interfaces inherit the source address from the IP interface Change-Id: Ib66c5f0e848c528f79372813adc3a0c11b50717f Signed-off-by: Neale Ranns --- src/vnet/fib/fib_entry_src.c | 4 ++++ src/vnet/fib/fib_path.c | 7 +++++++ src/vnet/fib/fib_path.h | 6 ++++++ src/vnet/fib/fib_table.c | 1 + src/vnet/fib/fib_types.h | 4 ++++ 5 files changed, 22 insertions(+) (limited to 'src/vnet/fib') diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c index feb232df7f1..aa1d5a24a0f 100644 --- a/src/vnet/fib/fib_entry_src.c +++ b/src/vnet/fib/fib_entry_src.c @@ -946,6 +946,10 @@ fib_path_is_attached (const fib_route_path_t *rpath) { return (!0); } + else if (rpath->frp_flags & FIB_ROUTE_PATH_ATTACHED) + { + return (!0); + } return (0); } diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c index aa545b5ed45..3ed309f328b 100644 --- a/src/vnet/fib/fib_path.c +++ b/src/vnet/fib/fib_path.c @@ -109,6 +109,10 @@ typedef enum fib_path_oper_attribute_t_ { * The path is resolved */ FIB_PATH_OPER_ATTRIBUTE_RESOLVED, + /** + * The path is attached, despite what the next-hop may say. + */ + FIB_PATH_OPER_ATTRIBUTE_ATTACHED, /** * The path has become a permanent drop. */ @@ -143,6 +147,7 @@ typedef enum fib_path_oper_flags_t_ { FIB_PATH_OPER_FLAG_RECURSIVE_LOOP = (1 << FIB_PATH_OPER_ATTRIBUTE_RECURSIVE_LOOP), FIB_PATH_OPER_FLAG_DROP = (1 << FIB_PATH_OPER_ATTRIBUTE_DROP), FIB_PATH_OPER_FLAG_RESOLVED = (1 << FIB_PATH_OPER_ATTRIBUTE_RESOLVED), + FIB_PATH_OPER_FLAG_ATTACHED = (1 << FIB_PATH_OPER_ATTRIBUTE_ATTACHED), } __attribute__ ((packed)) fib_path_oper_flags_t; /** @@ -963,6 +968,8 @@ fib_path_route_flags_to_cfg_flags (const fib_route_path_t *rpath) cfg_flags |= FIB_PATH_CFG_FLAG_RESOLVE_ATTACHED; if (rpath->frp_flags & FIB_ROUTE_PATH_LOCAL) cfg_flags |= FIB_PATH_CFG_FLAG_LOCAL; + if (rpath->frp_flags & FIB_ROUTE_PATH_ATTACHED) + cfg_flags |= FIB_PATH_CFG_FLAG_ATTACHED; return (cfg_flags); } diff --git a/src/vnet/fib/fib_path.h b/src/vnet/fib/fib_path.h index 91f49d09234..14efc1ab842 100644 --- a/src/vnet/fib/fib_path.h +++ b/src/vnet/fib/fib_path.h @@ -62,6 +62,10 @@ typedef enum fib_path_cfg_attribute_t_ { * Recursion constraint via attached */ FIB_PATH_CFG_ATTRIBUTE_RESOLVE_ATTACHED, + /** + * The path is attached + */ + FIB_PATH_CFG_ATTRIBUTE_ATTACHED, /** * The path is a for-us path */ @@ -83,6 +87,7 @@ typedef enum fib_path_cfg_attribute_t_ { [FIB_PATH_CFG_ATTRIBUTE_RESOLVE_HOST] = "resolve-host", \ [FIB_PATH_CFG_ATTRIBUTE_RESOLVE_ATTACHED] = "resolve-attached", \ [FIB_PATH_CFG_ATTRIBUTE_LOCAL] = "local", \ + [FIB_PATH_CFG_ATTRIBUTE_ATTACHED] = "attached", \ } #define FOR_EACH_FIB_PATH_CFG_ATTRIBUTE(_item) \ @@ -100,6 +105,7 @@ typedef enum fib_path_cfg_flags_t_ { FIB_PATH_CFG_FLAG_RESOLVE_HOST = (1 << FIB_PATH_CFG_ATTRIBUTE_RESOLVE_HOST), FIB_PATH_CFG_FLAG_RESOLVE_ATTACHED = (1 << FIB_PATH_CFG_ATTRIBUTE_RESOLVE_ATTACHED), FIB_PATH_CFG_FLAG_LOCAL = (1 << FIB_PATH_CFG_ATTRIBUTE_LOCAL), + FIB_PATH_CFG_FLAG_ATTACHED = (1 << FIB_PATH_CFG_ATTRIBUTE_ATTACHED), } __attribute__ ((packed)) fib_path_cfg_flags_t; diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c index a0ce0bbb4de..7818d02e05d 100644 --- a/src/vnet/fib/fib_table.c +++ b/src/vnet/fib/fib_table.c @@ -480,6 +480,7 @@ fib_table_route_path_fixup (const fib_prefix_t *prefix, path->frp_sw_if_index != ~0) { path->frp_addr = prefix->fp_addr; + path->frp_flags |= FIB_ROUTE_PATH_ATTACHED; } } diff --git a/src/vnet/fib/fib_types.h b/src/vnet/fib/fib_types.h index 05e0e0af4c9..1c5299a9214 100644 --- a/src/vnet/fib/fib_types.h +++ b/src/vnet/fib/fib_types.h @@ -282,6 +282,10 @@ typedef enum fib_route_path_flags_t_ * A for-us/local path */ FIB_ROUTE_PATH_LOCAL = (1 << 2), + /** + * Attached path + */ + FIB_ROUTE_PATH_ATTACHED = (1 << 3), } fib_route_path_flags_t; /** -- cgit 1.2.3-korg