aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/punt.h
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2017-05-16 14:59:29 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-09-05 12:07:22 +0000
commitf7a55ad74c90928d86f1bbf56590d9571c1b828f (patch)
treee00a9cfa4d28e2f8bf4acc6d4c95ccee03fb6f45 /src/vnet/ip/punt.h
parent809bc74b5b73634678e6f1444344fd1c0a89e877 (diff)
PUNT socket: External control plane processes connected via UNIX domain sockets.
An external (to VPP) process can register (over the VPP binary API) to receive control plane packets over a UNIX domain socket. The packets are prepended with a packet descriptor containing meta-data (if_index of interface, etc). Currently only UDP is supported. The socket supports sending of packets/frames as well. The sent packet is prepended with a descriptor, telling VPP to route the packet (via ip4-lookup, ip6-lookup) or as an pre-formed Ethernet frame that is sent directly to interface-output. The intended use case for this is for an external DHCP client or a RIP implementation. New configuration option: punt { socket <socket path> } To register use the punt_socket API message. TODO: - Add support for pre-routing. I.e send L3 packet to given TX interface, but do ARP/ND (ip[46]-rewrite) - Add test scripts - Support for abstract names (starting with \0) - Add rate limiting (COP) - Support for other protocols, e.g. IPv6 ND Change-Id: I4a0afc8020deebb3d9d74686dde694ee5bcb8d0f Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vnet/ip/punt.h')
-rw-r--r--src/vnet/ip/punt.h52
1 files changed, 50 insertions, 2 deletions
diff --git a/src/vnet/ip/punt.h b/src/vnet/ip/punt.h
index 09a9d4c55bf..0103249cca0 100644
--- a/src/vnet/ip/punt.h
+++ b/src/vnet/ip/punt.h
@@ -20,6 +20,7 @@
#ifndef included_punt_h
#define included_punt_h
+#include <sys/un.h>
typedef enum
{
#define punt_error(n,s) PUNT_ERROR_##n,
@@ -30,9 +31,56 @@ typedef enum
clib_error_t *vnet_punt_add_del (vlib_main_t * vm, u8 ipv,
- u8 protocol, u16 port, int is_add);
+ u8 protocol, u16 port, bool is_add);
+clib_error_t *vnet_punt_socket_add (vlib_main_t * vm, u32 header_version,
+ bool is_ip4, u8 protocol, u16 port,
+ char *client_pathname);
+clib_error_t *vnet_punt_socket_del (vlib_main_t * vm, bool is_ip4,
+ u8 l4_protocol, u16 port);
+char *vnet_punt_get_server_pathname (void);
-#endif /* included_punt_h */
+enum punt_action_e
+{
+ PUNT_L2 = 0,
+ PUNT_IP4_ROUTED,
+ PUNT_IP6_ROUTED,
+};
+
+/*
+ * Packet descriptor header. Version 1
+ * If this header changes, the version must also change to notify clients.
+ */
+#define PUNT_PACKETDESC_VERSION 1
+typedef struct __attribute__ ((packed))
+{
+ u32 sw_if_index; /* RX or TX interface */
+ enum punt_action_e action;
+} punt_packetdesc_t;
+
+/*
+ * Client registration
+ */
+typedef struct
+{
+ u16 port;
+ struct sockaddr_un caddr;
+} punt_client_t;
+
+typedef struct
+{
+ int socket_fd;
+ char sun_path[sizeof (struct sockaddr_un)];
+ punt_client_t *clients_by_dst_port4;
+ punt_client_t *clients_by_dst_port6;
+ u32 unix_file_index;
+ bool is_configured;
+ vlib_node_t *interface_output_node;
+ u32 *ready_fds;
+ u32 *rx_buffers;
+} punt_main_t;
+extern punt_main_t punt_main;
+
+#endif
/*
* fd.io coding-style-patch-verification: ON