Per-packet IPFIX record generation plugin
Change-Id: Ia790aa018e70d67ed343e3e466d1b33b22560fc0 Signed-off-by: Dave Barach <dave@barachs.net>
This commit is contained in:

committed by
Damjan Marion

parent
e63947e57c
commit
ad41b351bd
@ -10,3 +10,4 @@ Several modules provide operational, dataplane-user focused documentation.
|
||||
- @subpage lldp_doc
|
||||
- @subpage ioam_plugin_doc
|
||||
- @subpage lb_plugin_doc
|
||||
- @subpage flowperpkt_plugin_doc
|
||||
|
@ -51,3 +51,7 @@ endif
|
||||
if ENABLE_lb_PLUGIN
|
||||
SUBDIRS += lb-plugin
|
||||
endif
|
||||
|
||||
if ENABLE_flowperpkt_PLUGIN
|
||||
SUBDIRS += flowperpkt-plugin
|
||||
endif
|
||||
|
@ -58,6 +58,7 @@ PLUGIN_ENABLED(ioam)
|
||||
PLUGIN_ENABLED(snat)
|
||||
PLUGIN_ENABLED(ila)
|
||||
PLUGIN_ENABLED(lb)
|
||||
PLUGIN_ENABLED(flowperpkt)
|
||||
|
||||
# Disabled plugins, require --enable-XXX-plugin
|
||||
PLUGIN_DISABLED(vcgn)
|
||||
|
52
plugins/flowperpkt-plugin/Makefile.am
Normal file
52
plugins/flowperpkt-plugin/Makefile.am
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
# Copyright (c) <current-year> <your-organization>
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at:
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign subdir-objects
|
||||
|
||||
AM_CFLAGS = -Wall
|
||||
AM_LDFLAGS = -module -shared -avoid-version
|
||||
|
||||
vppapitestpluginsdir = ${libdir}/vpp_api_test_plugins
|
||||
vpppluginsdir = ${libdir}/vpp_plugins
|
||||
|
||||
vppplugins_LTLIBRARIES = flowperpkt_plugin.la
|
||||
vppapitestplugins_LTLIBRARIES = flowperpkt_test_plugin.la
|
||||
|
||||
flowperpkt_plugin_la_SOURCES = flowperpkt/flowperpkt.c \
|
||||
flowperpkt/node.c \
|
||||
flowperpkt/flowperpkt_plugin.api.h
|
||||
flowperpkt_plugin_la_LDFLAGS = -module
|
||||
|
||||
BUILT_SOURCES = flowperpkt/flowperpkt.api.h
|
||||
|
||||
SUFFIXES = .api.h .api
|
||||
|
||||
%.api.h: %.api
|
||||
mkdir -p `dirname $@` ; \
|
||||
$(CC) $(CPPFLAGS) -E -P -C -x c $^ \
|
||||
| vppapigen --input - --output $@ --show-name $@
|
||||
|
||||
noinst_HEADERS = \
|
||||
flowperpkt/flowperpkt_all_api_h.h \
|
||||
flowperpkt/flowperpkt_msg_enum.h \
|
||||
flowperpkt/flowperpkt.api.h
|
||||
|
||||
flowperpkt_test_plugin_la_SOURCES = \
|
||||
flowperpkt/flowperpkt_test.c flowperpkt/flowperpkt_plugin.api.h
|
||||
|
||||
# Remove *.la files
|
||||
install-data-hook:
|
||||
@(cd $(vpppluginsdir) && $(RM) $(vppplugins_LTLIBRARIES))
|
||||
@(cd $(vppapitestpluginsdir) && $(RM) $(vppapitestplugins_LTLIBRARIES))
|
||||
|
9
plugins/flowperpkt-plugin/configure.ac
Normal file
9
plugins/flowperpkt-plugin/configure.ac
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
AC_INIT(flowperpkt_plugin, 1.0)
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_CC
|
||||
|
||||
AC_OUTPUT([Makefile])
|
42
plugins/flowperpkt-plugin/flowperpkt/flowperpkt.api
Normal file
42
plugins/flowperpkt-plugin/flowperpkt/flowperpkt.api
Normal file
@ -0,0 +1,42 @@
|
||||
/* Define a simple enable-disable binary API to control the feature */
|
||||
|
||||
/** \file
|
||||
This file defines the vpp control-plane API messages
|
||||
used to control the flowperpkt plugin
|
||||
*/
|
||||
|
||||
/** \brief Enable / disable per-packet IPFIX recording on an interface
|
||||
@param client_index - opaque cookie to identify the sender
|
||||
@param context - sender context, to match reply w/ request
|
||||
@param is_add - add address if non-zero, else delete
|
||||
@param is_ipv6 - if non-zero the address is ipv6, else ipv4
|
||||
@param sw_if_index - index of the interface
|
||||
*/
|
||||
manual_print define flowperpkt_tx_interface_add_del
|
||||
{
|
||||
/* Client identifier, set from api_main.my_client_index */
|
||||
u32 client_index;
|
||||
|
||||
/* Arbitrary context, so client can match reply to request */
|
||||
u32 context;
|
||||
|
||||
/* Enable / disable the feature */
|
||||
u8 is_add;
|
||||
u8 is_ipv6;
|
||||
|
||||
/* Interface handle */
|
||||
u32 sw_if_index;
|
||||
};
|
||||
|
||||
/** \brief Reply to enable/disable per-packet IPFIX recording messages
|
||||
@param context - returned sender context, to match reply w/ request
|
||||
@param retval - return code
|
||||
*/
|
||||
define flowperpkt_tx_interface_add_del_reply
|
||||
{
|
||||
/* From the request */
|
||||
u32 context;
|
||||
|
||||
/* Return value, zero means all OK */
|
||||
i32 retval;
|
||||
};
|
500
plugins/flowperpkt-plugin/flowperpkt/flowperpkt.c
Normal file
500
plugins/flowperpkt-plugin/flowperpkt/flowperpkt.c
Normal file
File diff suppressed because it is too large
Load Diff
71
plugins/flowperpkt-plugin/flowperpkt/flowperpkt.h
Normal file
71
plugins/flowperpkt-plugin/flowperpkt/flowperpkt.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* flowperpkt.h - skeleton vpp engine plug-in header file
|
||||
*
|
||||
* Copyright (c) <current-year> <your-organization>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef __included_flowperpkt_h__
|
||||
#define __included_flowperpkt_h__
|
||||
|
||||
#include <vnet/vnet.h>
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <vnet/ethernet/ethernet.h>
|
||||
|
||||
#include <vppinfra/hash.h>
|
||||
#include <vppinfra/error.h>
|
||||
#include <vnet/flow/flow_report.h>
|
||||
#include <vnet/flow/flow_report_classify.h>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief flow-per-packet plugin header file
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** API message ID base */
|
||||
u16 msg_id_base;
|
||||
|
||||
/** ip4 feature index */
|
||||
u32 ip4_tx_feature_index;
|
||||
|
||||
/** Has the report been created? */
|
||||
int report_created;
|
||||
|
||||
/** ipfix buffers under construction, per-worker thread */
|
||||
vlib_buffer_t **buffers_per_worker;
|
||||
/** frames containing ipfix buffers, per-worker thread */
|
||||
vlib_frame_t **frames_per_worker;
|
||||
/** next record offset, per worker thread */
|
||||
u16 *next_record_offset_per_worker;
|
||||
|
||||
/** convenience vlib_main_t pointer */
|
||||
vlib_main_t *vlib_main;
|
||||
/** convenience vnet_main_t pointer */
|
||||
vnet_main_t *vnet_main;
|
||||
} flowperpkt_main_t;
|
||||
|
||||
extern flowperpkt_main_t flowperpkt_main;
|
||||
|
||||
vlib_node_registration_t flowperpkt_node;
|
||||
|
||||
void flowperpkt_flush_callback (void);
|
||||
|
||||
#endif /* __included_flowperpkt_h__ */
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
* Local Variables:
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
18
plugins/flowperpkt-plugin/flowperpkt/flowperpkt_all_api_h.h
Normal file
18
plugins/flowperpkt-plugin/flowperpkt/flowperpkt_all_api_h.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* flowperpkt_all_api_h.h - plug-in api #include file
|
||||
*
|
||||
* Copyright (c) <current-year> <your-organization>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* Include the generated file, see BUILT_SOURCES in Makefile.am */
|
||||
#include <flowperpkt/flowperpkt.api.h>
|
31
plugins/flowperpkt-plugin/flowperpkt/flowperpkt_msg_enum.h
Normal file
31
plugins/flowperpkt-plugin/flowperpkt/flowperpkt_msg_enum.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* flowperpkt_msg_enum.h - vpp engine plug-in message enumeration
|
||||
*
|
||||
* Copyright (c) <current-year> <your-organization>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef included_flowperpkt_msg_enum_h
|
||||
#define included_flowperpkt_msg_enum_h
|
||||
|
||||
#include <vppinfra/byte_order.h>
|
||||
|
||||
#define vl_msg_id(n,h) n,
|
||||
typedef enum
|
||||
{
|
||||
#include <flowperpkt/flowperpkt_all_api_h.h>
|
||||
/* We'll want to know how many messages IDs we need... */
|
||||
VL_MSG_FIRST_AVAILABLE,
|
||||
} vl_msg_id_t;
|
||||
#undef vl_msg_id
|
||||
|
||||
#endif /* included_flowperpkt_msg_enum_h */
|
231
plugins/flowperpkt-plugin/flowperpkt/flowperpkt_test.c
Normal file
231
plugins/flowperpkt-plugin/flowperpkt/flowperpkt_test.c
Normal file
@ -0,0 +1,231 @@
|
||||
/*
|
||||
* flowperpkt.c - skeleton vpp-api-test plug-in
|
||||
*
|
||||
* Copyright (c) <current-year> <your-organization>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <vat/vat.h>
|
||||
#include <vlibapi/api.h>
|
||||
#include <vlibmemory/api.h>
|
||||
#include <vlibsocket/api.h>
|
||||
#include <vppinfra/error.h>
|
||||
|
||||
/**
|
||||
* @file vpp_api_test plugin
|
||||
*/
|
||||
|
||||
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
|
||||
|
||||
/* Declare message IDs */
|
||||
#include <flowperpkt/flowperpkt_msg_enum.h>
|
||||
|
||||
/* define message structures */
|
||||
#define vl_typedefs
|
||||
#include <flowperpkt/flowperpkt_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
/* declare message handlers for each api */
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <flowperpkt/flowperpkt_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
/* instantiate all the print functions we know about */
|
||||
#define vl_print(handle, ...)
|
||||
#define vl_printfun
|
||||
#include <flowperpkt/flowperpkt_all_api_h.h>
|
||||
#undef vl_printfun
|
||||
|
||||
/* Get the API version number. */
|
||||
#define vl_api_version(n,v) static u32 api_version=(v);
|
||||
#include <flowperpkt/flowperpkt_all_api_h.h>
|
||||
#undef vl_api_version
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** API message ID base */
|
||||
u16 msg_id_base;
|
||||
/** vat_main_t pointer */
|
||||
vat_main_t *vat_main;
|
||||
} flowperpkt_test_main_t;
|
||||
|
||||
flowperpkt_test_main_t flowperpkt_test_main;
|
||||
|
||||
#define foreach_standard_reply_retval_handler \
|
||||
_(flowperpkt_tx_interface_add_del_reply)
|
||||
|
||||
#define _(n) \
|
||||
static void vl_api_##n##_t_handler \
|
||||
(vl_api_##n##_t * mp) \
|
||||
{ \
|
||||
vat_main_t * vam = flowperpkt_test_main.vat_main; \
|
||||
i32 retval = ntohl(mp->retval); \
|
||||
if (vam->async_mode) { \
|
||||
vam->async_errors += (retval < 0); \
|
||||
} else { \
|
||||
vam->retval = retval; \
|
||||
vam->result_ready = 1; \
|
||||
} \
|
||||
}
|
||||
foreach_standard_reply_retval_handler;
|
||||
#undef _
|
||||
|
||||
/*
|
||||
* Table of message reply handlers, must include boilerplate handlers
|
||||
* we just generated
|
||||
*/
|
||||
#define foreach_vpe_api_reply_msg \
|
||||
_(FLOWPERPKT_TX_INTERFACE_ADD_DEL_REPLY, \
|
||||
flowperpkt_tx_interface_add_del_reply)
|
||||
|
||||
|
||||
/* M: construct, but don't yet send a message */
|
||||
|
||||
#define M(T,t) \
|
||||
do { \
|
||||
vam->result_ready = 0; \
|
||||
mp = vl_msg_api_alloc(sizeof(*mp)); \
|
||||
memset (mp, 0, sizeof (*mp)); \
|
||||
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
|
||||
mp->client_index = vam->my_client_index; \
|
||||
} while(0);
|
||||
|
||||
#define M2(T,t,n) \
|
||||
do { \
|
||||
vam->result_ready = 0; \
|
||||
mp = vl_msg_api_alloc(sizeof(*mp)+(n)); \
|
||||
memset (mp, 0, sizeof (*mp)); \
|
||||
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
|
||||
mp->client_index = vam->my_client_index; \
|
||||
} while(0);
|
||||
|
||||
/* S: send a message */
|
||||
#define S (vl_msg_api_send_shmem (vam->vl_input_queue, (u8 *)&mp))
|
||||
|
||||
/* W: wait for results, with timeout */
|
||||
#define W \
|
||||
do { \
|
||||
timeout = vat_time_now (vam) + 1.0; \
|
||||
\
|
||||
while (vat_time_now (vam) < timeout) { \
|
||||
if (vam->result_ready == 1) { \
|
||||
return (vam->retval); \
|
||||
} \
|
||||
} \
|
||||
return -99; \
|
||||
} while(0);
|
||||
|
||||
static int
|
||||
api_flowperpkt_tx_interface_add_del (vat_main_t * vam)
|
||||
{
|
||||
flowperpkt_test_main_t *sm = &flowperpkt_test_main;
|
||||
unformat_input_t *i = vam->input;
|
||||
f64 timeout;
|
||||
int enable_disable = 1;
|
||||
u32 sw_if_index = ~0;
|
||||
vl_api_flowperpkt_tx_interface_add_del_t *mp;
|
||||
|
||||
/* Parse args required to build the message */
|
||||
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
|
||||
{
|
||||
if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
|
||||
;
|
||||
else if (unformat (i, "sw_if_index %d", &sw_if_index))
|
||||
;
|
||||
else if (unformat (i, "disable"))
|
||||
enable_disable = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (sw_if_index == ~0)
|
||||
{
|
||||
errmsg ("missing interface name / explicit sw_if_index number \n");
|
||||
return -99;
|
||||
}
|
||||
|
||||
/* Construct the API message */
|
||||
M (FLOWPERPKT_TX_INTERFACE_ADD_DEL, flowperpkt_tx_interface_add_del);
|
||||
mp->sw_if_index = ntohl (sw_if_index);
|
||||
mp->is_add = enable_disable;
|
||||
mp->is_ipv6 = 0; /* $$$$ */
|
||||
|
||||
/* send it... */
|
||||
S;
|
||||
|
||||
/* Wait for a reply... */
|
||||
W;
|
||||
}
|
||||
|
||||
/*
|
||||
* List of messages that the api test plugin sends,
|
||||
* and that the data plane plugin processes
|
||||
*/
|
||||
#define foreach_vpe_api_msg \
|
||||
_(flowperpkt_tx_interface_add_del, "<intfc> [disable]")
|
||||
|
||||
void
|
||||
vat_api_hookup (vat_main_t * vam)
|
||||
{
|
||||
flowperpkt_test_main_t *sm = &flowperpkt_test_main;
|
||||
/* Hook up handlers for replies from the data plane plug-in */
|
||||
#define _(N,n) \
|
||||
vl_msg_api_set_handlers((VL_API_##N + sm->msg_id_base), \
|
||||
#n, \
|
||||
vl_api_##n##_t_handler, \
|
||||
vl_noop_handler, \
|
||||
vl_api_##n##_t_endian, \
|
||||
vl_api_##n##_t_print, \
|
||||
sizeof(vl_api_##n##_t), 1);
|
||||
foreach_vpe_api_reply_msg;
|
||||
#undef _
|
||||
|
||||
/* API messages we can send */
|
||||
#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
|
||||
/* Help strings */
|
||||
#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
flowperpkt_test_main_t *sm = &flowperpkt_test_main;
|
||||
u8 *name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "flowperpkt_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
/* Don't attempt to hook up API messages if the data plane plugin is AWOL */
|
||||
if (sm->msg_id_base != (u16) ~ 0)
|
||||
vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
* Local Variables:
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
504
plugins/flowperpkt-plugin/flowperpkt/node.c
Normal file
504
plugins/flowperpkt-plugin/flowperpkt/node.c
Normal file
File diff suppressed because it is too large
Load Diff
13
plugins/flowperpkt-plugin/flowperpkt_plugin_doc.md
Normal file
13
plugins/flowperpkt-plugin/flowperpkt_plugin_doc.md
Normal file
@ -0,0 +1,13 @@
|
||||
Per-packet IPFIX flow record plugin {#flowperpkt_plugin_doc}
|
||||
===================================
|
||||
|
||||
## Introduction
|
||||
|
||||
This plugin generates one ipfix record entry per packet transmitted
|
||||
on interfaces which have the feature enabled
|
||||
|
||||
## Sample configuration
|
||||
|
||||
set ipfix exporter collector 192.168.6.2 src 192.168.6.1 template-interval 20 port 4739 path-mtu 1500
|
||||
|
||||
flowperpkt feature add-del GigabitEthernet2/3/0
|
@ -88,6 +88,8 @@ typedef struct
|
||||
<br> VLIB_BUFFER_TOTAL_LENGTH_VALID: as it says
|
||||
<br> VLIB_BUFFER_REPL_FAIL: packet replication failure
|
||||
<br> VLIB_BUFFER_RECYCLE: as it says
|
||||
<br> VLIB_BUFFER_FLOW_REPORT: buffer is a flow report,
|
||||
set to avoid adding it to a flow report
|
||||
<br> VLIB_BUFFER_FLAG_USER(n): user-defined bit N
|
||||
*/
|
||||
#define VLIB_BUFFER_IS_TRACED (1 << 0)
|
||||
@ -97,6 +99,7 @@ typedef struct
|
||||
#define VLIB_BUFFER_TOTAL_LENGTH_VALID (1 << 3)
|
||||
#define VLIB_BUFFER_REPL_FAIL (1 << 4)
|
||||
#define VLIB_BUFFER_RECYCLE (1 << 5)
|
||||
#define VLIB_BUFFER_FLOW_REPORT (1 << 6)
|
||||
|
||||
/* User defined buffer flags. */
|
||||
#define LOG2_VLIB_BUFFER_FLAG_USER(n) (32 - (n))
|
||||
|
@ -114,7 +114,7 @@ int send_template_packet (flow_report_main_t *frm,
|
||||
clib_memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite));
|
||||
b0->current_data = 0;
|
||||
b0->current_length = vec_len (fr->rewrite);
|
||||
b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
|
||||
b0->flags |= (VLIB_BUFFER_TOTAL_LENGTH_VALID | VLIB_BUFFER_FLOW_REPORT);
|
||||
vnet_buffer (b0)->sw_if_index[VLIB_RX] = 0;
|
||||
vnet_buffer (b0)->sw_if_index[VLIB_TX] = frm->fib_index;
|
||||
|
||||
|
Reference in New Issue
Block a user