diff options
author | Jeff Shaw <jeffrey.b.shaw@intel.com> | 2016-06-29 09:40:23 -0700 |
---|---|---|
committer | Jeff Shaw <jeffrey.b.shaw@intel.com> | 2016-06-29 09:47:52 -0700 |
commit | eadba30ee0e7c9cf37b0c0529c9ab27f6b5c0d6b (patch) | |
tree | 34d8316f41a92ae8d27e31db9f0281c73429c2f1 /router | |
parent | c2a7f2f748049c85a34ea8797cdca193d2f5e981 (diff) |
[router] Support tcp injection on tapped interfaces.
Enabled with 'tap inject arp,icmp4,tcp from ... as ...'
Change-Id: Ibc1670a8d4b9b3c4369ced9e42df85f496f4129c
Signed-off-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Diffstat (limited to 'router')
-rw-r--r-- | router/router/router.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/router/router/router.c b/router/router/router.c index c09be6c..4d72c1b 100644 --- a/router/router/router.c +++ b/router/router/router.c @@ -286,6 +286,7 @@ enum { PROTO_ARP = 0, PROTO_ICMP4, PROTO_OSPF2, + PROTO_TCP, PROTO_N_TOTAL, }; @@ -293,12 +294,14 @@ enum { PROTO_BIT_ARP = 1 << PROTO_ARP, PROTO_BIT_ICMP4 = 1 << PROTO_ICMP4, PROTO_BIT_OSPF2 = 1 << PROTO_OSPF2, + PROTO_BIT_TCP = 1 << PROTO_TCP, }; static char *proto_strings[PROTO_N_TOTAL] = { [PROTO_ARP] = "arp", [PROTO_ICMP4] = "icmp4", [PROTO_OSPF2] = "ospf2", + [PROTO_TCP] = "tcp", }; static inline u32 parse_protos(char *proto_string) @@ -417,6 +420,11 @@ tap_inject(vlib_main_t *m, unformat_input_t *input, vlib_cli_command_t *cmd) return clib_error_return(0, "ospf2 requires arp and icmp4"); + if (protos & PROTO_BIT_TCP) /* Require arp and icmp4 for tcp. */ + if (!(protos & PROTO_BIT_ARP) || !(protos & PROTO_BIT_ICMP4)) + return clib_error_return(0, + "tcp requires arp and icmp4"); + err = do_tap_connect(m, name, iface, &tap); if (err) { if (tap != ~0) @@ -451,7 +459,11 @@ tap_inject(vlib_main_t *m, unformat_input_t *input, vlib_cli_command_t *cmd) if (protos & PROTO_BIT_OSPF2) ip4_register_protocol(IP_PROTOCOL_OSPF, - tap_inject_icmp_node.index); + tap_inject_classified_node.index); + + if (protos & PROTO_BIT_TCP) + ip4_register_protocol(IP_PROTOCOL_TCP, + tap_inject_classified_node.index); /* Find sw_if_index of tap associated with data plane interface. */ rm.iface_to_tap[iface] = tap; |