summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-02-25 23:17:38 +0100
committerDamjan Marion <damarion@cisco.com>2016-02-26 13:17:30 +0100
commite936bbe5945ca3c0f522f6c0abdfbdaa407bcb84 (patch)
tree28ccdd0be90ff9236fc57cf058a42d378ddbb250 /vnet
parent7f620976e2cb900fa5e0dccdbb769e3cc208841d (diff)
Add support for native vpp_lite (non-dpdk) platform
Change-Id: Icaa71957f67b923bc9795baa78c7495055615672 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/Makefile.am4
-rw-r--r--vnet/vnet/ip/ip6_neighbor.c4
-rw-r--r--vnet/vnet/ipsec/esp.h2
-rw-r--r--vnet/vnet/ipsec/ikev2.c29
-rw-r--r--vnet/vnet/ipsec/ikev2_payload.c2
-rw-r--r--vnet/vnet/ipsec/ipsec.h7
-rw-r--r--vnet/vnet/ipsec/ipsec_output.c21
-rw-r--r--vnet/vnet/lawful-intercept/node.c6
-rw-r--r--vnet/vnet/policer/node_funcs.c3
-rw-r--r--vnet/vnet/policer/policer.c1
-rw-r--r--vnet/vnet/policer/xlate.c1
11 files changed, 42 insertions, 38 deletions
diff --git a/vnet/Makefile.am b/vnet/Makefile.am
index 411dce3bd10..cf1fb1e0ab3 100644
--- a/vnet/Makefile.am
+++ b/vnet/Makefile.am
@@ -299,7 +299,6 @@ libvnet_la_SOURCES += \
vnet/ipsec/ipsec.c \
vnet/ipsec/ipsec_cli.c \
vnet/ipsec/ipsec_format.c \
- vnet/ipsec/ipsec_output.c \
vnet/ipsec/ipsec_input.c \
vnet/ipsec/ipsec_if.c \
vnet/ipsec/ipsec_if_in.c \
@@ -313,6 +312,9 @@ libvnet_la_SOURCES += \
vnet/ipsec/ikev2_format.c
endif
+libvnet_la_SOURCES += \
+ vnet/ipsec/ipsec_output.c
+
nobase_include_HEADERS += \
vnet/ipsec/ipsec.h \
vnet/ipsec/esp.h \
diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c
index 3eb9710ddec..70d77a5fbc7 100644
--- a/vnet/vnet/ip/ip6_neighbor.c
+++ b/vnet/vnet/ip/ip6_neighbor.c
@@ -284,10 +284,10 @@ typedef struct {
ip6_address_t addr;
} ip6_neighbor_set_unset_rpc_args_t;
+#if DPDK > 0
static void ip6_neighbor_set_unset_rpc_callback
( ip6_neighbor_set_unset_rpc_args_t * a);
-#if DPDK > 0
static void set_unset_ip6_neighbor_rpc
(vlib_main_t * vm,
u32 sw_if_index,
@@ -458,6 +458,7 @@ vnet_unset_ip6_ethernet_neighbor (vlib_main_t * vm,
return rv;
}
+#if DPDK > 0
static void ip6_neighbor_set_unset_rpc_callback
( ip6_neighbor_set_unset_rpc_args_t * a)
{
@@ -469,6 +470,7 @@ static void ip6_neighbor_set_unset_rpc_callback
vnet_unset_ip6_ethernet_neighbor (vm, a->sw_if_index, &a->addr,
a->link_layer_address, 6);
}
+#endif
static int
ip6_neighbor_sort (void *a1, void *a2)
diff --git a/vnet/vnet/ipsec/esp.h b/vnet/vnet/ipsec/esp.h
index 3d46a013b5d..b44c26e1fa4 100644
--- a/vnet/vnet/ipsec/esp.h
+++ b/vnet/vnet/ipsec/esp.h
@@ -12,7 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#if DPDK==1
#include <vnet/devices/dpdk/dpdk.h>
+#endif
#include <openssl/hmac.h>
#include <openssl/rand.h>
diff --git a/vnet/vnet/ipsec/ikev2.c b/vnet/vnet/ipsec/ikev2.c
index ab2277f5f90..70dd58bd64a 100644
--- a/vnet/vnet/ipsec/ikev2.c
+++ b/vnet/vnet/ipsec/ikev2.c
@@ -26,29 +26,6 @@ static int ikev2_delete_tunnel_interface(vnet_main_t * vnm,
ikev2_sa_t *sa,
ikev2_child_sa_t * child);
-static void hexdump(u8 buffer[], int len)
-{
-#define HEXDUMP_LINE_LEN 16
- int i;
- char s[HEXDUMP_LINE_LEN+1];
- bzero(s, HEXDUMP_LINE_LEN+1);
-
- for(i=0; i < len; i++) {
- if (!(i%HEXDUMP_LINE_LEN)) {
- if (s[0])
- printf("[%s]",s);
- printf("\n%05x: ", i);
- bzero(s, HEXDUMP_LINE_LEN);
- }
- s[i%HEXDUMP_LINE_LEN]=isprint(buffer[i])?buffer[i]:'.';
- printf("%02x ", buffer[i]);
- }
- while(i++%HEXDUMP_LINE_LEN)
- printf(" ");
-
- printf("[%s]\n", s);
-}
-
#define ikev2_set_state(sa, v) do { \
(sa)->state = v; \
clib_warning("sa state changed to " #v); \
@@ -458,7 +435,6 @@ ikev2_calc_child_keys(ikev2_sa_t *sa, ikev2_child_sa_t * child)
int len = ctr_encr->key_len * 2 + ctr_integ->key_len * 2;
keymat = ikev2_calc_prfplus(tr_prf, sa->sk_d, s, len);
- hexdump(keymat, vec_len(keymat));
int pos = 0;
@@ -1884,7 +1860,6 @@ ikev2_node_fn (vlib_main_t * vm,
ike0->exchange,
format_ip4_address, ip40->src_address.as_u8,
format_ip4_address, ip40->dst_address.as_u8);
- hexdump((u8 *) ip40, b0->current_length);
}
dispatch0:
@@ -1899,10 +1874,6 @@ dispatch0:
b0->current_length = len + sizeof(ip4_header_t) + sizeof(udp_header_t);
ip40->length = clib_host_to_net_u16(b0->current_length);
ip40->checksum = ip4_header_checksum (ip40);
-#if 0
- clib_warning("sending response:");
- hexdump(vlib_buffer_get_current (b0), b0->current_length);
-#endif
}
/* delete sa */
if (sa0 && (sa0->state == IKEV2_STATE_DELETED ||
diff --git a/vnet/vnet/ipsec/ikev2_payload.c b/vnet/vnet/ipsec/ikev2_payload.c
index f523fa81cba..a1ee51929e5 100644
--- a/vnet/vnet/ipsec/ikev2_payload.c
+++ b/vnet/vnet/ipsec/ikev2_payload.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include <ctype.h>
+
#include <vnet/vnet.h>
#include <vnet/api_errno.h>
#include <vnet/ip/ip.h>
diff --git a/vnet/vnet/ipsec/ipsec.h b/vnet/vnet/ipsec/ipsec.h
index 6ef36d02855..b755976f2b0 100644
--- a/vnet/vnet/ipsec/ipsec.h
+++ b/vnet/vnet/ipsec/ipsec.h
@@ -12,7 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#if DPDK==1
#include <vnet/devices/dpdk/dpdk.h>
+#endif
#define foreach_ipsec_policy_action \
_(0, BYPASS, "bypass") \
@@ -237,9 +239,12 @@ int ipsec_set_interface_key(vnet_main_t * vnm, u32 hw_if_index, ipsec_if_set_key
always_inline void
ipsec_alloc_empty_buffers(vlib_main_t * vm, ipsec_main_t *im)
{
+#if DPDK==1
dpdk_main_t * dm = &dpdk_main;
u32 free_list_index = dm->vlib_buffer_free_list_index;
-
+#else
+ u32 free_list_index = VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX;
+#endif
uword l = vec_len (im->empty_buffers);
uword n_alloc = 0;
diff --git a/vnet/vnet/ipsec/ipsec_output.c b/vnet/vnet/ipsec/ipsec_output.c
index ac5968b906d..fd804fae595 100644
--- a/vnet/vnet/ipsec/ipsec_output.c
+++ b/vnet/vnet/ipsec/ipsec_output.c
@@ -21,6 +21,7 @@
#include <vnet/ipsec/ipsec.h>
+#if IPSEC > 0
#define foreach_ipsec_output_next \
_(DROP, "error-drop") \
@@ -403,3 +404,23 @@ VLIB_REGISTER_NODE (ipsec_output_node) = {
#undef _
},
};
+
+#else /* IPSEC > 1 */
+
+/* Dummy ipsec output node, in case when IPSec is disabled */
+
+static uword
+ipsec_output_node_fn (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
+{
+ clib_warning ("IPSec disabled");
+ return 0;
+}
+
+VLIB_REGISTER_NODE (ipsec_output_node) = {
+ .vector_size = sizeof (u32),
+ .function = ipsec_output_node_fn,
+ .name = "ipsec-output",
+};
+#endif
diff --git a/vnet/vnet/lawful-intercept/node.c b/vnet/vnet/lawful-intercept/node.c
index 8a47aa32855..26514cc5c14 100644
--- a/vnet/vnet/lawful-intercept/node.c
+++ b/vnet/vnet/lawful-intercept/node.c
@@ -290,12 +290,6 @@ VLIB_REGISTER_NODE (li_hit_node) = {
.name = "li-hit",
};
-VLIB_REGISTER_NODE (ipsec_output_node) = {
- .vector_size = sizeof (u32),
- .function = li_hit_node_fn,
- .name = "ipsec-output",
-};
-
static clib_error_t *
li_init (vlib_main_t * vm)
{
diff --git a/vnet/vnet/policer/node_funcs.c b/vnet/vnet/policer/node_funcs.c
index b85418feecb..8a76e8697ff 100644
--- a/vnet/vnet/policer/node_funcs.c
+++ b/vnet/vnet/policer/node_funcs.c
@@ -12,6 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#include <stdint.h>
+
#include <vlib/vlib.h>
#include <vnet/vnet.h>
#include <vnet/policer/policer.h>
diff --git a/vnet/vnet/policer/policer.c b/vnet/vnet/policer/policer.c
index 310c5f59f20..a43dc751205 100644
--- a/vnet/vnet/policer/policer.c
+++ b/vnet/vnet/policer/policer.c
@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <stdint.h>
#include <vnet/policer/policer.h>
u8 * format_policer_instance (u8 * s, va_list * va)
diff --git a/vnet/vnet/policer/xlate.c b/vnet/vnet/policer/xlate.c
index 6e8c324a5d3..d1eab304d39 100644
--- a/vnet/vnet/policer/xlate.c
+++ b/vnet/vnet/policer/xlate.c
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <assert.h>
#include <math.h>
+#include <stdint.h>
#include <vlib/vlib.h>
#include <vnet/vnet.h>