summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/hash.h
diff options
context:
space:
mode:
authorRay Kinsella <ray.kinsella@intel.com>2017-04-21 12:24:43 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-04-28 08:01:12 +0000
commitc855b73f785b3c4c1756927ad542de13ba193b6f (patch)
tree282b4c2ee5b34f20bb9a71b130f20181c55179e5 /src/vppinfra/hash.h
parentd77630adaf48f05766c33ec60ef19ed50acae161 (diff)
af_packet: reflect admin device state on host
Setting the interface state in VPP on an af_packet device, was not being reflected on the host. This implied the user had to set the device state in VPP and then on the host, in order to put the interface into an 'up' state. This changes makes the device state consisent in VPP and the host. Change-Id: I6dc6aee79503e04576683db937b861337a2b375b Signed-off-by: Ray Kinsella <ray.kinsella@intel.com>
Diffstat (limited to 'src/vppinfra/hash.h')
0 files changed, 0 insertions, 0 deletions
a> 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * 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.
 */
/*
 * ip/ip4_source_check.c: IP v4 check source address (unicast RPF check)
 *
 * Copyright (c) 2008 Eliot Dresselhaus
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#include <urpf/urpf.h>
#include <urpf/urpf_dp.h>

static char *ip4_urpf_error_strings[] = {
#define _(a,b) "ip4-" # b,
  foreach_urpf_error
#undef _
};

VLIB_NODE_FN (ip4_rx_urpf_loose) (vlib_main_t * vm,
				  vlib_node_runtime_t * node,
				  vlib_frame_t * frame)
{
  return (urpf_inline (vm, node, frame, AF_IP4, VLIB_RX, URPF_MODE_LOOSE));
}

VLIB_NODE_FN (ip4_rx_urpf_strict) (vlib_main_t * vm,
				   vlib_node_runtime_t * node,
				   vlib_frame_t * frame)
{
  return (urpf_inline (vm, node, frame, AF_IP4, VLIB_RX, URPF_MODE_STRICT));
}

VLIB_NODE_FN (ip4_tx_urpf_loose) (vlib_main_t * vm,
				  vlib_node_runtime_t * node,
				  vlib_frame_t * frame)
{
  return (urpf_inline (vm, node, frame, AF_IP4, VLIB_TX, URPF_MODE_LOOSE));
}

VLIB_NODE_FN (ip4_tx_urpf_strict) (vlib_main_t * vm,
				   vlib_node_runtime_t * node,
				   vlib_frame_t * frame)
{
  return (urpf_inline (vm, node, frame, AF_IP4, VLIB_TX, URPF_MODE_STRICT));
}

/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_rx_urpf_loose) = {
  .name = "ip4-rx-urpf-loose",
  .vector_size = sizeof (u32),

  .n_next_nodes = URPF_N_NEXT,
  .next_nodes = {
    [URPF_NEXT_DROP] = "ip4-drop",
  },
  .n_errors = ARRAY_LEN (ip4_urpf_error_strings),
  .error_strings = ip4_urpf_error_strings,

  .format_buffer = format_ip4_header,
  .format_trace = format_urpf_trace,
};

VLIB_REGISTER_NODE (ip4_rx_urpf_strict) = {
  .name = "ip4-rx-urpf-strict",
  .vector_size = sizeof (u32),

  .n_next_nodes = URPF_N_NEXT,
  .next_nodes = {
    [URPF_NEXT_DROP] = "ip4-drop",
  },
  .n_errors = ARRAY_LEN (ip4_urpf_error_strings),
  .error_strings = ip4_urpf_error_strings,

  .format_buffer = format_ip4_header,
  .format_trace = format_urpf_trace,
};

VLIB_REGISTER_NODE (ip4_tx_urpf_loose) = {
  .name = "ip4-tx-urpf-loose",
  .vector_size = sizeof (u32),

  .n_next_nodes = URPF_N_NEXT,
  .next_nodes = {
    [URPF_NEXT_DROP] = "ip4-drop",
  },
  .n_errors = ARRAY_LEN (ip4_urpf_error_strings),
  .error_strings = ip4_urpf_error_strings,

  .format_buffer = format_ip4_header,
  .format_trace = format_urpf_trace,
};

VLIB_REGISTER_NODE (ip4_tx_urpf_strict) = {
  .name = "ip4-tx-urpf-strict",
  .vector_size = sizeof (u32),

  .n_next_nodes = URPF_N_NEXT,
  .next_nodes = {
    [URPF_NEXT_DROP] = "ip4-drop",
  },
  .n_errors = ARRAY_LEN (ip4_urpf_error_strings),
  .error_strings = ip4_urpf_error_strings,

  .format_buffer = format_ip4_header,
  .format_trace = format_urpf_trace,
};

VNET_FEATURE_INIT (ip4_rx_urpf_loose_feat, static) =
{
  .arc_name = "ip4-unicast",
  .node_name = "ip4-rx-urpf-loose",
  .runs_before = VNET_FEATURES ("ip4-rx-urpf-strict"),
};

VNET_FEATURE_INIT (ip4_rx_urpf_strict_feat, static) =
{
  .arc_name = "ip4-unicast",
  .node_name = "ip4-rx-urpf-strict",
  .runs_before = VNET_FEATURES ("ip4-policer-classify"),
};

VNET_FEATURE_INIT (ip4_tx_urpf_loose_feat, static) =
{
  .arc_name = "ip4-output",
  .node_name = "ip4-tx-urpf-loose",
};

VNET_FEATURE_INIT (ip4_tx_urpf_strict_feat, static) =
{
  .arc_name = "ip4-output",
  .node_name = "ip4-tx-urpf-strict",
};
/* *INDENT-ON* */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */