summaryrefslogtreecommitdiffstats
path: root/vnet/etc/scripts/ludd-cluster-1/ludd-cluster-1-classify6
diff options
context:
space:
mode:
authorEd Warnicke <eaw@cisco.com>2015-12-08 15:45:58 -0700
committerEd Warnicke <eaw@cisco.com>2015-12-08 15:47:27 -0700
commitcb9cadad578297ffd78fa8a33670bdf1ab669e7e (patch)
tree6ac2be912482cc7849a26f0ab845561c3d7f4e26 /vnet/etc/scripts/ludd-cluster-1/ludd-cluster-1-classify6
parentfb0815d4ae4bb0fe27bd9313f34b45c8593b907e (diff)
Initial commit of vpp code.v1.0.0
Change-Id: Ib246f1fbfce93274020ee93ce461e3d8bd8b9f17 Signed-off-by: Ed Warnicke <eaw@cisco.com>
Diffstat (limited to 'vnet/etc/scripts/ludd-cluster-1/ludd-cluster-1-classify6')
-rw-r--r--vnet/etc/scripts/ludd-cluster-1/ludd-cluster-1-classify65
1 files changed, 5 insertions, 0 deletions
diff --git a/vnet/etc/scripts/ludd-cluster-1/ludd-cluster-1-classify6 b/vnet/etc/scripts/ludd-cluster-1/ludd-cluster-1-classify6
new file mode 100644
index 00000000000..6579d50d3c5
--- /dev/null
+++ b/vnet/etc/scripts/ludd-cluster-1/ludd-cluster-1-classify6
@@ -0,0 +1,5 @@
+classify table mask l3 ip6 src buckets 2 miss-next local
+set ip6 classify intfc GigabitEthernet2/2/0 table-index 0
+set int ip address GigabitEthernet2/2/0 db01::1/64
+set int state GigabitEthernet2/2/0 up
+classify session hit-next local table-index 0 match l3 ip6 src db01::2
.highlight .kn { color: #f92672 } /* Keyword.Namespace */ .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */ .highlight .kr { color: #66d9ef } /* Keyword.Reserved */ .highlight .kt { color: #66d9ef } /* Keyword.Type */ .highlight .ld { color: #e6db74 } /* Literal.Date */ .highlight .m { color: #ae81ff } /* Literal.Number */ .highlight .s { color: #e6db74 } /* Literal.String */ .highlight .na { color: #a6e22e } /* Name.Attribute */ .highlight .nb { color: #f8f8f2 } /* Name.Builtin */ .highlight .nc { color: #a6e22e } /* Name.Class */ .highlight .no { color: #66d9ef } /* Name.Constant */ .highlight .nd { color: #a6e22e } /* Name.Decorator */ .highlight .ni { color: #f8f8f2 } /* Name.Entity */ .highlight .ne { color: #a6e22e } /* Name.Exception */ .highlight .nf { color: #a6e22e } /* Name.Function */ .highlight .nl { color: #f8f8f2 } /* Name.Label */ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */ .highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 *------------------------------------------------------------------
 * Copyright (c) 2017 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.
 *------------------------------------------------------------------
 */

#include <igmp/igmp_ssm_range.h>

typedef struct igmp_group_prefix_t
{
  fib_prefix_t igp_prefix;
  igmp_group_prefix_type_t igp_type;
} igmp_group_prefix_t;

static igmp_group_prefix_t *igmp_group_prefixs;

u8 *
format_igmp_group_prefix_type (u8 * s, va_list * args)
{
  igmp_group_prefix_type_t type = va_arg (*args, int);

  switch (type)
    {
#define _(n,f) case IGMP_GROUP_PREFIX_TYPE_##f: return (format (s, "%s", #f));
      foreach_igmp_group_prefix_type
#undef _
    }
  return format (s, "unknown:%d", type);
}

static int
igmp_group_prefix_cmp (const igmp_group_prefix_t * gp1,
		       const fib_prefix_t * p)
{
  return (fib_prefix_cmp (&gp1->igp_prefix, p));
}

void
igmp_group_prefix_set (const fib_prefix_t * pfx,
		       igmp_group_prefix_type_t type)
{
  u32 pos;

  pos =
    vec_search_with_function (igmp_group_prefixs, pfx, igmp_group_prefix_cmp);

  if ((~0 == pos) && (IGMP_GROUP_PREFIX_TYPE_SSM == type))
    {
      igmp_group_prefix_t gp = {
	.igp_prefix = *pfx,
	.igp_type = type,
      };

      vec_add1 (igmp_group_prefixs, gp);
    }
  if ((~0 != pos) && (IGMP_GROUP_PREFIX_TYPE_ASM == type))
    {
      vec_del1 (igmp_group_prefixs, pos);
    }
}

static void
igmp_ssm_range_populate (void)
{
  igmp_group_prefix_t *ssm_default;

  vec_add2 (igmp_group_prefixs, ssm_default, 1);

  ssm_default->igp_prefix.fp_addr.ip4.as_u32 = IGMP_SSM_DEFAULT;
  ssm_default->igp_prefix.fp_proto = FIB_PROTOCOL_IP4;
  ssm_default->igp_prefix.fp_len = 8;
  ssm_default->igp_type = IGMP_GROUP_PREFIX_TYPE_SSM;
}

igmp_group_prefix_type_t
igmp_group_prefix_get_type (const ip46_address_t * gaddr)
{
  igmp_group_prefix_t *igp;

  vec_foreach (igp, igmp_group_prefixs)
  {
    if (ip4_destination_matches_route (&ip4_main,
				       &gaddr->ip4,
				       &igp->igp_prefix.fp_addr.ip4,
				       igp->igp_prefix.fp_len))
      return (IGMP_GROUP_PREFIX_TYPE_SSM);
  }

  return (IGMP_GROUP_PREFIX_TYPE_ASM);
}

void
igmp_ssm_range_walk (igmp_ssm_range_walk_t fn, void *ctx)
{
  igmp_group_prefix_t *igp;

  vec_foreach (igp, igmp_group_prefixs)
  {
    if (WALK_STOP == fn (&igp->igp_prefix, igp->igp_type, ctx))
      break;
  }
}

static clib_error_t *
igmp_ssm_range_show (vlib_main_t * vm,
		     unformat_input_t * input, vlib_cli_command_t * cmd)
{
  igmp_group_prefix_t *igp;

  vec_foreach (igp, igmp_group_prefixs)
  {
    vlib_cli_output (vm, "%U => %U",
		     format_fib_prefix, &igp->igp_prefix,
		     format_igmp_group_prefix_type, igp->igp_type);
  }
  return (NULL);
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (igmp_show_timers_command, static) = {
  .path = "show igmp ssm-ranges",
  .short_help = "show igmp ssm-ranges",
  .function = igmp_ssm_range_show,
};
/* *INDENT-ON* */

static clib_error_t *
igmp_ssm_range_init (vlib_main_t * vm)
{
  igmp_ssm_range_populate ();

  IGMP_DBG ("ssm-range-initialized");

  return (0);
}

/* *INDENT-OFF* */
VLIB_INIT_FUNCTION (igmp_ssm_range_init) =
{
  .runs_after = VLIB_INITS("igmp_init"),
};
/* *INDENT-ON* */

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