summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_lookup.c
AgeCommit message (Expand)AuthorFilesLines
2020-04-23session: fix session_table_get_or_allocAndreas Schultz1-8/+11
2020-04-06session udp: shared local endpointsFlorin Coras1-0/+13
2020-02-26tls session: fix unlistenFlorin Coras1-0/+26
2020-01-02session: fix listener global endpoint lookupFlorin Coras1-1/+1
2019-12-27tcp: Enable TCP timewait port useYu Ping1-4/+4
2019-09-25session: validate connection in session lookup delFlorin Coras1-1/+1
2019-08-30session : make sure session layer is enabled when cli operate the sessions.Guanghua Zhang1-0/+4
2019-07-08session: add flag to disable session lookupNathan Skrzypczak1-0/+2
2019-03-13session rule cli add udp session failzhanglimao1-0/+1
2019-03-11session: fix ct that match global table entriesFlorin Coras1-0/+21
2019-03-01session: refactor local connectsFlorin Coras1-3/+3
2019-02-11session: cleanup application interfaceFlorin Coras1-18/+17
2019-02-06transport: cleanupFlorin Coras1-31/+24
2019-02-04session: cleanup part 1Florin Coras1-20/+20
2019-01-12session: generate wrong thread errors instead of crashingFlorin Coras1-10/+24
2018-11-18vcl/session: apps with process workersFlorin Coras1-2/+2
2018-10-23c11 safe string handling supportDave Barach1-9/+9
2018-08-24session: add support for multiple app workersFlorin Coras1-6/+10
2018-07-27vcl: use events for epoll/select/read/writeFlorin Coras1-2/+3
2018-06-22session: improve session lookup speedsFlorin Coras1-57/+24
2018-04-16session: use generic session pool for listenersFlorin Coras1-10/+6
2018-03-01session: zero out ips in local endpoint lookup only if localFlorin Coras1-29/+61
2018-02-14session: support local sessions and deprecate redirectsFlorin Coras1-52/+24
2017-12-22tcp: add builtin server/client transfer testFlorin Coras1-0/+1
2017-12-11session: generalize handling of network transportsFlorin Coras1-57/+49
2017-11-20session/tcp: filtering improvementsFlorin Coras1-70/+82
2017-11-10session: use listener logic for proxy rulesFlorin Coras1-1/+65
2017-11-09session: lookup/rules table improvements and cleanupFlorin Coras1-155/+250
2017-11-07session: fix v6 double bindsFlorin Coras1-4/+4
2017-11-06session: add rule tagsFlorin Coras1-60/+98
2017-11-05session: add api to dump rulesFlorin Coras1-9/+38
2017-11-03session: support drop action in rules tableFlorin Coras1-28/+38
2017-11-01session: add support for proxying appsFlorin Coras1-11/+29
2017-10-28session: rules tablesFlorin Coras1-8/+362
2017-10-16udp: refactor udp codeFlorin Coras1-29/+67
2017-10-10session: add support for application namespacingFlorin Coras1-226/+633
2017-09-18Fixes for issues Coverity has reported (VPP-972)Chris Luke1-4/+4
2017-08-16tcp: fix v6 sessionsroot1-4/+4
2017-08-02Fix tcp tx buffer allocationFlorin Coras1-9/+31
2017-07-30Make tcp active open data structures thread safeFlorin Coras1-63/+40
2017-07-25Cleanup/refactor session layer codeFlorin Coras1-0/+620
PE_2R3C_RFC_MEF5CF1 = 4 TYPE_MAX = 5 class PolicerAction(IntEnum): """Policer action.""" DROP = 0 TRANSMIT = 1 MARK_AND_TRANSMIT = 2 class PolicerPreColor(IntEnum): """Policer Pre-color.""" CONFORM_COLOR = 0 EXCEED_COLOR = 1 VIOLATE_COLOR = 2 class DSCP(IntEnum): """DSCP for mark-and-transmit action.""" D_CS0 = 0 D_CS1 = 8 D_CS2 = 16 D_CS3 = 24 D_CS4 = 32 D_vCS5 = 40 D_CS6 = 48 D_CS7 = 56 D_AF11 = 10 D_AF12 = 12 D_AF13 = 14 D_AF21 = 18 D_AF22 = 20 D_AF23 = 22 D_AF31 = 26 D_AF32 = 28 D_AF33 = 30 D_EF = 46 class Policer: """Policer utilities.""" # TODO: Pylint says too-many-arguments and too-many-locals. # It is right, we should refactor the code # and group similar arguments together (into documented classes). # Note that even the call from Robot Framework # is not very readable with this many arguments. @staticmethod def policer_set_configuration( node, policer_name, cir, eir, cbs, ebs, rate_type, round_type, policer_type, conform_action_type, exceed_action_type, violate_action_type, color_aware, is_add=True, conform_dscp=None, exceed_dscp=None, violate_dscp=None): """Configure policer on VPP node. :param node: VPP node. :param policer_name: Name of the policer. :param cir: Committed information rate. :param eir: Excess (or Peak) information rate. :param cbs: Committed burst size. :param ebs: Excess (or Peak) burst size. :param rate_type: Rate type. :param round_type: Round type. :param policer_type: Policer algorithm. :param conform_action_type: Conform action type. :param exceed_action_type: Exceed action type. :param violate_action_type: Violate action type. :param color_aware: Color-blind (cb) or color-aware (ca). :param is_add: Add policer if True, else delete. :param conform_dscp: DSCP for conform mark_and_transmit action. :param exceed_dscp: DSCP for exceed mark_and_transmit action. :param violate_dscp: DSCP for vilate mark_and_transmit action. :type node: dict :type policer_name: str :type cir: int :type eir: int :type cbs: int :type ebs: int :type rate_type: str :type round_type: str :type policer_type: str :type conform_action_type: str :type exceed_action_type: str :type violate_action_type: str :type color_aware: str :type is_add: bool :type conform_dscp: str :type exceed_dscp: str :type violate_dscp: str """ conform_action = dict( type=getattr(PolicerAction, conform_action_type.upper()).value, dscp=Policer.get_dscp_num_value(conform_dscp) if conform_action_type.upper() == PolicerAction.MARK_AND_TRANSMIT.name else 0 ) exceed_action = dict( type=getattr(PolicerAction, exceed_action_type.upper()).value, dscp=Policer.get_dscp_num_value(exceed_dscp) if exceed_action_type.upper() == PolicerAction.MARK_AND_TRANSMIT.name else 0 ) violate_action = dict( type=getattr(PolicerAction, violate_action_type.upper()).value, dscp=Policer.get_dscp_num_value(violate_dscp) if violate_action_type.upper() == PolicerAction.MARK_AND_TRANSMIT.name else 0 ) cmd = u"policer_add_del" args = dict( is_add=is_add, name=str(policer_name), cir=int(cir), eir=int(eir), cb=int(cbs), eb=int(ebs), rate_type=getattr(PolicerRateType, rate_type.upper()).value, round_type=getattr( PolicerRoundType, f"ROUND_TO_{round_type.upper()}" ).value, type=getattr(PolicerType, f"TYPE_{policer_type.upper()}").value, conform_action=conform_action, exceed_action=exceed_action, violate_action=violate_action, color_aware=bool(color_aware == u"'ca'") ) err_msg = f"Failed to configure policer {policer_name} " \ f"on host {node['host']}" with PapiSocketExecutor(node) as papi_exec: reply = papi_exec.add(cmd, **args).get_reply(err_msg) return reply[u"policer_index"] @staticmethod def policer_classify_set_interface( node, interface, ip4_table_index=Constants.BITWISE_NON_ZERO, ip6_table_index=Constants.BITWISE_NON_ZERO, l2_table_index=Constants.BITWISE_NON_ZERO, is_add=True): """Set/unset policer classify interface. :param node: VPP node. :param interface: Interface name or sw_if_index to set/unset policer classify. :param ip4_table_index: IP4 classify table index (~0 to skip). (Default value = ~0) :param ip6_table_index: IP6 classify table index (~0 to skip). (Default value = ~0) :param l2_table_index: L2 classify table index (~0 to skip). (Default value = ~0) :param is_add: Set if True, else unset. :type node: dict :type interface: str or int :type ip4_table_index: int :type ip6_table_index: int :type l2_table_index: int :type is_add: bool """ if isinstance(interface, str): sw_if_index = Topology.get_interface_sw_index(node, interface) else: sw_if_index = interface cmd = u"policer_classify_set_interface" args = dict( is_add=is_add, sw_if_index=int(sw_if_index), ip4_table_index=int(ip4_table_index), ip6_table_index=int(ip6_table_index), l2_table_index=int(l2_table_index) ) err_msg = f"Failed to set/unset policer classify interface " \ f"{interface} on host {node[u'host']}" with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod def policer_classify_get_precolor(precolor): """Return policer pre-color numeric value. :param precolor: Policer pre-color name. :type precolor: str :returns: Policer pre-color numeric value. :rtype: int """ return getattr(PolicerPreColor, precolor.upper()).value @staticmethod def get_dscp_num_value(dscp): """Return DSCP numeric value. :param dscp: DSCP name. :type dscp: str :returns: DSCP numeric value. :rtype: int """ return getattr(DSCP, f"D_{dscp.upper()}").value