34 #define foreach_mactime_error \ 35 _(OK, "Permitted packets") \ 36 _(STATIC_DROP, "Static drop packets") \ 37 _(RANGE_DROP, "Range drop packets") \ 38 _(QUOTA_DROP, "Data quota drop packets") \ 39 _(DROP_10001, "Dropped UDP DST-port 10001") 43 #define _(sym,str) MACTIME_ERROR_##sym, 50 #define _(sym,string) string, 70 s =
format (s,
"MACTIME: src mac %U device %s result %s\n",
82 u32 n_left_from, *from, *to_next;
108 while (n_left_from > 0)
114 while (n_left_from > 0 && n_left_to_next > 0)
122 int has_dynamic_range_allow = 0;
154 if (clib_bihash_search_8_8 (lut, &kv, &kv) < 0)
167 device_index0 = kv.
value;
178 &device_current_count);
182 b0->
error = node->
errors[MACTIME_ERROR_QUOTA_DROP];
199 b0->
error = node->
errors[MACTIME_ERROR_STATIC_DROP];
215 if (ip->
protocol != IP_PROTOCOL_UDP)
217 if (clib_net_to_host_u16 (udp->
dst_port) == 10001 ||
218 clib_net_to_host_u16 (udp->
dst_port) == 9603)
221 b0->
error = node->
errors[MACTIME_ERROR_DROP_10001];
247 has_dynamic_range_allow = 1;
250 if (now >= start0 && now <= end0)
259 b0->
error = node->
errors[MACTIME_ERROR_RANGE_DROP];
263 else if (has_dynamic_range_allow)
268 b0->
error = node->
errors[MACTIME_ERROR_QUOTA_DROP];
298 b0->
error = node->
errors[MACTIME_ERROR_STATIC_DROP];
314 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
333 to_next, n_left_to_next,
341 MACTIME_ERROR_OK, packets_ok);
357 .vector_size =
sizeof (
u32),
386 .name =
"mactime-tx",
387 .vector_size =
sizeof (
u32),
vnet_config_main_t config_main
#define MACTIME_DEVICE_FLAG_DYNAMIC_ALLOW_QUOTA
static char * mactime_error_strings[]
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
vlib_combined_counter_main_t drop_counters
#define foreach_mactime_error
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
#define clib_memcpy_fast(a, b, c)
#define MACTIME_DEVICE_FLAG_DYNAMIC_ALLOW
Combined counter to hold both packets and byte differences.
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
vlib_node_registration_t mactime_tx_node
(constructor) VLIB_REGISTER_NODE (mactime_tx_node)
#define MACTIME_DEVICE_FLAG_DROP_UDP_10001
clib_timebase_range_t * ranges
static f64 clib_timebase_now(clib_timebase_t *tb)
description fragment has unexpected format
#define MACTIME_DEVICE_FLAG_STATIC_ALLOW
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static uword mactime_node_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_tx)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
mactime_main_t mactime_main
static uword mactime_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_combined_counter_main_t allow_counters
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define MACTIME_DEVICE_FLAG_DYNAMIC_DROP
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
vlib_node_registration_t mactime_node
(constructor) VLIB_REGISTER_NODE (mactime_node)
u32 node_index
Node index.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
sll srl srl sll sra u16x4 i
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
8 octet key, 8 octet key value pair
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
vlib_main_t vlib_node_runtime_t * node
vl_api_mac_address_t src_mac
mactime_device_t * devices
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u8 output_feature_arc_index
static uword mactime_tx_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static u8 * format_mactime_trace(u8 *s, va_list *args)
#define MACTIME_DEVICE_FLAG_STATIC_DROP
Always drop packets from this device.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
clib_bihash_8_8_t lookup_table
void mactime_send_create_entry_message(u8 *mac_address)
Create a lookup table entry for the indicated mac address.
struct _vlib_node_registration vlib_node_registration_t
counter_t bytes
byte counter
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u8 * format_mac_address(u8 *s, va_list *args)
u16 flags
Copy of main node flags.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define VLIB_NODE_FLAG_TRACE
static_always_inline vnet_feature_config_main_t * vnet_feature_get_config_main(u16 arc)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
__clib_export f64 clib_timebase_find_sunday_midnight(f64 start_time)