Compare commits
16 Commits
master
...
stable/230
Author | SHA1 | Date | |
---|---|---|---|
|
be61e28b65 | ||
|
493b8990d1 | ||
|
aa41d25aa1 | ||
|
5e6bc730ef | ||
|
c4d0f47fae | ||
|
a175d8d8f7 | ||
|
8a5a6c51ee | ||
|
fcbf306cf3 | ||
|
16912d23ab | ||
|
f7687220e0 | ||
|
63e76fad7e | ||
|
1a67c82c84 | ||
|
95f9567098 | ||
|
b4b65194e3 | ||
|
fc38603c01 | ||
|
b60a6477eb |
@ -2,3 +2,4 @@
|
||||
host=gerrit.fd.io
|
||||
port=29418
|
||||
project=vpp
|
||||
defaultbranch=stable/2306
|
||||
|
@ -6,6 +6,7 @@ Release notes
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
v23.06
|
||||
v23.02
|
||||
v22.10.1
|
||||
v22.10
|
||||
|
619
docs/aboutvpp/releasenotes/v23.06.rst
Normal file
619
docs/aboutvpp/releasenotes/v23.06.rst
Normal file
File diff suppressed because it is too large
Load Diff
@ -780,7 +780,7 @@ error:
|
||||
}
|
||||
|
||||
static int
|
||||
bypass_all (bool add, uint32_t spd_id, uint32_t sa_id)
|
||||
bypass_all (bool add, uint32_t spd_id, uint32_t sa_id, uint32_t priority)
|
||||
{
|
||||
vl_api_ipsec_spd_entry_add_del_t *mp;
|
||||
vl_api_ipsec_spd_entry_add_del_reply_t *rmp;
|
||||
@ -800,7 +800,7 @@ bypass_all (bool add, uint32_t spd_id, uint32_t sa_id)
|
||||
mp->is_add = add;
|
||||
mp->entry.sa_id = ntohl (sa_id);
|
||||
mp->entry.spd_id = ntohl (spd_id);
|
||||
mp->entry.priority = ntohl (INT_MAX - POLICY_PRIORITY_PASS - 1);
|
||||
mp->entry.priority = ntohl (priority - POLICY_PRIORITY_PASS);
|
||||
mp->entry.is_outbound = 0;
|
||||
mp->entry.policy = ntohl (IPSEC_API_SPD_ACTION_BYPASS);
|
||||
memset (mp->entry.local_address_stop.un.ip6, 0xFF, 16);
|
||||
@ -890,7 +890,8 @@ error:
|
||||
}
|
||||
|
||||
static int
|
||||
bypass_port (bool add, uint32_t spd_id, uint32_t sa_id, uint16_t port)
|
||||
bypass_port (bool add, uint32_t spd_id, uint32_t sa_id, uint16_t port,
|
||||
uint32_t priority)
|
||||
{
|
||||
vl_api_ipsec_spd_entry_add_del_t *mp;
|
||||
vl_api_ipsec_spd_entry_add_del_reply_t *rmp;
|
||||
@ -907,14 +908,14 @@ bypass_port (bool add, uint32_t spd_id, uint32_t sa_id, uint16_t port)
|
||||
mp->is_add = add;
|
||||
mp->entry.sa_id = ntohl (sa_id);
|
||||
mp->entry.spd_id = ntohl (spd_id);
|
||||
mp->entry.priority = ntohl (INT_MAX - POLICY_PRIORITY_PASS - 1);
|
||||
mp->entry.priority = ntohl (priority - POLICY_PRIORITY_PASS);
|
||||
mp->entry.policy = ntohl (IPSEC_API_SPD_ACTION_BYPASS);
|
||||
memset (mp->entry.local_address_stop.un.ip6, 0xFF, 16);
|
||||
memset (mp->entry.remote_address_stop.un.ip6, 0xFF, 16);
|
||||
mp->entry.is_outbound = 0;
|
||||
mp->entry.remote_port_start = mp->entry.local_port_start = ntohs (0);
|
||||
mp->entry.remote_port_stop = mp->entry.local_port_stop = ntohs (0xFFFF);
|
||||
mp->entry.protocol = IP_API_PROTO_HOPOPT;
|
||||
mp->entry.remote_port_start = mp->entry.local_port_start = ntohs (port);
|
||||
mp->entry.remote_port_stop = mp->entry.local_port_stop = ntohs (port);
|
||||
mp->entry.protocol = IP_API_PROTO_UDP;
|
||||
|
||||
if (vac->send (vac, (char *) mp, sizeof (*mp), &out, &out_len))
|
||||
{
|
||||
@ -961,19 +962,19 @@ error:
|
||||
* Add or remove a bypass policy
|
||||
*/
|
||||
static status_t
|
||||
manage_bypass (bool add, uint32_t spd_id, uint32_t sa_id)
|
||||
manage_bypass (bool add, uint32_t spd_id, uint32_t sa_id, uint32_t priority)
|
||||
{
|
||||
uint16_t port;
|
||||
status_t rv;
|
||||
|
||||
bypass_all (add, spd_id, sa_id);
|
||||
bypass_all (add, spd_id, sa_id, priority);
|
||||
|
||||
port =
|
||||
lib->settings->get_int (lib->settings, "%s.port", IKEV2_UDP_PORT, lib->ns);
|
||||
|
||||
if (port)
|
||||
{
|
||||
rv = bypass_port (add, spd_id, sa_id, port);
|
||||
rv = bypass_port (add, spd_id, sa_id, port, priority);
|
||||
if (rv != SUCCESS)
|
||||
{
|
||||
return rv;
|
||||
@ -984,7 +985,7 @@ manage_bypass (bool add, uint32_t spd_id, uint32_t sa_id)
|
||||
IKEV2_NATT_PORT, lib->ns);
|
||||
if (port)
|
||||
{
|
||||
rv = bypass_port (add, spd_id, sa_id, port);
|
||||
rv = bypass_port (add, spd_id, sa_id, port, priority);
|
||||
if (rv != SUCCESS)
|
||||
{
|
||||
return rv;
|
||||
@ -1012,7 +1013,7 @@ manage_policy (private_kernel_vpp_ipsec_t *this, bool add,
|
||||
host_t *src = NULL, *dst = NULL, *addr = NULL;
|
||||
vl_api_ipsec_spd_entry_add_del_t *mp = NULL;
|
||||
vl_api_ipsec_spd_entry_add_del_reply_t *rmp = NULL;
|
||||
bool n_spd = false;
|
||||
bool n_spd = false; /* is a new SPD? */
|
||||
vl_api_ipsec_spd_dump_t *mp_dump = NULL;
|
||||
vl_api_ipsec_spd_details_t *rmp_dump = NULL, *tmp = NULL;
|
||||
|
||||
@ -1092,7 +1093,7 @@ manage_policy (private_kernel_vpp_ipsec_t *this, bool add,
|
||||
mp->_vl_msg_id = htons (msg_id);
|
||||
mp->is_add = add;
|
||||
mp->entry.spd_id = htonl (spd->spd_id);
|
||||
mp->entry.priority = htonl (INT_MAX - POLICY_PRIORITY_PASS);
|
||||
mp->entry.priority = htonl (priority - POLICY_PRIORITY_DEFAULT);
|
||||
mp->entry.is_outbound = id->dir == POLICY_OUT;
|
||||
switch (data->type)
|
||||
{
|
||||
@ -1124,7 +1125,7 @@ manage_policy (private_kernel_vpp_ipsec_t *this, bool add,
|
||||
sad_id = sa->sa_id;
|
||||
if (n_spd)
|
||||
{
|
||||
if (manage_bypass (TRUE, spd_id, ~0))
|
||||
if (manage_bypass (TRUE, spd_id, ~0, priority))
|
||||
{
|
||||
DBG1 (DBG_KNL, "manage_bypass %d failed!!!!", spd_id);
|
||||
goto error;
|
||||
@ -1263,7 +1264,7 @@ next:
|
||||
"policy_num's ref is 0, delete spd_id %d sw_if_index %d sad_id %x",
|
||||
spd->spd_id, spd->sw_if_index, sad_id);
|
||||
interface_add_del_spd (FALSE, spd->spd_id, spd->sw_if_index);
|
||||
manage_bypass (FALSE, spd->spd_id, sad_id);
|
||||
manage_bypass (FALSE, spd->spd_id, sad_id, priority);
|
||||
spd_add_del (FALSE, spd->spd_id);
|
||||
this->spds->remove (this->spds, interface);
|
||||
if (spd->if_name)
|
||||
|
@ -205,7 +205,10 @@ nl_route_del (struct rtnl_route *rr, void *arg)
|
||||
static void
|
||||
nl_route_add (struct rtnl_route *rr, void *arg)
|
||||
{
|
||||
FOREACH_VFT (nvl_rt_route_add, rr);
|
||||
nl_msg_info_t *msg_info = (nl_msg_info_t *) arg;
|
||||
struct nlmsghdr *nlh = nlmsg_hdr (msg_info->msg);
|
||||
|
||||
FOREACH_VFT_CTX (nvl_rt_route_add, rr, (nlh->nlmsg_flags & NLM_F_REPLACE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -26,7 +26,8 @@ typedef void (*nl_rt_addr_cb_t) (struct rtnl_addr *ra);
|
||||
typedef void (*nl_rt_addr_sync_cb_t) (void);
|
||||
typedef void (*nl_rt_neigh_cb_t) (struct rtnl_neigh *rr);
|
||||
typedef void (*nl_rt_neigh_sync_cb_t) (void);
|
||||
typedef void (*nl_rt_route_cb_t) (struct rtnl_route *rn);
|
||||
typedef void (*nl_rt_route_add_cb_t) (struct rtnl_route *rn, int is_replace);
|
||||
typedef void (*nl_rt_route_del_cb_t) (struct rtnl_route *rn);
|
||||
typedef void (*nl_rt_route_sync_cb_t) (void);
|
||||
|
||||
#define NL_RT_COMMON uword is_mp_safe
|
||||
@ -73,12 +74,19 @@ typedef struct nl_rt_neigh_sync_t_
|
||||
nl_rt_neigh_sync_cb_t cb;
|
||||
} nl_rt_neigh_sync_t;
|
||||
|
||||
typedef struct nl_rt_route_t_
|
||||
typedef struct nl_rt_route_add_t_
|
||||
{
|
||||
NL_RT_COMMON;
|
||||
|
||||
nl_rt_route_cb_t cb;
|
||||
} nl_rt_route_t;
|
||||
nl_rt_route_add_cb_t cb;
|
||||
} nl_rt_route_add_t;
|
||||
|
||||
typedef struct nl_rt_route_del_t_
|
||||
{
|
||||
NL_RT_COMMON;
|
||||
|
||||
nl_rt_route_del_cb_t cb;
|
||||
} nl_rt_route_del_t;
|
||||
|
||||
typedef struct nl_rt_route_sync_t_
|
||||
{
|
||||
@ -103,8 +111,8 @@ typedef struct nl_vft_t_
|
||||
nl_rt_neigh_t nvl_rt_neigh_del;
|
||||
nl_rt_neigh_sync_t nvl_rt_neigh_sync_begin;
|
||||
nl_rt_neigh_sync_t nvl_rt_neigh_sync_end;
|
||||
nl_rt_route_t nvl_rt_route_add;
|
||||
nl_rt_route_t nvl_rt_route_del;
|
||||
nl_rt_route_add_t nvl_rt_route_add;
|
||||
nl_rt_route_del_t nvl_rt_route_del;
|
||||
nl_rt_route_sync_t nvl_rt_route_sync_begin;
|
||||
nl_rt_route_sync_t nvl_rt_route_sync_end;
|
||||
} nl_vft_t;
|
||||
|
@ -1167,7 +1167,7 @@ lcp_router_route_del (struct rtnl_route *rr)
|
||||
}
|
||||
|
||||
static void
|
||||
lcp_router_route_add (struct rtnl_route *rr)
|
||||
lcp_router_route_add (struct rtnl_route *rr, int is_replace)
|
||||
{
|
||||
fib_entry_flag_t entry_flags;
|
||||
uint32_t table_id;
|
||||
@ -1196,71 +1196,71 @@ lcp_router_route_add (struct rtnl_route *rr)
|
||||
LCP_ROUTER_DBG ("route skip: %d:%U %U", rtnl_route_get_table (rr),
|
||||
format_fib_prefix, &pfx, format_fib_entry_flags,
|
||||
entry_flags);
|
||||
return;
|
||||
}
|
||||
LCP_ROUTER_DBG ("route %s: %d:%U %U", is_replace ? "replace" : "add",
|
||||
rtnl_route_get_table (rr), format_fib_prefix, &pfx,
|
||||
format_fib_entry_flags, entry_flags);
|
||||
|
||||
lcp_router_route_path_parse_t np = {
|
||||
.route_proto = pfx.fp_proto,
|
||||
.is_mcast = (rtype == RTN_MULTICAST),
|
||||
.type_flags = lcp_router_route_type_frpflags[rtype],
|
||||
.preference = (u8) rtnl_route_get_priority (rr),
|
||||
};
|
||||
|
||||
rtnl_route_foreach_nexthop (rr, lcp_router_route_path_parse, &np);
|
||||
lcp_router_route_path_add_special (rr, &np);
|
||||
|
||||
if (0 != vec_len (np.paths))
|
||||
{
|
||||
if (rtype == RTN_MULTICAST)
|
||||
{
|
||||
/* it's not clear to me how linux expresses the RPF paramters
|
||||
* so we'll allow from all interfaces and hope for the best */
|
||||
mfib_prefix_t mpfx = {};
|
||||
|
||||
lcp_router_route_mk_mprefix (rr, &mpfx);
|
||||
|
||||
mfib_table_entry_update (nlt->nlt_mfib_index, &mpfx,
|
||||
MFIB_SOURCE_PLUGIN_LOW, MFIB_RPF_ID_NONE,
|
||||
MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF);
|
||||
|
||||
mfib_table_entry_paths_update (nlt->nlt_mfib_index, &mpfx,
|
||||
MFIB_SOURCE_PLUGIN_LOW,
|
||||
MFIB_ENTRY_FLAG_NONE, np.paths);
|
||||
}
|
||||
else
|
||||
{
|
||||
fib_source_t fib_src;
|
||||
const fib_route_path_t *rpath;
|
||||
|
||||
vec_foreach (rpath, np.paths)
|
||||
{
|
||||
if (fib_route_path_is_attached (rpath))
|
||||
{
|
||||
entry_flags |= FIB_ENTRY_FLAG_ATTACHED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fib_src = lcp_router_proto_fib_source (rproto);
|
||||
|
||||
if (is_replace)
|
||||
fib_table_entry_update (nlt->nlt_fib_index, &pfx, fib_src,
|
||||
entry_flags, np.paths);
|
||||
else
|
||||
fib_table_entry_path_add2 (nlt->nlt_fib_index, &pfx, fib_src,
|
||||
entry_flags, np.paths);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LCP_ROUTER_DBG ("route add: %d:%U %U", rtnl_route_get_table (rr),
|
||||
format_fib_prefix, &pfx, format_fib_entry_flags,
|
||||
entry_flags);
|
||||
|
||||
lcp_router_route_path_parse_t np = {
|
||||
.route_proto = pfx.fp_proto,
|
||||
.is_mcast = (rtype == RTN_MULTICAST),
|
||||
.type_flags = lcp_router_route_type_frpflags[rtype],
|
||||
.preference = (u8) rtnl_route_get_priority (rr),
|
||||
};
|
||||
|
||||
rtnl_route_foreach_nexthop (rr, lcp_router_route_path_parse, &np);
|
||||
lcp_router_route_path_add_special (rr, &np);
|
||||
|
||||
if (0 != vec_len (np.paths))
|
||||
{
|
||||
if (rtype == RTN_MULTICAST)
|
||||
{
|
||||
/* it's not clear to me how linux expresses the RPF paramters
|
||||
* so we'll allow from all interfaces and hope for the best */
|
||||
mfib_prefix_t mpfx = {};
|
||||
|
||||
lcp_router_route_mk_mprefix (rr, &mpfx);
|
||||
|
||||
mfib_table_entry_update (
|
||||
nlt->nlt_mfib_index, &mpfx, MFIB_SOURCE_PLUGIN_LOW,
|
||||
MFIB_RPF_ID_NONE, MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF);
|
||||
|
||||
mfib_table_entry_paths_update (nlt->nlt_mfib_index, &mpfx,
|
||||
MFIB_SOURCE_PLUGIN_LOW,
|
||||
MFIB_ENTRY_FLAG_NONE, np.paths);
|
||||
}
|
||||
else
|
||||
{
|
||||
fib_source_t fib_src;
|
||||
const fib_route_path_t *rpath;
|
||||
|
||||
vec_foreach (rpath, np.paths)
|
||||
{
|
||||
if (fib_route_path_is_attached (rpath))
|
||||
{
|
||||
entry_flags |= FIB_ENTRY_FLAG_ATTACHED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fib_src = lcp_router_proto_fib_source (rproto);
|
||||
|
||||
if (pfx.fp_proto == FIB_PROTOCOL_IP6)
|
||||
fib_table_entry_path_add2 (nlt->nlt_fib_index, &pfx, fib_src,
|
||||
entry_flags, np.paths);
|
||||
else
|
||||
fib_table_entry_update (nlt->nlt_fib_index, &pfx, fib_src,
|
||||
entry_flags, np.paths);
|
||||
}
|
||||
}
|
||||
else
|
||||
LCP_ROUTER_DBG ("no paths for route add: %d:%U %U",
|
||||
rtnl_route_get_table (rr), format_fib_prefix, &pfx,
|
||||
format_fib_entry_flags, entry_flags);
|
||||
vec_free (np.paths);
|
||||
LCP_ROUTER_DBG ("no paths for route: %d:%U %U",
|
||||
rtnl_route_get_table (rr), format_fib_prefix, &pfx,
|
||||
format_fib_entry_flags, entry_flags);
|
||||
}
|
||||
vec_free (np.paths);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -759,7 +759,7 @@ svm_fifo_unset_event (svm_fifo_t * f)
|
||||
static inline void
|
||||
svm_fifo_add_want_deq_ntf (svm_fifo_t * f, u8 ntf_type)
|
||||
{
|
||||
f->shr->want_deq_ntf |= ntf_type;
|
||||
__atomic_or_fetch (&f->shr->want_deq_ntf, ntf_type, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -773,7 +773,21 @@ svm_fifo_add_want_deq_ntf (svm_fifo_t * f, u8 ntf_type)
|
||||
static inline void
|
||||
svm_fifo_del_want_deq_ntf (svm_fifo_t * f, u8 ntf_type)
|
||||
{
|
||||
f->shr->want_deq_ntf &= ~ntf_type;
|
||||
__atomic_and_fetch (&f->shr->want_deq_ntf, ~ntf_type, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get want notification flag
|
||||
*
|
||||
* Done atomically with acquire memory ordering
|
||||
*
|
||||
* @param f fifo
|
||||
* @return value of want_deq_ntf flag
|
||||
*/
|
||||
static inline u32
|
||||
svm_fifo_get_want_deq_ntf (svm_fifo_t *f)
|
||||
{
|
||||
return clib_atomic_load_acq_n (&f->shr->want_deq_ntf);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -790,10 +804,27 @@ svm_fifo_del_want_deq_ntf (svm_fifo_t * f, u8 ntf_type)
|
||||
static inline void
|
||||
svm_fifo_clear_deq_ntf (svm_fifo_t * f)
|
||||
{
|
||||
/* Set the flag if want_notif_if_full was the only ntf requested */
|
||||
f->shr->has_deq_ntf =
|
||||
f->shr->want_deq_ntf == SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL;
|
||||
svm_fifo_del_want_deq_ntf (f, SVM_FIFO_WANT_DEQ_NOTIF);
|
||||
u32 want_deq_ntf = svm_fifo_get_want_deq_ntf (f);
|
||||
/* Set the flag if want ntf if full or empty was requested */
|
||||
if (want_deq_ntf &
|
||||
(SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL | SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY))
|
||||
clib_atomic_store_rel_n (&f->shr->has_deq_ntf, 1);
|
||||
if (want_deq_ntf & SVM_FIFO_WANT_DEQ_NOTIF)
|
||||
svm_fifo_del_want_deq_ntf (f, SVM_FIFO_WANT_DEQ_NOTIF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get has dequeue notification flag
|
||||
*
|
||||
* Done atomically with acquire memory ordering
|
||||
*
|
||||
* @param f fifo
|
||||
* @return has_deq_ntf flag
|
||||
*/
|
||||
static inline u32
|
||||
svm_fifo_has_deq_ntf (svm_fifo_t *f)
|
||||
{
|
||||
return clib_atomic_load_acq_n (&f->shr->has_deq_ntf);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -824,9 +855,9 @@ svm_fifo_reset_has_deq_ntf (svm_fifo_t * f)
|
||||
static inline u8
|
||||
svm_fifo_needs_deq_ntf (svm_fifo_t * f, u32 n_last_deq)
|
||||
{
|
||||
u8 want_ntf = f->shr->want_deq_ntf;
|
||||
u32 want_ntf = svm_fifo_get_want_deq_ntf (f);
|
||||
|
||||
if (PREDICT_TRUE (want_ntf == SVM_FIFO_NO_DEQ_NOTIF))
|
||||
if (want_ntf == SVM_FIFO_NO_DEQ_NOTIF)
|
||||
return 0;
|
||||
else if (want_ntf & SVM_FIFO_WANT_DEQ_NOTIF)
|
||||
return (svm_fifo_max_enqueue (f) >= f->shr->deq_thresh);
|
||||
@ -834,13 +865,13 @@ svm_fifo_needs_deq_ntf (svm_fifo_t * f, u32 n_last_deq)
|
||||
{
|
||||
u32 max_deq = svm_fifo_max_dequeue_cons (f);
|
||||
u32 size = f->shr->size;
|
||||
if (!f->shr->has_deq_ntf && max_deq < size &&
|
||||
max_deq + n_last_deq >= size)
|
||||
if (max_deq < size && max_deq + n_last_deq >= size &&
|
||||
!svm_fifo_has_deq_ntf (f))
|
||||
return 1;
|
||||
}
|
||||
if (want_ntf & SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY)
|
||||
{
|
||||
if (!f->shr->has_deq_ntf && svm_fifo_is_empty (f))
|
||||
if (!svm_fifo_has_deq_ntf (f) && svm_fifo_is_empty (f))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -751,6 +751,17 @@ TOP_BOILERPLATE = """\
|
||||
#endif
|
||||
|
||||
#define VL_API_PACKED(x) x __attribute__ ((packed))
|
||||
|
||||
/*
|
||||
* Note: VL_API_MAX_ARRAY_SIZE is set to an arbitrarily large limit.
|
||||
*
|
||||
* However, any message with a ~2 billion element array is likely to break the
|
||||
* api handling long before this limit causes array element endian issues.
|
||||
*
|
||||
* Applications should be written to create reasonable api messages.
|
||||
*/
|
||||
#define VL_API_MAX_ARRAY_SIZE 0x7fffffff
|
||||
|
||||
"""
|
||||
|
||||
BOTTOM_BOILERPLATE = """\
|
||||
@ -1133,9 +1144,21 @@ ENDIAN_STRINGS = {
|
||||
}
|
||||
|
||||
|
||||
def get_endian_string(o, type):
|
||||
"""Return proper endian string conversion function"""
|
||||
try:
|
||||
if o.to_network:
|
||||
return ENDIAN_STRINGS[type].replace("net_to_host", "host_to_net")
|
||||
except:
|
||||
pass
|
||||
return ENDIAN_STRINGS[type]
|
||||
|
||||
|
||||
def endianfun_array(o):
|
||||
"""Generate endian functions for arrays"""
|
||||
forloop = """\
|
||||
{comment}
|
||||
ASSERT((u32){length} <= (u32)VL_API_MAX_ARRAY_SIZE);
|
||||
for (i = 0; i < {length}; i++) {{
|
||||
a->{name}[i] = {format}(a->{name}[i]);
|
||||
}}
|
||||
@ -1147,6 +1170,19 @@ def endianfun_array(o):
|
||||
}}
|
||||
"""
|
||||
|
||||
to_network_comment = ""
|
||||
try:
|
||||
if o.to_network:
|
||||
to_network_comment = """/*
|
||||
* Array fields processed first to handle variable length arrays and size
|
||||
* field endian conversion in the proper order for to-network messages.
|
||||
* Message fields have been sorted by type in the code generator, thus fields
|
||||
* in this generated code may be converted in a different order than specified
|
||||
* in the *.api file.
|
||||
*/"""
|
||||
except:
|
||||
pass
|
||||
|
||||
output = ""
|
||||
if o.fieldtype == "u8" or o.fieldtype == "string" or o.fieldtype == "bool":
|
||||
output += " /* a->{n} = a->{n} (no-op) */\n".format(n=o.fieldname)
|
||||
@ -1154,7 +1190,10 @@ def endianfun_array(o):
|
||||
lfield = "a->" + o.lengthfield if o.lengthfield else o.length
|
||||
if o.fieldtype in ENDIAN_STRINGS:
|
||||
output += forloop.format(
|
||||
length=lfield, format=ENDIAN_STRINGS[o.fieldtype], name=o.fieldname
|
||||
comment=to_network_comment,
|
||||
length=lfield,
|
||||
format=get_endian_string(o, o.fieldtype),
|
||||
name=o.fieldname,
|
||||
)
|
||||
else:
|
||||
output += forloop_format.format(
|
||||
@ -1181,7 +1220,7 @@ def endianfun_obj(o):
|
||||
return output
|
||||
if o.fieldtype in ENDIAN_STRINGS:
|
||||
output += " a->{name} = {format}(a->{name});\n".format(
|
||||
name=o.fieldname, format=ENDIAN_STRINGS[o.fieldtype]
|
||||
name=o.fieldname, format=get_endian_string(o, o.fieldtype)
|
||||
)
|
||||
elif o.fieldtype.startswith("vl_api_"):
|
||||
output += " {type}_endian(&a->{name});\n".format(
|
||||
@ -1203,10 +1242,13 @@ def endianfun(objs, modulename):
|
||||
#define included_{module}_endianfun
|
||||
|
||||
#undef clib_net_to_host_uword
|
||||
#undef clib_host_to_net_uword
|
||||
#ifdef LP64
|
||||
#define clib_net_to_host_uword clib_net_to_host_u64
|
||||
#define clib_host_to_net_uword clib_host_to_net_u64
|
||||
#else
|
||||
#define clib_net_to_host_uword clib_net_to_host_u32
|
||||
#define clib_host_to_net_uword clib_host_to_net_u32
|
||||
#endif
|
||||
|
||||
"""
|
||||
@ -1219,10 +1261,17 @@ static inline void vl_api_{name}_t_endian (vl_api_{name}_t *a)
|
||||
"""
|
||||
|
||||
for t in objs:
|
||||
# Outbound (to network) messages are identified by message nomenclature
|
||||
# i.e. message names ending with these suffixes are 'to network'
|
||||
if t.name.endswith("_reply") or t.name.endswith("_details"):
|
||||
t.to_network = True
|
||||
else:
|
||||
t.to_network = False
|
||||
|
||||
if t.__class__.__name__ == "Enum" or t.__class__.__name__ == "EnumFlag":
|
||||
output += signature.format(name=t.name)
|
||||
if t.enumtype in ENDIAN_STRINGS:
|
||||
output += " *a = {}(*a);\n".format(ENDIAN_STRINGS[t.enumtype])
|
||||
output += " *a = {}(*a);\n".format(get_endian_string(t, t.enumtype))
|
||||
else:
|
||||
output += " /* a->{name} = a->{name} (no-op) */\n".format(
|
||||
name=t.name
|
||||
@ -1242,7 +1291,9 @@ static inline void vl_api_{name}_t_endian (vl_api_{name}_t *a)
|
||||
name=t.name
|
||||
)
|
||||
elif t.alias["type"] in FORMAT_STRINGS:
|
||||
output += " *a = {}(*a);\n".format(ENDIAN_STRINGS[t.alias["type"]])
|
||||
output += " *a = {}(*a);\n".format(
|
||||
get_endian_string(t, t.alias["type"])
|
||||
)
|
||||
else:
|
||||
output += " /* Not Implemented yet {} */".format(t.name)
|
||||
output += "}\n\n"
|
||||
@ -1250,12 +1301,15 @@ static inline void vl_api_{name}_t_endian (vl_api_{name}_t *a)
|
||||
|
||||
output += signature.format(name=t.name)
|
||||
|
||||
# make Array type appear before the others:
|
||||
# some arrays have dynamic length, and we want to iterate over
|
||||
# them before changing endiann for the length field
|
||||
t.block.sort(key=lambda x: x.type)
|
||||
# For outbound (to network) messages:
|
||||
# some arrays have dynamic length -- iterate over
|
||||
# them before changing endianness for the length field
|
||||
# by making the Array types show up first
|
||||
if t.to_network:
|
||||
t.block.sort(key=lambda x: x.type)
|
||||
|
||||
for o in t.block:
|
||||
o.to_network = t.to_network
|
||||
output += endianfun_obj(o)
|
||||
output += "}\n\n"
|
||||
|
||||
@ -1322,7 +1376,7 @@ static inline uword vl_api_{name}_t_calc_size (vl_api_{name}_t *a)
|
||||
)
|
||||
lf = m[0]
|
||||
if lf.fieldtype in ENDIAN_STRINGS:
|
||||
output += f" + {ENDIAN_STRINGS[lf.fieldtype]}(a->{b.lengthfield}) * sizeof(a->{b.fieldname}[0])"
|
||||
output += f" + {get_endian_string(b, lf.fieldtype)}(a->{b.lengthfield}) * sizeof(a->{b.fieldname}[0])"
|
||||
elif lf.fieldtype == "u8":
|
||||
output += (
|
||||
f" + a->{b.lengthfield} * sizeof(a->{b.fieldname}[0])"
|
||||
|
@ -666,6 +666,22 @@ vcl_session_dgram_tx_evt (vcl_session_t *s, session_evt_type_t et)
|
||||
return (s->flags & VCL_SESSION_F_CONNECTED) ? et : SESSION_IO_EVT_TX_MAIN;
|
||||
}
|
||||
|
||||
static inline void
|
||||
vcl_session_add_want_deq_ntf (vcl_session_t *s, svm_fifo_deq_ntf_t evt)
|
||||
{
|
||||
svm_fifo_t *txf = vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo;
|
||||
if (txf)
|
||||
svm_fifo_add_want_deq_ntf (txf, evt);
|
||||
}
|
||||
|
||||
static inline void
|
||||
vcl_session_del_want_deq_ntf (vcl_session_t *s, svm_fifo_deq_ntf_t evt)
|
||||
{
|
||||
svm_fifo_t *txf = vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo;
|
||||
if (txf)
|
||||
svm_fifo_del_want_deq_ntf (txf, evt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helpers
|
||||
*/
|
||||
|
@ -2421,12 +2421,8 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
|
||||
clib_bitmap_set_no_check ((uword *) write_map, sid, 1);
|
||||
*bits_set += 1;
|
||||
s = vcl_session_get (wrk, sid);
|
||||
if (!s->tx_fifo)
|
||||
break;
|
||||
/* We didn't have a fifo when the event was added */
|
||||
svm_fifo_add_want_deq_ntf (
|
||||
(vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo),
|
||||
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
break;
|
||||
case SESSION_CTRL_EVT_DISCONNECTED:
|
||||
disconnected_msg = (session_disconnected_msg_t *) e->data;
|
||||
@ -2636,10 +2632,9 @@ vppcom_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
|
||||
clib_bitmap_set_no_check ((uword *) write_map, sid, 1);
|
||||
bits_set++;
|
||||
}
|
||||
else if (s->tx_fifo)
|
||||
else
|
||||
{
|
||||
svm_fifo_t *txf = vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo;
|
||||
svm_fifo_add_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF);
|
||||
vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2801,7 +2796,6 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
|
||||
int rv = VPPCOM_OK, add_evt = 0;
|
||||
vcl_session_t *vep_session;
|
||||
vcl_session_t *s;
|
||||
svm_fifo_t *txf;
|
||||
|
||||
if (vep_handle == session_handle)
|
||||
{
|
||||
@ -2874,16 +2868,22 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
|
||||
s->flags |= VCL_SESSION_F_IS_VEP_SESSION;
|
||||
vep_session->vep.next_sh = session_handle;
|
||||
|
||||
txf = vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo;
|
||||
if (txf && (event->events & EPOLLOUT))
|
||||
svm_fifo_add_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
|
||||
/* Generate EPOLLOUT if tx fifo not full */
|
||||
if ((event->events & EPOLLOUT) && (vcl_session_write_ready (s) > 0))
|
||||
if ((event->events & EPOLLOUT))
|
||||
{
|
||||
vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET,
|
||||
SESSION_IO_EVT_TX);
|
||||
add_evt = 1;
|
||||
int write_ready = vcl_session_write_ready (s);
|
||||
|
||||
vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
if (write_ready > 0)
|
||||
{
|
||||
/* Generate EPOLLOUT if tx fifo not full */
|
||||
vcl_epoll_ctl_add_unhandled_event (
|
||||
wrk, s, event->events & EPOLLET, SESSION_IO_EVT_TX);
|
||||
add_evt = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF);
|
||||
}
|
||||
}
|
||||
/* Generate EPOLLIN if rx fifo has data */
|
||||
if ((event->events & EPOLLIN) && (vcl_session_read_ready (s) > 0))
|
||||
@ -2929,22 +2929,23 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
|
||||
goto done;
|
||||
}
|
||||
|
||||
txf = vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo;
|
||||
if (txf)
|
||||
/* Generate EPOLLOUT if session write ready and event was not on */
|
||||
if ((event->events & EPOLLOUT) && !(s->vep.ev.events & EPOLLOUT))
|
||||
{
|
||||
if (event->events & EPOLLOUT)
|
||||
svm_fifo_add_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
else
|
||||
svm_fifo_del_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
}
|
||||
/* Fifo size load acq synchronized with update store rel */
|
||||
int write_ready = vcl_session_write_ready (s);
|
||||
|
||||
/* Generate EPOLLOUT if session write ready nd event was not on */
|
||||
if ((event->events & EPOLLOUT) && !(s->vep.ev.events & EPOLLOUT) &&
|
||||
(vcl_session_write_ready (s) > 0))
|
||||
{
|
||||
vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET,
|
||||
SESSION_IO_EVT_TX);
|
||||
vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
if (write_ready > 0)
|
||||
vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET,
|
||||
SESSION_IO_EVT_TX);
|
||||
else
|
||||
/* Request deq ntf in case dequeue happened while updating flag */
|
||||
vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF);
|
||||
}
|
||||
else if (!(event->events & EPOLLOUT))
|
||||
vcl_session_del_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
|
||||
/* Generate EPOLLIN if session read ready and event was not on */
|
||||
if ((event->events & EPOLLIN) && !(s->vep.ev.events & EPOLLIN) &&
|
||||
(vcl_session_read_ready (s) > 0))
|
||||
@ -3014,11 +3015,7 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
|
||||
s->flags &= ~VCL_SESSION_F_IS_VEP_SESSION;
|
||||
|
||||
if (vcl_session_is_open (s))
|
||||
{
|
||||
txf = vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo;
|
||||
if (txf)
|
||||
svm_fifo_del_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
}
|
||||
vcl_session_del_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
|
||||
VDBG (1, "EPOLL_CTL_DEL: vep_idx %u, sh %u!", vep_handle,
|
||||
session_handle);
|
||||
@ -3073,7 +3070,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
|
||||
svm_fifo_reset_has_deq_ntf (vcl_session_is_ct (s) ? s->ct_tx_fifo :
|
||||
s->tx_fifo);
|
||||
session_events = s->vep.ev.events;
|
||||
if (!(EPOLLOUT & session_events))
|
||||
if (!(EPOLLOUT & session_events) ||
|
||||
(s->vep.lt_next != VCL_INVALID_SESSION_INDEX))
|
||||
break;
|
||||
add_event = 1;
|
||||
events[*num_ev].events = EPOLLOUT;
|
||||
@ -3108,12 +3106,10 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
|
||||
break;
|
||||
session_events = s->vep.ev.events;
|
||||
/* Generate EPOLLOUT because there's no connected event */
|
||||
if (!(EPOLLOUT & session_events) || !s->tx_fifo)
|
||||
if (!(EPOLLOUT & session_events))
|
||||
break;
|
||||
/* We didn't have a fifo when the event was added */
|
||||
svm_fifo_add_want_deq_ntf (
|
||||
(vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo),
|
||||
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
|
||||
add_event = 1;
|
||||
events[*num_ev].events = EPOLLOUT;
|
||||
session_evt_data = s->vep.ev.data.u64;
|
||||
|
@ -378,6 +378,7 @@ fib_attached_export_purge (fib_entry_t *fib_entry)
|
||||
*/
|
||||
if (0 == --export->faee_locks)
|
||||
{
|
||||
vec_free (export->faee_importers);
|
||||
pool_put(fib_ae_export_pool, export);
|
||||
fib_entry_delegate_remove(export_entry,
|
||||
FIB_ENTRY_DELEGATE_ATTACHED_EXPORT);
|
||||
|
@ -1214,7 +1214,7 @@ out:
|
||||
static void
|
||||
send_interface_tx_placement_details (vnet_hw_if_tx_queue_t **all_queues,
|
||||
u32 index, vl_api_registration_t *rp,
|
||||
u32 native_context)
|
||||
u32 context)
|
||||
{
|
||||
vnet_main_t *vnm = vnet_get_main ();
|
||||
vl_api_sw_interface_tx_placement_details_t *rmp;
|
||||
@ -1223,7 +1223,6 @@ send_interface_tx_placement_details (vnet_hw_if_tx_queue_t **all_queues,
|
||||
uword *bitmap = q[0]->threads;
|
||||
u32 hw_if_index = q[0]->hw_if_index;
|
||||
vnet_hw_interface_t *hw_if = vnet_get_hw_interface (vnm, hw_if_index);
|
||||
u32 context = clib_host_to_net_u32 (native_context);
|
||||
|
||||
n_bits = clib_bitmap_count_set_bits (bitmap);
|
||||
u32 n = n_bits * sizeof (u32);
|
||||
|
@ -309,7 +309,7 @@ session_cleanup_half_open (session_handle_t ho_handle)
|
||||
else
|
||||
{
|
||||
/* Cleanup half-open session lookup table if need be */
|
||||
if (ho->session_state != SESSION_STATE_TRANSPORT_CLOSING)
|
||||
if (ho->session_state != SESSION_STATE_TRANSPORT_CLOSED)
|
||||
{
|
||||
transport_connection_t *tc;
|
||||
tc = transport_get_half_open (session_get_transport_proto (ho),
|
||||
@ -348,7 +348,7 @@ session_half_open_delete_notify (transport_connection_t *tc)
|
||||
session_t *ho = ho_session_get (tc->s_index);
|
||||
|
||||
/* Cleanup half-open lookup table if need be */
|
||||
if (ho->session_state != SESSION_STATE_TRANSPORT_CLOSING)
|
||||
if (ho->session_state != SESSION_STATE_TRANSPORT_CLOSED)
|
||||
{
|
||||
if (!(tc->flags & TRANSPORT_CONNECTION_F_NO_LOOKUP))
|
||||
session_lookup_del_half_open (tc);
|
||||
@ -911,7 +911,7 @@ session_stream_connect_notify (transport_connection_t * tc,
|
||||
session_lookup_del_half_open (tc);
|
||||
|
||||
ho = ho_session_get (tc->s_index);
|
||||
session_set_state (ho, SESSION_STATE_TRANSPORT_CLOSING);
|
||||
session_set_state (ho, SESSION_STATE_TRANSPORT_CLOSED);
|
||||
opaque = ho->opaque;
|
||||
app_wrk = app_worker_get_if_valid (ho->app_wrk_index);
|
||||
if (!app_wrk)
|
||||
@ -1524,7 +1524,14 @@ session_stop_listen (session_t * s)
|
||||
return SESSION_E_NONE;
|
||||
|
||||
if (!(tc->flags & TRANSPORT_CONNECTION_F_NO_LOOKUP))
|
||||
session_lookup_del_connection (tc);
|
||||
{
|
||||
if (transport_connection_is_cless (tc))
|
||||
{
|
||||
clib_memset (&tc->rmt_ip, 0, sizeof (tc->rmt_ip));
|
||||
tc->rmt_port = 0;
|
||||
}
|
||||
session_lookup_del_connection (tc);
|
||||
}
|
||||
|
||||
transport_stop_listen (tp, s->connection_index);
|
||||
return 0;
|
||||
|
@ -267,6 +267,8 @@ extern vlib_node_registration_t tcp4_listen_node;
|
||||
extern vlib_node_registration_t tcp6_listen_node;
|
||||
extern vlib_node_registration_t tcp4_input_nolookup_node;
|
||||
extern vlib_node_registration_t tcp6_input_nolookup_node;
|
||||
extern vlib_node_registration_t tcp4_drop_node;
|
||||
extern vlib_node_registration_t tcp6_drop_node;
|
||||
|
||||
#define tcp_cfg tcp_main.cfg
|
||||
#define tcp_node_index(node_id, is_ip4) \
|
||||
|
@ -27,54 +27,6 @@ static vlib_error_desc_t tcp_input_error_counters[] = {
|
||||
#undef tcp_error
|
||||
};
|
||||
|
||||
/* All TCP nodes have the same outgoing arcs */
|
||||
#define foreach_tcp_state_next \
|
||||
_ (DROP4, "ip4-drop") \
|
||||
_ (DROP6, "ip6-drop") \
|
||||
_ (TCP4_OUTPUT, "tcp4-output") \
|
||||
_ (TCP6_OUTPUT, "tcp6-output")
|
||||
|
||||
typedef enum _tcp_established_next
|
||||
{
|
||||
#define _(s,n) TCP_ESTABLISHED_NEXT_##s,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
TCP_ESTABLISHED_N_NEXT,
|
||||
} tcp_established_next_t;
|
||||
|
||||
typedef enum _tcp_rcv_process_next
|
||||
{
|
||||
#define _(s,n) TCP_RCV_PROCESS_NEXT_##s,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
TCP_RCV_PROCESS_N_NEXT,
|
||||
} tcp_rcv_process_next_t;
|
||||
|
||||
typedef enum _tcp_syn_sent_next
|
||||
{
|
||||
#define _(s,n) TCP_SYN_SENT_NEXT_##s,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
TCP_SYN_SENT_N_NEXT,
|
||||
} tcp_syn_sent_next_t;
|
||||
|
||||
typedef enum _tcp_listen_next
|
||||
{
|
||||
#define _(s,n) TCP_LISTEN_NEXT_##s,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
TCP_LISTEN_N_NEXT,
|
||||
} tcp_listen_next_t;
|
||||
|
||||
/* Generic, state independent indices */
|
||||
typedef enum _tcp_state_next
|
||||
{
|
||||
#define _(s,n) TCP_NEXT_##s,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
TCP_STATE_N_NEXT,
|
||||
} tcp_state_next_t;
|
||||
|
||||
typedef enum _tcp_input_next
|
||||
{
|
||||
TCP_INPUT_NEXT_DROP,
|
||||
@ -87,12 +39,6 @@ typedef enum _tcp_input_next
|
||||
TCP_INPUT_N_NEXT
|
||||
} tcp_input_next_t;
|
||||
|
||||
#define tcp_next_output(is_ip4) (is_ip4 ? TCP_NEXT_TCP4_OUTPUT \
|
||||
: TCP_NEXT_TCP6_OUTPUT)
|
||||
|
||||
#define tcp_next_drop(is_ip4) (is_ip4 ? TCP_NEXT_DROP4 \
|
||||
: TCP_NEXT_DROP6)
|
||||
|
||||
/**
|
||||
* Validate segment sequence number. As per RFC793:
|
||||
*
|
||||
@ -1542,39 +1488,23 @@ VLIB_NODE_FN (tcp6_established_node) (vlib_main_t * vm,
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (tcp4_established_node) =
|
||||
{
|
||||
VLIB_REGISTER_NODE (tcp4_established_node) = {
|
||||
.name = "tcp4-established",
|
||||
/* Takes a vector of packets. */
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_ESTABLISHED_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_ESTABLISHED_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (tcp6_established_node) =
|
||||
{
|
||||
VLIB_REGISTER_NODE (tcp6_established_node) = {
|
||||
.name = "tcp6-established",
|
||||
/* Takes a vector of packets. */
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_ESTABLISHED_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_ESTABLISHED_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
@ -2082,13 +2012,6 @@ VLIB_REGISTER_NODE (tcp4_syn_sent_node) =
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_SYN_SENT_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_SYN_SENT_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
@ -2101,13 +2024,6 @@ VLIB_REGISTER_NODE (tcp6_syn_sent_node) =
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_SYN_SENT_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_SYN_SENT_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
@ -2540,39 +2456,23 @@ VLIB_NODE_FN (tcp6_rcv_process_node) (vlib_main_t * vm,
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (tcp4_rcv_process_node) =
|
||||
{
|
||||
VLIB_REGISTER_NODE (tcp4_rcv_process_node) = {
|
||||
.name = "tcp4-rcv-process",
|
||||
/* Takes a vector of packets. */
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_RCV_PROCESS_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_RCV_PROCESS_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (tcp6_rcv_process_node) =
|
||||
{
|
||||
VLIB_REGISTER_NODE (tcp6_rcv_process_node) = {
|
||||
.name = "tcp6-rcv-process",
|
||||
/* Takes a vector of packets. */
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_RCV_PROCESS_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_RCV_PROCESS_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
@ -2799,59 +2699,81 @@ VLIB_NODE_FN (tcp6_listen_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (tcp4_listen_node) =
|
||||
{
|
||||
VLIB_REGISTER_NODE (tcp4_listen_node) = {
|
||||
.name = "tcp4-listen",
|
||||
/* Takes a vector of packets. */
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_LISTEN_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_LISTEN_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (tcp6_listen_node) =
|
||||
{
|
||||
VLIB_REGISTER_NODE (tcp6_listen_node) = {
|
||||
.name = "tcp6-listen",
|
||||
/* Takes a vector of packets. */
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
.n_next_nodes = TCP_LISTEN_N_NEXT,
|
||||
.next_nodes =
|
||||
{
|
||||
#define _(s,n) [TCP_LISTEN_NEXT_##s] = n,
|
||||
foreach_tcp_state_next
|
||||
#undef _
|
||||
},
|
||||
.format_trace = format_tcp_rx_trace_short,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#define foreach_tcp4_input_next \
|
||||
_ (DROP, "ip4-drop") \
|
||||
_ (LISTEN, "tcp4-listen") \
|
||||
_ (RCV_PROCESS, "tcp4-rcv-process") \
|
||||
_ (SYN_SENT, "tcp4-syn-sent") \
|
||||
_ (ESTABLISHED, "tcp4-established") \
|
||||
_ (RESET, "tcp4-reset") \
|
||||
always_inline uword
|
||||
tcp46_drop_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
|
||||
vlib_frame_t *frame, int is_ip4)
|
||||
{
|
||||
u32 *from = vlib_frame_vector_args (frame);
|
||||
|
||||
/* Error counters must be incremented by previous nodes */
|
||||
vlib_buffer_free (vm, from, frame->n_vectors);
|
||||
|
||||
return frame->n_vectors;
|
||||
}
|
||||
|
||||
VLIB_NODE_FN (tcp4_drop_node)
|
||||
(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
|
||||
{
|
||||
return tcp46_drop_inline (vm, node, from_frame, 1 /* is_ip4 */);
|
||||
}
|
||||
|
||||
VLIB_NODE_FN (tcp6_drop_node)
|
||||
(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
|
||||
{
|
||||
return tcp46_drop_inline (vm, node, from_frame, 0 /* is_ip4 */);
|
||||
}
|
||||
|
||||
VLIB_REGISTER_NODE (tcp4_drop_node) = {
|
||||
.name = "tcp4-drop",
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
};
|
||||
|
||||
VLIB_REGISTER_NODE (tcp6_drop_node) = {
|
||||
.name = "tcp6-drop",
|
||||
.vector_size = sizeof (u32),
|
||||
.n_errors = TCP_N_ERROR,
|
||||
.error_counters = tcp_input_error_counters,
|
||||
};
|
||||
|
||||
#define foreach_tcp4_input_next \
|
||||
_ (DROP, "tcp4-drop") \
|
||||
_ (LISTEN, "tcp4-listen") \
|
||||
_ (RCV_PROCESS, "tcp4-rcv-process") \
|
||||
_ (SYN_SENT, "tcp4-syn-sent") \
|
||||
_ (ESTABLISHED, "tcp4-established") \
|
||||
_ (RESET, "tcp4-reset") \
|
||||
_ (PUNT, "ip4-punt")
|
||||
|
||||
#define foreach_tcp6_input_next \
|
||||
_ (DROP, "ip6-drop") \
|
||||
_ (LISTEN, "tcp6-listen") \
|
||||
_ (RCV_PROCESS, "tcp6-rcv-process") \
|
||||
_ (SYN_SENT, "tcp6-syn-sent") \
|
||||
_ (ESTABLISHED, "tcp6-established") \
|
||||
_ (RESET, "tcp6-reset") \
|
||||
#define foreach_tcp6_input_next \
|
||||
_ (DROP, "tcp6-drop") \
|
||||
_ (LISTEN, "tcp6-listen") \
|
||||
_ (RCV_PROCESS, "tcp6-rcv-process") \
|
||||
_ (SYN_SENT, "tcp6-syn-sent") \
|
||||
_ (ESTABLISHED, "tcp6-established") \
|
||||
_ (RESET, "tcp6-reset") \
|
||||
_ (PUNT, "ip6-punt")
|
||||
|
||||
#define filter_flags (TCP_FLAG_SYN|TCP_FLAG_ACK|TCP_FLAG_RST|TCP_FLAG_FIN)
|
||||
|
@ -463,6 +463,7 @@ tls_session_accept_callback (session_t * tls_session)
|
||||
session_t *tls_listener, *app_session;
|
||||
tls_ctx_t *lctx, *ctx;
|
||||
u32 ctx_handle;
|
||||
int rv;
|
||||
|
||||
tls_listener =
|
||||
listen_session_get_from_handle (tls_session->listener_handle);
|
||||
@ -489,7 +490,14 @@ tls_session_accept_callback (session_t * tls_session)
|
||||
TLS_DBG (1, "Accept on listener %u new connection [%u]%x",
|
||||
tls_listener->opaque, vlib_get_thread_index (), ctx_handle);
|
||||
|
||||
return tls_ctx_init_server (ctx);
|
||||
rv = tls_ctx_init_server (ctx);
|
||||
if (rv)
|
||||
{
|
||||
session_free (app_session);
|
||||
tls_ctx_free (ctx);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
@ -530,6 +538,7 @@ tls_session_connected_cb (u32 tls_app_index, u32 ho_ctx_index,
|
||||
tls_ctx_t *ho_ctx, *ctx;
|
||||
session_type_t st;
|
||||
u32 ctx_handle;
|
||||
int rv;
|
||||
|
||||
ho_ctx = tls_ctx_half_open_get (ho_ctx_index);
|
||||
|
||||
@ -559,7 +568,14 @@ tls_session_connected_cb (u32 tls_app_index, u32 ho_ctx_index,
|
||||
app_session->session_type = st;
|
||||
app_session->connection_index = ctx->tls_ctx_handle;
|
||||
|
||||
return tls_ctx_init_client (ctx);
|
||||
rv = tls_ctx_init_client (ctx);
|
||||
if (rv)
|
||||
{
|
||||
session_free (app_session);
|
||||
tls_ctx_free (ctx);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -364,7 +364,8 @@ udp_open_connection (transport_endpoint_cfg_t * rmt)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
if (udp_is_valid_dst_port (lcl_port, rmt->is_ip4))
|
||||
if (udp_connection_port_used_extern (clib_net_to_host_u16 (lcl_port),
|
||||
rmt->is_ip4))
|
||||
{
|
||||
/* If specific source port was requested abort */
|
||||
if (rmt->peer.port)
|
||||
@ -375,7 +376,8 @@ udp_open_connection (transport_endpoint_cfg_t * rmt)
|
||||
}
|
||||
|
||||
/* Try to find a port that's not used */
|
||||
while (udp_is_valid_dst_port (lcl_port, rmt->is_ip4))
|
||||
while (udp_connection_port_used_extern (clib_net_to_host_u16 (lcl_port),
|
||||
rmt->is_ip4))
|
||||
{
|
||||
transport_release_local_endpoint (TRANSPORT_PROTO_UDP, &lcl_addr,
|
||||
lcl_port);
|
||||
|
@ -211,16 +211,21 @@ static void
|
||||
table_format_udp_port_ (vlib_main_t *vm, udp_main_t *um, table_t *t, int *c,
|
||||
int port, int bind, int is_ip4)
|
||||
{
|
||||
const udp_dst_port_info_t *pi = udp_get_dst_port_info (um, port, is_ip4);
|
||||
const udp_dst_port_info_t *pi;
|
||||
|
||||
if (bind && !udp_is_valid_dst_port (port, is_ip4))
|
||||
return;
|
||||
|
||||
pi = udp_get_dst_port_info (um, port, is_ip4);
|
||||
if (!pi)
|
||||
return;
|
||||
if (bind && ~0 == pi->node_index)
|
||||
return;
|
||||
|
||||
table_format_cell (t, *c, 0, "%d", pi->dst_port);
|
||||
table_format_cell (t, *c, 1, is_ip4 ? "ip4" : "ip6");
|
||||
table_format_cell (t, *c, 2, ~0 == pi->node_index ? "none" : "%U",
|
||||
format_vlib_node_name, vm, pi->node_index);
|
||||
table_format_cell (t, *c, 3, "%s", pi->name);
|
||||
|
||||
(*c)++;
|
||||
}
|
||||
|
||||
|
@ -523,16 +523,12 @@ u8
|
||||
udp_is_valid_dst_port (udp_dst_port_t dst_port, u8 is_ip4)
|
||||
{
|
||||
udp_main_t *um = &udp_main;
|
||||
u16 *n;
|
||||
|
||||
if (is_ip4)
|
||||
n = sparse_vec_validate (um->next_by_dst_port4,
|
||||
clib_host_to_net_u16 (dst_port));
|
||||
else
|
||||
n = sparse_vec_validate (um->next_by_dst_port6,
|
||||
clib_host_to_net_u16 (dst_port));
|
||||
|
||||
return (n[0] != SPARSE_VEC_INVALID_INDEX && n[0] != UDP_NO_NODE_SET);
|
||||
u16 *next_by_dst_port =
|
||||
is_ip4 ? um->next_by_dst_port4 : um->next_by_dst_port6;
|
||||
uword index =
|
||||
sparse_vec_index (next_by_dst_port, clib_host_to_net_u16 (dst_port));
|
||||
return (index != SPARSE_VEC_INVALID_INDEX &&
|
||||
vec_elt (next_by_dst_port, index) != UDP_NO_NODE_SET);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -996,6 +996,7 @@ class LDPThruHostStackIperfUdp(VCLTestCase):
|
||||
"-t 2",
|
||||
"-u",
|
||||
"-l 1400",
|
||||
"-P 2",
|
||||
"-c",
|
||||
self.loop0.local_ip4,
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user