summaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam/analyse
AgeCommit message (Expand)AuthorFilesLines
2019-05-16init / exit function orderingDave Barach1-6/+6
2018-10-23c11 safe string handling supportDave Barach1-2/+2
2018-10-19vppinfra: add atomic macros for __sync builtinsSirshak Das3-23/+25
2018-05-13Improve ipfix template packet rewrite constructionDave Barach2-2/+6
2018-05-04Flow: Rename IPFIX exporter.Ole Troan1-1/+1
2018-05-04Harmonize vec/pool_get_aligned object sizes and alignment requestsDave Barach1-0/+2
2018-04-12Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify'Neale Ranns1-2/+2
2017-05-30Flowprobe: Stateful flows and IPv6, L4 recordingOle Troan1-1/+2
2017-03-22Initial draft of VPP changes to cleanup iOAM export.Vengada1-0/+1
2017-03-15VPP changes to support iOAM over NSH-MD2. Separate trace dataVengada1-0/+1
2017-03-14IOAM Coverity fixAkshayaNadahalli2-3/+8
2017-03-07In-band OAM active probe (VPP-471)AkshayaNadahalli3-6/+115
2017-03-06ioam: manycast using iOAM and SR (VPP-628)Shwetha Bhandari2-5/+77
2017-02-14Fix coverity issues: ioamShwetha Bhandari2-3/+9
2017-02-13VPP-632 : InBand OAM AnalyserAkshayaNadahalli6-0/+1674
light .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) 2016 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 <vnet/fib/fib_entry_cover.h>
#include <vnet/fib/fib_entry_src.h>
#include <vnet/fib/fib_node_list.h>
#include <vnet/fib/fib_entry_delegate.h>

u32
fib_entry_cover_track (fib_entry_t* cover,
		       fib_node_index_t covered)
{
    fib_entry_delegate_t *fed;

    FIB_ENTRY_DBG(cover, "cover-track %d", covered);

    ASSERT(fib_entry_get_index(cover) != covered);

    fed = fib_entry_delegate_find(cover, FIB_ENTRY_DELEGATE_COVERED);

    if (NULL == fed)
    {
        fed = fib_entry_delegate_find_or_add(cover, FIB_ENTRY_DELEGATE_COVERED);
        fed->fd_list = fib_node_list_create();
    }

    return (fib_node_list_push_front(fed->fd_list,
                                     0, FIB_NODE_TYPE_ENTRY,
                                     covered));
}

void
fib_entry_cover_untrack (fib_entry_t* cover,
			 u32 tracked_index)
{
    fib_entry_delegate_t *fed;

    FIB_ENTRY_DBG(cover, "cover-untrack @ %d", tracked_index);

    fed = fib_entry_delegate_find(cover, FIB_ENTRY_DELEGATE_COVERED);

    if (NULL == fed)
        return;

    fib_node_list_remove(fed->fd_list, tracked_index);

    if (0 == fib_node_list_get_size(fed->fd_list))
    {
        fib_node_list_destroy(&fed->fd_list);
        fib_entry_delegate_remove(cover, FIB_ENTRY_DELEGATE_COVERED);        
    }
}

/**
 * Internal struct to hold user supplied parameters for the cover walk
 */
typedef struct fib_enty_cover_walk_ctx_t_ {
    fib_entry_t *cover;
    fib_entry_covered_walk_t walk;
    void *ctx;
} fib_enty_cover_walk_ctx_t;

static int
fib_entry_cover_walk_node_ptr (fib_node_ptr_t *depend,
			       void *args)
{
    fib_enty_cover_walk_ctx_t *ctx = args;

    ctx->walk(ctx->cover, depend->fnp_index, ctx->ctx);

    /* continue */
    return (1);
}

void
fib_entry_cover_walk (fib_entry_t *cover,
		      fib_entry_covered_walk_t walk,
		      void *args)
{
    fib_entry_delegate_t *fed;

    fed = fib_entry_delegate_find(cover, FIB_ENTRY_DELEGATE_COVERED);

    if (NULL == fed)
        return;

    fib_enty_cover_walk_ctx_t ctx = {
        .cover = cover,
        .walk = walk,
        .ctx = args,
    };

    fib_node_list_walk(fed->fd_list,
                       fib_entry_cover_walk_node_ptr,
                       &ctx);
}

static int
fib_entry_cover_change_one (fib_entry_t *cover,
			    fib_node_index_t covered,
			    void *args)
{
    fib_node_index_t new_cover;

    /*
     * The 3 entries involved here are:
     *   cover - the least specific. It will cover both the others
     *  new_cover - the enty just inserted below the cover
     *  covered - the entry that was tracking the cover.
     *
     * The checks below are to determine if new_cover is a cover for covered.
     */
    new_cover = pointer_to_uword(args);

    if (FIB_NODE_INDEX_INVALID == new_cover)
    {
	/*
	 * nothing has been inserted, which implies the cover was removed.
	 * 'cover' is thus the new cover.
	 */
	fib_entry_cover_changed(covered);
    }
    else if (new_cover != covered)
    {
	const fib_prefix_t *pfx_covered, *pfx_new_cover;

	pfx_covered = fib_entry_get_prefix(covered);
	pfx_new_cover = fib_entry_get_prefix(new_cover);

	if (fib_prefix_is_cover(pfx_new_cover, pfx_covered))
	{
	    fib_entry_cover_changed(covered);
	}
    }
    /* continue */
    return (1);
}

void
fib_entry_cover_change_notify (fib_node_index_t cover_index,
			       fib_node_index_t covered)
{
    fib_entry_t *cover;

    cover = fib_entry_get(cover_index);

    fib_entry_cover_walk(cover, 
			 fib_entry_cover_change_one,
			 uword_to_pointer(covered, void*));
}

static int
fib_entry_cover_update_one (fib_entry_t *cover,
			    fib_node_index_t covered,
			    void *args)
{
    fib_entry_cover_updated(covered);

    /* continue */
    return (1);
}

void
fib_entry_cover_update_notify (fib_entry_t *fib_entry)
{
    fib_entry_cover_walk(fib_entry, 
			 fib_entry_cover_update_one,
			 NULL);
}