Bug Summary

File:home/sharpd/frr3/mgmtd/mgmt_fe_adapter.c
Warning:line 1107, column 2
Value stored to 'msg' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name mgmt_fe_adapter.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/sharpd/frr3 -resource-dir /usr/lib/llvm-14/lib/clang/14.0.0 -D HAVE_CONFIG_H -D SYSCONFDIR="/etc/frr/" -D CONFDATE=20240105 -I . -I ./lib/assert -I . -I ./include -I ./lib -I . -I /usr/include/lua5.3 -I /usr/include/x86_64-linux-gnu -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wwrite-strings -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-microsoft-anon-tag -fconst-strings -fdebug-compilation-dir=/home/sharpd/frr3 -ferror-limit 19 -fms-extensions -fgnuc-version=4.2.1 -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2024-01-05-120749-780821-1 -x c mgmtd/mgmt_fe_adapter.c
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * MGMTD Frontend Client Connection Adapter
4 *
5 * Copyright (C) 2021 Vmware, Inc.
6 * Pushpasis Sarkar <spushpasis@vmware.com>
7 * Copyright (c) 2023, LabN Consulting, L.L.C.
8 */
9
10#include <zebra.h>
11#include "darr.h"
12#include "sockopt.h"
13#include "network.h"
14#include "libfrr.h"
15#include "mgmt_fe_client.h"
16#include "mgmt_msg.h"
17#include "mgmt_msg_native.h"
18#include "mgmt_pb.h"
19#include "hash.h"
20#include "jhash.h"
21#include "mgmtd/mgmt.h"
22#include "mgmtd/mgmt_ds.h"
23#include "mgmtd/mgmt_memory.h"
24#include "mgmtd/mgmt_fe_adapter.h"
25
26#define MGMTD_FE_ADAPTER_DBG(fmt, ...)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " fmt), .hashu32 = {(7), (0)}, },
}; static const struct xref_logmsg _xref __attribute__( (used
)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 26
, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring = ("FE-ADAPTER: %s: "
fmt), .priority = (7), .ec = (0), .args = ("__func__, ..."),
}; static const struct xref * const xref_p_71 __attribute__(
(used, section("xref_array"))) = &(_xref.xref); zlog_ref(
&_xref, ("FE-ADAPTER: %s: " fmt), __func__, ...); } while
(0); } while (0)
\
27 DEBUGD(&mgmt_debug_fe, "FE-ADAPTER: %s: " fmt, __func__, ##__VA_ARGS__)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " fmt), .hashu32 = {(7), (0)}, },
}; static const struct xref_logmsg _xref __attribute__( (used
)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 27
, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring = ("FE-ADAPTER: %s: "
fmt), .priority = (7), .ec = (0), .args = ("__func__, ##__VA_ARGS__"
), }; static const struct xref * const xref_p_72 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " fmt), __func__, ##__VA_ARGS__
); } while (0); } while (0)
28#define MGMTD_FE_ADAPTER_ERR(fmt, ...)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
fmt), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 28, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: ERROR: " fmt), .priority = (
3), .ec = (0), .args = ("__func__, ..."), }; static const struct
xref * const xref_p_73 __attribute__((used, section("xref_array"
))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: "
fmt), __func__, ...); } while (0)
\
29 zlog_err("FE-ADAPTER: %s: ERROR: " fmt, __func__, ##__VA_ARGS__)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
fmt), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 29, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: ERROR: " fmt), .priority = (
3), .ec = (0), .args = ("__func__, ##__VA_ARGS__"), }; static
const struct xref * const xref_p_74 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: "
fmt), __func__, ##__VA_ARGS__); } while (0)
30
31#define FOREACH_ADAPTER_IN_LIST(adapter)for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((adapter) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (adapter); (adapter) = mgmt_fe_adapters_safe
, mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe(&mgmt_fe_adapters
, mgmt_fe_adapters_safe))
\
32 frr_each_safe (mgmt_fe_adapters, &mgmt_fe_adapters, (adapter))for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((adapter) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (adapter); (adapter) = mgmt_fe_adapters_safe
, mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe(&mgmt_fe_adapters
, mgmt_fe_adapters_safe))
33
34enum mgmt_session_event {
35 MGMTD_FE_SESSION_CFG_TXN_CLNUP = 1,
36 MGMTD_FE_SESSION_SHOW_TXN_CLNUP,
37};
38
39struct mgmt_fe_session_ctx {
40 struct mgmt_fe_client_adapter *adapter;
41 uint64_t_uint64_t session_id;
42 uint64_t_uint64_t client_id;
43 uint64_t_uint64_t txn_id;
44 uint64_t_uint64_t cfg_txn_id;
45 uint8_t ds_locked[MGMTD_DS_MAX_IDMGMTD__DATASTORE_ID__OPERATIONAL_DS + 1];
46 struct event *proc_cfg_txn_clnp;
47 struct event *proc_show_txn_clnp;
48
49 struct mgmt_fe_sessions_item list_linkage;
50};
51
52DECLARE_LIST(mgmt_fe_sessions, struct mgmt_fe_session_ctx, list_linkage)static inline __attribute__((unused)) void mgmt_fe_sessions_init
(struct mgmt_fe_sessions_head *h) { memset(h, 0, sizeof(*h));
h->sh.first = &typesafe_slist_sentinel; h->sh.last_next
= &h->sh.first; } static inline __attribute__((unused
)) void mgmt_fe_sessions_fini(struct mgmt_fe_sessions_head *h
) { memset(h, 0, sizeof(*h)); } static inline __attribute__((
unused)) void mgmt_fe_sessions_add_head(struct mgmt_fe_sessions_head
*h, struct mgmt_fe_session_ctx *item) { typesafe_list_add(&
h->sh, &h->sh.first, &item->list_linkage.si)
; } static inline __attribute__((unused)) void mgmt_fe_sessions_add_tail
(struct mgmt_fe_sessions_head *h, struct mgmt_fe_session_ctx *
item) { typesafe_list_add(&h->sh, h->sh.last_next, &
item->list_linkage.si); } static inline __attribute__((unused
)) void mgmt_fe_sessions_add_after(struct mgmt_fe_sessions_head
*h, struct mgmt_fe_session_ctx *after, struct mgmt_fe_session_ctx
*item) { struct slist_item **nextp; nextp = after ? &after
->list_linkage.si.next : &h->sh.first; typesafe_list_add
(&h->sh, nextp, &item->list_linkage.si); } static
inline __attribute__((unused)) struct mgmt_fe_session_ctx *mgmt_fe_sessions_del
(struct mgmt_fe_sessions_head *h, struct mgmt_fe_session_ctx *
item) { struct slist_item **iter = &h->sh.first; while
(*iter != &typesafe_slist_sentinel && *iter != &
item->list_linkage.si) iter = &(*iter)->next; if (*
iter == &typesafe_slist_sentinel) return ((void*)0); h->
sh.count--; *iter = item->list_linkage.si.next; if (item->
list_linkage.si.next == &typesafe_slist_sentinel) h->sh
.last_next = iter; item->list_linkage.si.next = ((void*)0)
; return item; } static inline __attribute__((unused)) struct
mgmt_fe_session_ctx *mgmt_fe_sessions_pop(struct mgmt_fe_sessions_head
*h) { struct slist_item *sitem = h->sh.first; if (sitem ==
&typesafe_slist_sentinel) return ((void*)0); h->sh.count
--; h->sh.first = sitem->next; if (h->sh.first == &
typesafe_slist_sentinel) h->sh.last_next = &h->sh.first
; sitem->next = ((void*)0); return (__builtin_choose_expr(
__builtin_types_compatible_p(typeof(&((struct mgmt_fe_session_ctx
*)0)->list_linkage.si), typeof(sitem)) || __builtin_types_compatible_p
(void *, typeof(sitem)), ({ typeof(((struct mgmt_fe_session_ctx
*)0)->list_linkage.si) *__mptr = (void *)(sitem); (struct
mgmt_fe_session_ctx *)((char *)__mptr - __builtin_offsetof(struct
mgmt_fe_session_ctx, list_linkage.si)); }), ({ typeof(((const
struct mgmt_fe_session_ctx *)0)->list_linkage.si) *__mptr
= (sitem); (const struct mgmt_fe_session_ctx *)((const char *
)__mptr - __builtin_offsetof(struct mgmt_fe_session_ctx, list_linkage
.si)); }) )); } static inline __attribute__((unused)) void mgmt_fe_sessions_swap_all
(struct mgmt_fe_sessions_head *a, struct mgmt_fe_sessions_head
*b) { struct mgmt_fe_sessions_head tmp = *a; *a = *b; *b = tmp
; if (a->sh.last_next == &b->sh.first) a->sh.last_next
= &a->sh.first; if (b->sh.last_next == &a->
sh.first) b->sh.last_next = &b->sh.first; } static inline
__attribute__((unused, pure)) const struct mgmt_fe_session_ctx
*mgmt_fe_sessions_const_first(const struct mgmt_fe_sessions_head
*h) { if (h->sh.first != &typesafe_slist_sentinel) return
(__builtin_choose_expr( __builtin_types_compatible_p(typeof(
&((struct mgmt_fe_session_ctx *)0)->list_linkage.si), typeof
(h->sh.first)) || __builtin_types_compatible_p(void *, typeof
(h->sh.first)), ({ typeof(((struct mgmt_fe_session_ctx *)0
)->list_linkage.si) *__mptr = (void *)(h->sh.first); (struct
mgmt_fe_session_ctx *)((char *)__mptr - __builtin_offsetof(struct
mgmt_fe_session_ctx, list_linkage.si)); }), ({ typeof(((const
struct mgmt_fe_session_ctx *)0)->list_linkage.si) *__mptr
= (h->sh.first); (const struct mgmt_fe_session_ctx *)((const
char *)__mptr - __builtin_offsetof(struct mgmt_fe_session_ctx
, list_linkage.si)); }) )); return ((void*)0); } static inline
__attribute__((unused, pure)) const struct mgmt_fe_session_ctx
*mgmt_fe_sessions_const_next(const struct mgmt_fe_sessions_head
*h, const struct mgmt_fe_session_ctx *item) { const struct slist_item
*sitem = &item->list_linkage.si; if (sitem->next !=
&typesafe_slist_sentinel) return (__builtin_choose_expr(
__builtin_types_compatible_p(typeof(&((struct mgmt_fe_session_ctx
*)0)->list_linkage.si), typeof(sitem->next)) || __builtin_types_compatible_p
(void *, typeof(sitem->next)), ({ typeof(((struct mgmt_fe_session_ctx
*)0)->list_linkage.si) *__mptr = (void *)(sitem->next)
; (struct mgmt_fe_session_ctx *)((char *)__mptr - __builtin_offsetof
(struct mgmt_fe_session_ctx, list_linkage.si)); }), ({ typeof
(((const struct mgmt_fe_session_ctx *)0)->list_linkage.si)
*__mptr = (sitem->next); (const struct mgmt_fe_session_ctx
*)((const char *)__mptr - __builtin_offsetof(struct mgmt_fe_session_ctx
, list_linkage.si)); }) )); return ((void*)0); } static inline
__attribute__((unused, pure)) struct mgmt_fe_session_ctx *mgmt_fe_sessions_first
(struct mgmt_fe_sessions_head *h) { return (struct mgmt_fe_session_ctx
*)mgmt_fe_sessions_const_first(h); } static inline __attribute__
((unused, pure)) struct mgmt_fe_session_ctx *mgmt_fe_sessions_next
(struct mgmt_fe_sessions_head *h, struct mgmt_fe_session_ctx *
item) { return (struct mgmt_fe_session_ctx *)mgmt_fe_sessions_const_next
(h, item); } static inline __attribute__((unused, pure)) struct
mgmt_fe_session_ctx *mgmt_fe_sessions_next_safe(struct mgmt_fe_sessions_head
*h, struct mgmt_fe_session_ctx *item) { struct slist_item *sitem
; if (!item) return ((void*)0); sitem = &item->list_linkage
.si; if (sitem->next != &typesafe_slist_sentinel) return
(__builtin_choose_expr( __builtin_types_compatible_p(typeof(
&((struct mgmt_fe_session_ctx *)0)->list_linkage.si), typeof
(sitem->next)) || __builtin_types_compatible_p(void *, typeof
(sitem->next)), ({ typeof(((struct mgmt_fe_session_ctx *)0
)->list_linkage.si) *__mptr = (void *)(sitem->next); (struct
mgmt_fe_session_ctx *)((char *)__mptr - __builtin_offsetof(struct
mgmt_fe_session_ctx, list_linkage.si)); }), ({ typeof(((const
struct mgmt_fe_session_ctx *)0)->list_linkage.si) *__mptr
= (sitem->next); (const struct mgmt_fe_session_ctx *)((const
char *)__mptr - __builtin_offsetof(struct mgmt_fe_session_ctx
, list_linkage.si)); }) )); return ((void*)0); } static inline
__attribute__((unused, pure)) size_t mgmt_fe_sessions_count(
const struct mgmt_fe_sessions_head *h) { return h->sh.count
; } static inline __attribute__((unused, pure)) _Bool mgmt_fe_sessions_anywhere
(const struct mgmt_fe_session_ctx *item) { return item->list_linkage
.si.next != ((void*)0); } static inline __attribute__((unused
, pure)) _Bool mgmt_fe_sessions_member(const struct mgmt_fe_sessions_head
*h, const struct mgmt_fe_session_ctx *item) { return typesafe_list_member
(&h->sh, &item->list_linkage.si); } _Static_assert
(1, "please add a semicolon after this macro")
;
53
54#define FOREACH_SESSION_IN_LIST(adapter, session)for (typeof(mgmt_fe_sessions_next_safe(&(adapter)->fe_sessions
, ((void*)0))) mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe
(&(adapter)->fe_sessions, ((session) = mgmt_fe_sessions_first
(&(adapter)->fe_sessions))); (session); (session) = mgmt_fe_sessions_safe
, mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe(&(adapter
)->fe_sessions, mgmt_fe_sessions_safe))
\
55 frr_each_safe (mgmt_fe_sessions, &(adapter)->fe_sessions, (session))for (typeof(mgmt_fe_sessions_next_safe(&(adapter)->fe_sessions
, ((void*)0))) mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe
(&(adapter)->fe_sessions, ((session) = mgmt_fe_sessions_first
(&(adapter)->fe_sessions))); (session); (session) = mgmt_fe_sessions_safe
, mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe(&(adapter
)->fe_sessions, mgmt_fe_sessions_safe))
56
57static struct event_loop *mgmt_loop;
58static struct msg_server mgmt_fe_server = {.fd = -1};
59
60static struct mgmt_fe_adapters_head mgmt_fe_adapters;
61
62static struct hash *mgmt_fe_sessions;
63static uint64_t_uint64_t mgmt_fe_next_session_id;
64
65/* Forward declarations */
66static void
67mgmt_fe_session_register_event(struct mgmt_fe_session_ctx *session,
68 enum mgmt_session_event event);
69
70static int
71mgmt_fe_session_write_lock_ds(Mgmtd__DatastoreId ds_id,
72 struct mgmt_ds_ctx *ds_ctx,
73 struct mgmt_fe_session_ctx *session)
74{
75 if (session->ds_locked[ds_id])
76 zlog_warn("multiple lock taken by session-id: %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("multiple lock taken by session-id: %"
"llu" " on DS:%s"), .hashu32 = {(4), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 78, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("multiple lock taken by session-id: %"
"llu" " on DS:%s"), .priority = (4), .ec = (0), .args = ("session->session_id, mgmt_ds_id2name(ds_id)"
), }; static const struct xref * const xref_p_75 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("multiple lock taken by session-id: %" "llu" " on DS:%s"
), session->session_id, mgmt_ds_id2name(ds_id)); } while (
0)
77 " on DS:%s",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("multiple lock taken by session-id: %"
"llu" " on DS:%s"), .hashu32 = {(4), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 78, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("multiple lock taken by session-id: %"
"llu" " on DS:%s"), .priority = (4), .ec = (0), .args = ("session->session_id, mgmt_ds_id2name(ds_id)"
), }; static const struct xref * const xref_p_75 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("multiple lock taken by session-id: %" "llu" " on DS:%s"
), session->session_id, mgmt_ds_id2name(ds_id)); } while (
0)
78 session->session_id, mgmt_ds_id2name(ds_id))do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("multiple lock taken by session-id: %"
"llu" " on DS:%s"), .hashu32 = {(4), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 78, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("multiple lock taken by session-id: %"
"llu" " on DS:%s"), .priority = (4), .ec = (0), .args = ("session->session_id, mgmt_ds_id2name(ds_id)"
), }; static const struct xref * const xref_p_75 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("multiple lock taken by session-id: %" "llu" " on DS:%s"
), session->session_id, mgmt_ds_id2name(ds_id)); } while (
0)
;
79 else {
80 if (mgmt_ds_lock(ds_ctx, session->session_id)) {
81 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 85, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_76 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
82 "Failed to lock the DS:%s for session-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 85, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_76 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
83 " from %s!",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 85, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_76 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
84 mgmt_ds_id2name(ds_id), session->session_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 85, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_76 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
85 session->adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 85, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_76 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to lock the DS:%s for session-id: %"
"llu" " from %s!"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
;
86 return -1;
87 }
88
89 session->ds_locked[ds_id] = true1;
90 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 94, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_77 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
91 "Write-Locked the DS:%s for session-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 94, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_77 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
92 " from %s",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 94, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_77 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
93 mgmt_ds_id2name(ds_id), session->session_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 94, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_77 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
94 session->adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 94, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_77 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Write-Locked the DS:%s for session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
;
95 }
96
97 return 0;
98}
99
100static void mgmt_fe_session_unlock_ds(Mgmtd__DatastoreId ds_id,
101 struct mgmt_ds_ctx *ds_ctx,
102 struct mgmt_fe_session_ctx *session)
103{
104 if (!session->ds_locked[ds_id])
105 zlog_warn("unlock unlocked by session-id: %" PRIu64 " on DS:%s",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("unlock unlocked by session-id: %"
"llu" " on DS:%s"), .hashu32 = {(4), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 106, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("unlock unlocked by session-id: %"
"llu" " on DS:%s"), .priority = (4), .ec = (0), .args = ("session->session_id, mgmt_ds_id2name(ds_id)"
), }; static const struct xref * const xref_p_78 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("unlock unlocked by session-id: %" "llu" " on DS:%s"
), session->session_id, mgmt_ds_id2name(ds_id)); } while (
0)
106 session->session_id, mgmt_ds_id2name(ds_id))do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("unlock unlocked by session-id: %"
"llu" " on DS:%s"), .hashu32 = {(4), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 106, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("unlock unlocked by session-id: %"
"llu" " on DS:%s"), .priority = (4), .ec = (0), .args = ("session->session_id, mgmt_ds_id2name(ds_id)"
), }; static const struct xref * const xref_p_78 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("unlock unlocked by session-id: %" "llu" " on DS:%s"
), session->session_id, mgmt_ds_id2name(ds_id)); } while (
0)
;
107
108 session->ds_locked[ds_id] = false0;
109 mgmt_ds_unlock(ds_ctx);
110 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 114, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_79 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
111 "Unlocked DS:%s write-locked earlier by session-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 114, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_79 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
112 " from %s",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 114, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_79 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
113 mgmt_ds_id2name(ds_id), session->session_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 114, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_79 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
114 session->adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 114, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(ds_id), session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_79 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Unlocked DS:%s write-locked earlier by session-id: %"
"llu" " from %s"), __func__, mgmt_ds_id2name(ds_id), session
->session_id, session->adapter->name); } while (0); }
while (0)
;
115}
116
117static void
118mgmt_fe_session_cfg_txn_cleanup(struct mgmt_fe_session_ctx *session)
119{
120 /*
121 * Ensure any uncommitted changes in Candidate DS
122 * is discarded.
123 */
124 mgmt_ds_copy_dss(mm->running_ds, mm->candidate_ds, false0);
125
126 /*
127 * Destroy the actual transaction created earlier.
128 */
129 if (session->cfg_txn_id != MGMTD_TXN_ID_NONE0)
130 mgmt_destroy_txn(&session->cfg_txn_id);
131}
132
133static void
134mgmt_fe_session_show_txn_cleanup(struct mgmt_fe_session_ctx *session)
135{
136 /*
137 * Destroy the transaction created recently.
138 */
139 if (session->txn_id != MGMTD_TXN_ID_NONE0)
140 mgmt_destroy_txn(&session->txn_id);
141}
142
143static void
144mgmt_fe_adapter_compute_set_cfg_timers(struct mgmt_setcfg_stats *setcfg_stats)
145{
146 setcfg_stats->last_exec_tm = timeval_elapsed(setcfg_stats->last_end,
147 setcfg_stats->last_start);
148 if (setcfg_stats->last_exec_tm > setcfg_stats->max_tm)
149 setcfg_stats->max_tm = setcfg_stats->last_exec_tm;
150
151 if (setcfg_stats->last_exec_tm < setcfg_stats->min_tm)
152 setcfg_stats->min_tm = setcfg_stats->last_exec_tm;
153
154 setcfg_stats->avg_tm =
155 (((setcfg_stats->avg_tm * (setcfg_stats->set_cfg_count - 1))
156 + setcfg_stats->last_exec_tm)
157 / setcfg_stats->set_cfg_count);
158}
159
160static void
161mgmt_fe_session_compute_commit_timers(struct mgmt_commit_stats *cmt_stats)
162{
163 cmt_stats->last_exec_tm =
164 timeval_elapsed(cmt_stats->last_end, cmt_stats->last_start);
165 if (cmt_stats->last_exec_tm > cmt_stats->max_tm) {
166 cmt_stats->max_tm = cmt_stats->last_exec_tm;
167 cmt_stats->max_batch_cnt = cmt_stats->last_batch_cnt;
168 }
169
170 if (cmt_stats->last_exec_tm < cmt_stats->min_tm) {
171 cmt_stats->min_tm = cmt_stats->last_exec_tm;
172 cmt_stats->min_batch_cnt = cmt_stats->last_batch_cnt;
173 }
174}
175
176static void mgmt_fe_cleanup_session(struct mgmt_fe_session_ctx **sessionp)
177{
178 Mgmtd__DatastoreId ds_id;
179 struct mgmt_ds_ctx *ds_ctx;
180 struct mgmt_fe_session_ctx *session = *sessionp;
181
182 if (session->adapter) {
183 mgmt_fe_session_cfg_txn_cleanup(session);
184 mgmt_fe_session_show_txn_cleanup(session);
185 for (ds_id = 0; ds_id < MGMTD_DS_MAX_IDMGMTD__DATASTORE_ID__OPERATIONAL_DS + 1; ds_id++) {
186 ds_ctx = mgmt_ds_get_ctx_by_id(mm, ds_id);
187 if (ds_ctx && session->ds_locked[ds_id])
188 mgmt_fe_session_unlock_ds(ds_id, ds_ctx,
189 session);
190 }
191 mgmt_fe_sessions_del(&session->adapter->fe_sessions, session);
192 assert(session->adapter->refcount > 1)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 192, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "session->adapter->refcount > 1"
, }; static const struct xref * const xref_p_80 __attribute__
((used, section("xref_array"))) = &(_xref.xref); if (__builtin_expect
((session->adapter->refcount > 1) ? 0 : 1, 0)) do { _zlog_assert_failed
(&_xref, ((void*)0)); } while (session->adapter->refcount
> 1); })
;
193 mgmt_fe_adapter_unlock(&session->adapter);
194 }
195
196 hash_release(mgmt_fe_sessions, session);
197 XFREE(MTYPE_MGMTD_FE_SESSION, session)do { qfree(MTYPE_MGMTD_FE_SESSION, session); session = ((void
*)0); } while (0)
;
198 *sessionp = NULL((void*)0);
199}
200
201static struct mgmt_fe_session_ctx *
202mgmt_fe_find_session_by_client_id(struct mgmt_fe_client_adapter *adapter,
203 uint64_t_uint64_t client_id)
204{
205 struct mgmt_fe_session_ctx *session;
206
207 FOREACH_SESSION_IN_LIST (adapter, session)for (typeof(mgmt_fe_sessions_next_safe(&(adapter)->fe_sessions
, ((void*)0))) mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe
(&(adapter)->fe_sessions, ((session) = mgmt_fe_sessions_first
(&(adapter)->fe_sessions))); (session); (session) = mgmt_fe_sessions_safe
, mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe(&(adapter
)->fe_sessions, mgmt_fe_sessions_safe))
{
208 if (session->client_id == client_id) {
209 MGMTD_FE_ADAPTER_DBG("Found session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Found session-id %" "llu" " using client-id %"
"llu"), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 211, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Found session-id %" "llu"
" using client-id %" "llu"), .priority = (7), .ec = (0), .args
= ("__func__, session->session_id, client_id"), }; static
const struct xref * const xref_p_81 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: "
"Found session-id %" "llu" " using client-id %" "llu"), __func__
, session->session_id, client_id); } while (0); } while (0
)
210 " using client-id %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Found session-id %" "llu" " using client-id %"
"llu"), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 211, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Found session-id %" "llu"
" using client-id %" "llu"), .priority = (7), .ec = (0), .args
= ("__func__, session->session_id, client_id"), }; static
const struct xref * const xref_p_81 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: "
"Found session-id %" "llu" " using client-id %" "llu"), __func__
, session->session_id, client_id); } while (0); } while (0
)
211 session->session_id, client_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Found session-id %" "llu" " using client-id %"
"llu"), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 211, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Found session-id %" "llu"
" using client-id %" "llu"), .priority = (7), .ec = (0), .args
= ("__func__, session->session_id, client_id"), }; static
const struct xref * const xref_p_81 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: "
"Found session-id %" "llu" " using client-id %" "llu"), __func__
, session->session_id, client_id); } while (0); } while (0
)
;
212 return session;
213 }
214 }
215 MGMTD_FE_ADAPTER_DBG("Session not found using client-id %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Session not found using client-id %"
"llu"), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 216, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Session not found using client-id %"
"llu"), .priority = (7), .ec = (0), .args = ("__func__, client_id"
), }; static const struct xref * const xref_p_82 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Session not found using client-id %"
"llu"), __func__, client_id); } while (0); } while (0)
216 client_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Session not found using client-id %"
"llu"), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 216, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Session not found using client-id %"
"llu"), .priority = (7), .ec = (0), .args = ("__func__, client_id"
), }; static const struct xref * const xref_p_82 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Session not found using client-id %"
"llu"), __func__, client_id); } while (0); } while (0)
;
217 return NULL((void*)0);
218}
219
220static unsigned int mgmt_fe_session_hash_key(const void *data)
221{
222 const struct mgmt_fe_session_ctx *session = data;
223
224 return jhash2((uint32_t *) &session->session_id,
225 sizeof(session->session_id) / sizeof(uint32_t), 0);
226}
227
228static bool_Bool mgmt_fe_session_hash_cmp(const void *d1, const void *d2)
229{
230 const struct mgmt_fe_session_ctx *session1 = d1;
231 const struct mgmt_fe_session_ctx *session2 = d2;
232
233 return (session1->session_id == session2->session_id);
234}
235
236static inline struct mgmt_fe_session_ctx *
237mgmt_session_id2ctx(uint64_t_uint64_t session_id)
238{
239 struct mgmt_fe_session_ctx key = {0};
240 struct mgmt_fe_session_ctx *session;
241
242 if (!mgmt_fe_sessions)
243 return NULL((void*)0);
244
245 key.session_id = session_id;
246 session = hash_lookup(mgmt_fe_sessions, &key);
247
248 return session;
249}
250
251void mgmt_fe_adapter_toggle_client_debug(bool_Bool set)
252{
253 struct mgmt_fe_client_adapter *adapter;
254
255 FOREACH_ADAPTER_IN_LIST (adapter)for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((adapter) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (adapter); (adapter) = mgmt_fe_adapters_safe
, mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe(&mgmt_fe_adapters
, mgmt_fe_adapters_safe))
256 adapter->conn->debug = set;
257}
258
259static struct mgmt_fe_session_ctx *fe_adapter_session_by_txn_id(uint64_t_uint64_t txn_id)
260{
261 uint64_t_uint64_t session_id = mgmt_txn_get_session_id(txn_id);
262
263 if (session_id == MGMTD_SESSION_ID_NONE0)
264 return NULL((void*)0);
265 return mgmt_session_id2ctx(session_id);
266}
267
268static struct mgmt_fe_session_ctx *
269mgmt_fe_create_session(struct mgmt_fe_client_adapter *adapter,
270 uint64_t_uint64_t client_id)
271{
272 struct mgmt_fe_session_ctx *session;
273
274 session = mgmt_fe_find_session_by_client_id(adapter, client_id);
275 if (session)
276 mgmt_fe_cleanup_session(&session);
277
278 session = XCALLOC(MTYPE_MGMTD_FE_SESSION,qcalloc(MTYPE_MGMTD_FE_SESSION, sizeof(struct mgmt_fe_session_ctx
))
279 sizeof(struct mgmt_fe_session_ctx))qcalloc(MTYPE_MGMTD_FE_SESSION, sizeof(struct mgmt_fe_session_ctx
))
;
280 assert(session)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 280, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "session", }; static const struct xref
* const xref_p_83 __attribute__((used, section("xref_array")
)) = &(_xref.xref); if (__builtin_expect((session) ? 0 : 1
, 0)) do { _zlog_assert_failed(&_xref, ((void*)0)); } while
(session); })
;
281 session->client_id = client_id;
282 session->adapter = adapter;
283 session->txn_id = MGMTD_TXN_ID_NONE0;
284 session->cfg_txn_id = MGMTD_TXN_ID_NONE0;
285 mgmt_fe_adapter_lock(adapter);
286 mgmt_fe_sessions_add_tail(&adapter->fe_sessions, session);
287 if (!mgmt_fe_next_session_id)
288 mgmt_fe_next_session_id++;
289 session->session_id = mgmt_fe_next_session_id++;
290 hash_get(mgmt_fe_sessions, session, hash_alloc_intern);
291
292 return session;
293}
294
295static int fe_adapter_send_native_msg(struct mgmt_fe_client_adapter *adapter,
296 void *msg, size_t len,
297 bool_Bool short_circuit_ok)
298{
299 return msg_conn_send_msg(adapter->conn, MGMT_MSG_VERSION_NATIVE1, msg,
300 len, NULL((void*)0), short_circuit_ok);
301}
302
303static int fe_adapter_send_msg(struct mgmt_fe_client_adapter *adapter,
304 Mgmtd__FeMessage *fe_msg, bool_Bool short_circuit_ok)
305{
306 return msg_conn_send_msg(
307 adapter->conn, MGMT_MSG_VERSION_PROTOBUF0, fe_msg,
308 mgmtd__fe_message__get_packed_size(fe_msg),
309 (size_t(*)(void *, void *))mgmtd__fe_message__pack,
310 short_circuit_ok);
311}
312
313static int fe_adapter_send_session_reply(struct mgmt_fe_client_adapter *adapter,
314 struct mgmt_fe_session_ctx *session,
315 bool_Bool create, bool_Bool success)
316{
317 Mgmtd__FeMessage fe_msg;
318 Mgmtd__FeSessionReply session_reply;
319
320 mgmtd__fe_session_reply__init(&session_reply);
321 session_reply.create = create;
322 if (create) {
323 session_reply.has_client_conn_id = 1;
324 session_reply.client_conn_id = session->client_id;
325 }
326 session_reply.session_id = session->session_id;
327 session_reply.success = success;
328
329 mgmtd__fe_message__init(&fe_msg);
330 fe_msg.message_case = MGMTD__FE_MESSAGE__MESSAGE_SESSION_REPLY;
331 fe_msg.session_reply = &session_reply;
332
333 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 335, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_84 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), __func__, adapter->name); } while (0); } while (0)
334 "Sending SESSION_REPLY message to MGMTD Frontend client '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 335, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_84 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), __func__, adapter->name); } while (0); } while (0)
335 adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 335, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_84 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending SESSION_REPLY message to MGMTD Frontend client '%s'"
), __func__, adapter->name); } while (0); } while (0)
;
336
337 return fe_adapter_send_msg(adapter, &fe_msg, true1);
338}
339
340static int fe_adapter_send_lockds_reply(struct mgmt_fe_session_ctx *session,
341 Mgmtd__DatastoreId ds_id,
342 uint64_t_uint64_t req_id, bool_Bool lock_ds,
343 bool_Bool success, const char *error_if_any)
344{
345 Mgmtd__FeMessage fe_msg;
346 Mgmtd__FeLockDsReply lockds_reply;
347 bool_Bool scok = session->adapter->conn->is_short_circuit;
348
349 assert(session->adapter)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 349, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "session->adapter", }; static const
struct xref * const xref_p_85 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((session->adapter
) ? 0 : 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0
)); } while (session->adapter); })
;
350
351 mgmtd__fe_lock_ds_reply__init(&lockds_reply);
352 lockds_reply.session_id = session->session_id;
353 lockds_reply.ds_id = ds_id;
354 lockds_reply.req_id = req_id;
355 lockds_reply.lock = lock_ds;
356 lockds_reply.success = success;
357 if (error_if_any)
358 lockds_reply.error_if_any = (char *)error_if_any;
359
360 mgmtd__fe_message__init(&fe_msg);
361 fe_msg.message_case = MGMTD__FE_MESSAGE__MESSAGE_LOCKDS_REPLY;
362 fe_msg.lockds_reply = &lockds_reply;
363
364 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 366, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name, scok"
), }; static const struct xref * const xref_p_86 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), __func__, session->adapter->name, scok); } while (0)
; } while (0)
365 "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 366, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name, scok"
), }; static const struct xref * const xref_p_86 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), __func__, session->adapter->name, scok); } while (0)
; } while (0)
366 session->adapter->name, scok)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 366, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name, scok"
), }; static const struct xref * const xref_p_86 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending LOCK_DS_REPLY message to MGMTD Frontend client '%s' scok: %d"
), __func__, session->adapter->name, scok); } while (0)
; } while (0)
;
367
368 return fe_adapter_send_msg(session->adapter, &fe_msg, scok);
369}
370
371static int fe_adapter_send_set_cfg_reply(struct mgmt_fe_session_ctx *session,
372 Mgmtd__DatastoreId ds_id,
373 uint64_t_uint64_t req_id, bool_Bool success,
374 const char *error_if_any,
375 bool_Bool implicit_commit)
376{
377 Mgmtd__FeMessage fe_msg;
378 Mgmtd__FeSetConfigReply setcfg_reply;
379
380 assert(session->adapter)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 380, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "session->adapter", }; static const
struct xref * const xref_p_87 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((session->adapter
) ? 0 : 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0
)); } while (session->adapter); })
;
381
382 if (implicit_commit && session->cfg_txn_id)
383 mgmt_fe_session_register_event(
384 session, MGMTD_FE_SESSION_CFG_TXN_CLNUP);
385
386 mgmtd__fe_set_config_reply__init(&setcfg_reply);
387 setcfg_reply.session_id = session->session_id;
388 setcfg_reply.ds_id = ds_id;
389 setcfg_reply.req_id = req_id;
390 setcfg_reply.success = success;
391 setcfg_reply.implicit_commit = implicit_commit;
392 if (error_if_any)
393 setcfg_reply.error_if_any = (char *)error_if_any;
394
395 mgmtd__fe_message__init(&fe_msg);
396 fe_msg.message_case = MGMTD__FE_MESSAGE__MESSAGE_SETCFG_REPLY;
397 fe_msg.setcfg_reply = &setcfg_reply;
398
399 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 401, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_88 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
400 "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 401, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_88 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
401 session->adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 401, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_88 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending SETCFG_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
;
402
403 if (implicit_commit) {
404 if (mm->perf_stats_en)
405 gettimeofday(&session->adapter->cmt_stats.last_end,
406 NULL((void*)0));
407 mgmt_fe_session_compute_commit_timers(
408 &session->adapter->cmt_stats);
409 }
410
411 if (mm->perf_stats_en)
412 gettimeofday(&session->adapter->setcfg_stats.last_end, NULL((void*)0));
413 mgmt_fe_adapter_compute_set_cfg_timers(&session->adapter->setcfg_stats);
414
415 return fe_adapter_send_msg(session->adapter, &fe_msg, false0);
416}
417
418static int fe_adapter_send_commit_cfg_reply(
419 struct mgmt_fe_session_ctx *session, Mgmtd__DatastoreId src_ds_id,
420 Mgmtd__DatastoreId dst_ds_id, uint64_t_uint64_t req_id, enum mgmt_result result,
421 bool_Bool validate_only, const char *error_if_any)
422{
423 Mgmtd__FeMessage fe_msg;
424 Mgmtd__FeCommitConfigReply commcfg_reply;
425
426 assert(session->adapter)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 426, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "session->adapter", }; static const
struct xref * const xref_p_89 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((session->adapter
) ? 0 : 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0
)); } while (session->adapter); })
;
427
428 mgmtd__fe_commit_config_reply__init(&commcfg_reply);
429 commcfg_reply.session_id = session->session_id;
430 commcfg_reply.src_ds_id = src_ds_id;
431 commcfg_reply.dst_ds_id = dst_ds_id;
432 commcfg_reply.req_id = req_id;
433 commcfg_reply.success =
434 (result == MGMTD_SUCCESS || result == MGMTD_NO_CFG_CHANGES)
435 ? true1
436 : false0;
437 commcfg_reply.validate_only = validate_only;
438 if (error_if_any)
439 commcfg_reply.error_if_any = (char *)error_if_any;
440
441 mgmtd__fe_message__init(&fe_msg);
442 fe_msg.message_case = MGMTD__FE_MESSAGE__MESSAGE_COMMCFG_REPLY;
443 fe_msg.commcfg_reply = &commcfg_reply;
444
445 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 447, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_90 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
446 "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 447, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_90 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
447 session->adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 447, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_90 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending COMMIT_CONFIG_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
;
448
449 /*
450 * Cleanup the CONFIG transaction associated with this session.
451 */
452 if (session->cfg_txn_id
453 && ((result == MGMTD_SUCCESS && !validate_only)
454 || (result == MGMTD_NO_CFG_CHANGES)))
455 mgmt_fe_session_register_event(
456 session, MGMTD_FE_SESSION_CFG_TXN_CLNUP);
457
458 if (mm->perf_stats_en)
459 gettimeofday(&session->adapter->cmt_stats.last_end, NULL((void*)0));
460 mgmt_fe_session_compute_commit_timers(&session->adapter->cmt_stats);
461 return fe_adapter_send_msg(session->adapter, &fe_msg, false0);
462}
463
464static int fe_adapter_send_get_reply(struct mgmt_fe_session_ctx *session,
465 Mgmtd__DatastoreId ds_id, uint64_t_uint64_t req_id,
466 bool_Bool success, Mgmtd__YangDataReply *data,
467 const char *error_if_any)
468{
469 Mgmtd__FeMessage fe_msg;
470 Mgmtd__FeGetReply get_reply;
471
472 assert(session->adapter)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 472, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "session->adapter", }; static const
struct xref * const xref_p_91 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((session->adapter
) ? 0 : 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0
)); } while (session->adapter); })
;
473
474 mgmtd__fe_get_reply__init(&get_reply);
475 get_reply.session_id = session->session_id;
476 get_reply.ds_id = ds_id;
477 get_reply.req_id = req_id;
478 get_reply.success = success;
479 get_reply.data = data;
480 if (error_if_any)
481 get_reply.error_if_any = (char *)error_if_any;
482
483 mgmtd__fe_message__init(&fe_msg);
484 fe_msg.message_case = MGMTD__FE_MESSAGE__MESSAGE_GET_REPLY;
485 fe_msg.get_reply = &get_reply;
486
487 MGMTD_FE_ADAPTER_DBG("Sending GET_REPLY message to MGMTD Frontend client '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending GET_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 488, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending GET_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_92 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending GET_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
488 session->adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending GET_REPLY message to MGMTD Frontend client '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 488, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Sending GET_REPLY message to MGMTD Frontend client '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, session->adapter->name"
), }; static const struct xref * const xref_p_92 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending GET_REPLY message to MGMTD Frontend client '%s'"
), __func__, session->adapter->name); } while (0); } while
(0)
;
489
490 /*
491 * Cleanup the SHOW transaction associated with this session.
492 */
493 if (session->txn_id && (!success || (data && data->next_indx < 0)))
494 mgmt_fe_session_register_event(session,
495 MGMTD_FE_SESSION_SHOW_TXN_CLNUP);
496
497 return fe_adapter_send_msg(session->adapter, &fe_msg, false0);
498}
499
500static int fe_adapter_send_error(struct mgmt_fe_session_ctx *session,
501 uint64_t_uint64_t req_id, bool_Bool short_circuit_ok,
502 int16_t error, const char *errfmt, ...)
503 PRINTFRR(5, 6)__attribute__((format(printf, 5, 6)));
504
505static int fe_adapter_send_error(struct mgmt_fe_session_ctx *session,
506 uint64_t_uint64_t req_id, bool_Bool short_circuit_ok,
507 int16_t error, const char *errfmt, ...)
508{
509 va_list ap;
510 int ret;
511
512 va_start(ap, errfmt)__builtin_va_start(ap, errfmt);
513 ret = vmgmt_msg_native_send_error(session->adapter->conn,
514 session->session_id, req_id,
515 short_circuit_ok, error, errfmt, ap);
516 va_end(ap)__builtin_va_end(ap);
517
518 return ret;
519}
520
521
522static void mgmt_fe_session_cfg_txn_clnup(struct event *thread)
523{
524 struct mgmt_fe_session_ctx *session;
525
526 session = (struct mgmt_fe_session_ctx *)EVENT_ARG(thread)((thread)->arg);
527
528 mgmt_fe_session_cfg_txn_cleanup(session);
529}
530
531static void mgmt_fe_session_show_txn_clnup(struct event *thread)
532{
533 struct mgmt_fe_session_ctx *session;
534
535 session = (struct mgmt_fe_session_ctx *)EVENT_ARG(thread)((thread)->arg);
536
537 mgmt_fe_session_show_txn_cleanup(session);
538}
539
540static void
541mgmt_fe_session_register_event(struct mgmt_fe_session_ctx *session,
542 enum mgmt_session_event event)
543{
544 struct timeval tv = {.tv_sec = 0,
545 .tv_usec = MGMTD_FE_MSG_PROC_DELAY_USEC10};
546
547 switch (event) {
548 case MGMTD_FE_SESSION_CFG_TXN_CLNUP:
549 event_add_timer_tv(mgmt_loop, mgmt_fe_session_cfg_txn_clnup,({ static const struct xref_eventsched _xref __attribute__( (
used)) = { .xref = { (((void*)0)), (XREFT_EVENTSCHED), 550, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .funcname = "mgmt_fe_session_cfg_txn_clnup", .
dest = "&session->proc_cfg_txn_clnp", .event_type = EVENT_TIMER
, }; static const struct xref * const xref_p_93 __attribute__
((used, section("xref_array"))) = &(_xref.xref); _event_add_timer_tv
(&_xref, mgmt_loop, mgmt_fe_session_cfg_txn_clnup, session
, &tv, &session->proc_cfg_txn_clnp); })
550 session, &tv, &session->proc_cfg_txn_clnp)({ static const struct xref_eventsched _xref __attribute__( (
used)) = { .xref = { (((void*)0)), (XREFT_EVENTSCHED), 550, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .funcname = "mgmt_fe_session_cfg_txn_clnup", .
dest = "&session->proc_cfg_txn_clnp", .event_type = EVENT_TIMER
, }; static const struct xref * const xref_p_93 __attribute__
((used, section("xref_array"))) = &(_xref.xref); _event_add_timer_tv
(&_xref, mgmt_loop, mgmt_fe_session_cfg_txn_clnup, session
, &tv, &session->proc_cfg_txn_clnp); })
;
551 break;
552 case MGMTD_FE_SESSION_SHOW_TXN_CLNUP:
553 event_add_timer_tv(mgmt_loop, mgmt_fe_session_show_txn_clnup,({ static const struct xref_eventsched _xref __attribute__( (
used)) = { .xref = { (((void*)0)), (XREFT_EVENTSCHED), 554, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .funcname = "mgmt_fe_session_show_txn_clnup", .
dest = "&session->proc_show_txn_clnp", .event_type = EVENT_TIMER
, }; static const struct xref * const xref_p_94 __attribute__
((used, section("xref_array"))) = &(_xref.xref); _event_add_timer_tv
(&_xref, mgmt_loop, mgmt_fe_session_show_txn_clnup, session
, &tv, &session->proc_show_txn_clnp); })
554 session, &tv, &session->proc_show_txn_clnp)({ static const struct xref_eventsched _xref __attribute__( (
used)) = { .xref = { (((void*)0)), (XREFT_EVENTSCHED), 554, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .funcname = "mgmt_fe_session_show_txn_clnup", .
dest = "&session->proc_show_txn_clnp", .event_type = EVENT_TIMER
, }; static const struct xref * const xref_p_94 __attribute__
((used, section("xref_array"))) = &(_xref.xref); _event_add_timer_tv
(&_xref, mgmt_loop, mgmt_fe_session_show_txn_clnup, session
, &tv, &session->proc_show_txn_clnp); })
;
555 break;
556 }
557}
558
559static struct mgmt_fe_client_adapter *
560mgmt_fe_find_adapter_by_fd(int conn_fd)
561{
562 struct mgmt_fe_client_adapter *adapter;
563
564 FOREACH_ADAPTER_IN_LIST (adapter)for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((adapter) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (adapter); (adapter) = mgmt_fe_adapters_safe
, mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe(&mgmt_fe_adapters
, mgmt_fe_adapters_safe))
{
565 if (adapter->conn->fd == conn_fd)
566 return adapter;
567 }
568
569 return NULL((void*)0);
570}
571
572static void mgmt_fe_adapter_delete(struct mgmt_fe_client_adapter *adapter)
573{
574 struct mgmt_fe_session_ctx *session;
575 MGMTD_FE_ADAPTER_DBG("deleting client adapter '%s'", adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "deleting client adapter '%s'")
, .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 575, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "deleting client adapter '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_95 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "deleting client adapter '%s'"
), __func__, adapter->name); } while (0); } while (0)
;
576
577 /* TODO: notify about client disconnect for appropriate cleanup */
578 FOREACH_SESSION_IN_LIST (adapter, session)for (typeof(mgmt_fe_sessions_next_safe(&(adapter)->fe_sessions
, ((void*)0))) mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe
(&(adapter)->fe_sessions, ((session) = mgmt_fe_sessions_first
(&(adapter)->fe_sessions))); (session); (session) = mgmt_fe_sessions_safe
, mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe(&(adapter
)->fe_sessions, mgmt_fe_sessions_safe))
579 mgmt_fe_cleanup_session(&session);
580 mgmt_fe_sessions_fini(&adapter->fe_sessions);
581
582 assert(adapter->refcount == 1)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 582, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "adapter->refcount == 1", }; static
const struct xref * const xref_p_96 __attribute__((used, section
("xref_array"))) = &(_xref.xref); if (__builtin_expect((adapter
->refcount == 1) ? 0 : 1, 0)) do { _zlog_assert_failed(&
_xref, ((void*)0)); } while (adapter->refcount == 1); })
;
583 mgmt_fe_adapter_unlock(&adapter);
584}
585
586static int mgmt_fe_adapter_notify_disconnect(struct msg_conn *conn)
587{
588 struct mgmt_fe_client_adapter *adapter = conn->user;
589
590 MGMTD_FE_ADAPTER_DBG("notify disconnect for client adapter '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "notify disconnect for client adapter '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 591, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "notify disconnect for client adapter '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_97 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "notify disconnect for client adapter '%s'"
), __func__, adapter->name); } while (0); } while (0)
591 adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "notify disconnect for client adapter '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 591, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "notify disconnect for client adapter '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_97 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "notify disconnect for client adapter '%s'"
), __func__, adapter->name); } while (0); } while (0)
;
592
593 mgmt_fe_adapter_delete(adapter);
594
595 return 0;
596}
597
598/*
599 * Purge any old connections that share the same client name with `adapter`
600 */
601static void
602mgmt_fe_adapter_cleanup_old_conn(struct mgmt_fe_client_adapter *adapter)
603{
604 struct mgmt_fe_client_adapter *old;
605
606 FOREACH_ADAPTER_IN_LIST (old)for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((old) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (old); (old) = mgmt_fe_adapters_safe, mgmt_fe_adapters_safe
= mgmt_fe_adapters_next_safe(&mgmt_fe_adapters, mgmt_fe_adapters_safe
))
{
607 if (old == adapter)
608 continue;
609 if (strncmp(adapter->name, old->name, sizeof(adapter->name)))
610 continue;
611
612 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 615, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name, adapter->conn->fd, old->conn->fd"
), }; static const struct xref * const xref_p_98 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), __func__, adapter->name, adapter->conn->fd, old->
conn->fd); } while (0); } while (0)
613 "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 615, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name, adapter->conn->fd, old->conn->fd"
), }; static const struct xref * const xref_p_98 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), __func__, adapter->name, adapter->conn->fd, old->
conn->fd); } while (0); } while (0)
614 adapter->name, adapter->conn->fd,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 615, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name, adapter->conn->fd, old->conn->fd"
), }; static const struct xref * const xref_p_98 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), __func__, adapter->name, adapter->conn->fd, old->
conn->fd); } while (0); } while (0)
615 old->conn->fd)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 615, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name, adapter->conn->fd, old->conn->fd"
), }; static const struct xref * const xref_p_98 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Client '%s' (FD:%d) seems to have reconnected. Removing old connection (FD:%d)"
), __func__, adapter->name, adapter->conn->fd, old->
conn->fd); } while (0); } while (0)
;
616 msg_conn_disconnect(old->conn, false0);
617 }
618}
619
620static int
621mgmt_fe_session_handle_lockds_req_msg(struct mgmt_fe_session_ctx *session,
622 Mgmtd__FeLockDsReq *lockds_req)
623{
624 struct mgmt_ds_ctx *ds_ctx;
625
626 if (lockds_req->ds_id != MGMTD_DS_CANDIDATEMGMTD__DATASTORE_ID__CANDIDATE_DS &&
627 lockds_req->ds_id != MGMTD_DS_RUNNINGMGMTD__DATASTORE_ID__RUNNING_DS) {
628 fe_adapter_send_lockds_reply(
629 session, lockds_req->ds_id, lockds_req->req_id,
630 lockds_req->lock, false0,
631 "Lock/Unlock on DS other than candidate or running DS not supported");
632 return -1;
633 }
634
635 ds_ctx = mgmt_ds_get_ctx_by_id(mm, lockds_req->ds_id);
636 if (!ds_ctx) {
637 fe_adapter_send_lockds_reply(session, lockds_req->ds_id,
638 lockds_req->req_id,
639 lockds_req->lock, false0,
640 "Failed to retrieve handle for DS!");
641 return -1;
642 }
643
644 if (lockds_req->lock) {
645 if (mgmt_fe_session_write_lock_ds(lockds_req->ds_id, ds_ctx,
646 session)) {
647 fe_adapter_send_lockds_reply(
648 session, lockds_req->ds_id, lockds_req->req_id,
649 lockds_req->lock, false0,
650 "Lock already taken on DS by another session!");
651 return -1;
652 }
653 } else {
654 if (!session->ds_locked[lockds_req->ds_id]) {
655 fe_adapter_send_lockds_reply(
656 session, lockds_req->ds_id, lockds_req->req_id,
657 lockds_req->lock, false0,
658 "Lock on DS was not taken by this session!");
659 return 0;
660 }
661
662 mgmt_fe_session_unlock_ds(lockds_req->ds_id, ds_ctx, session);
663 }
664
665 if (fe_adapter_send_lockds_reply(session, lockds_req->ds_id,
666 lockds_req->req_id, lockds_req->lock,
667 true1, NULL((void*)0)) != 0) {
668 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 672, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, lockds_req->ds_id, session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_99 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), __func__, lockds_req->ds_id, session->
session_id, session->adapter->name); } while (0); } while
(0)
669 "Failed to send LOCK_DS_REPLY for DS %u session-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 672, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, lockds_req->ds_id, session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_99 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), __func__, lockds_req->ds_id, session->
session_id, session->adapter->name); } while (0); } while
(0)
670 " from %s",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 672, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, lockds_req->ds_id, session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_99 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), __func__, lockds_req->ds_id, session->
session_id, session->adapter->name); } while (0); } while
(0)
671 lockds_req->ds_id, session->session_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 672, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, lockds_req->ds_id, session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_99 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), __func__, lockds_req->ds_id, session->
session_id, session->adapter->name); } while (0); } while
(0)
672 session->adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 672, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), .priority = (7), .ec = (0), .args = ("__func__, lockds_req->ds_id, session->session_id, session->adapter->name"
), }; static const struct xref * const xref_p_99 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to send LOCK_DS_REPLY for DS %u session-id: %"
"llu" " from %s"), __func__, lockds_req->ds_id, session->
session_id, session->adapter->name); } while (0); } while
(0)
;
673 }
674
675 return 0;
676}
677
678/*
679 * TODO: this function has too many conditionals relating to complex error
680 * conditions. It needs to be simplified and these complex error conditions
681 * probably need to just disconnect the client with a suitably loud log message.
682 */
683static int
684mgmt_fe_session_handle_setcfg_req_msg(struct mgmt_fe_session_ctx *session,
685 Mgmtd__FeSetConfigReq *setcfg_req)
686{
687 struct mgmt_ds_ctx *ds_ctx, *dst_ds_ctx = NULL((void*)0);
688 bool_Bool txn_created = false0;
689
690 if (mm->perf_stats_en)
691 gettimeofday(&session->adapter->setcfg_stats.last_start, NULL((void*)0));
692
693 /* MGMTD currently only supports editing the candidate DS. */
694 if (setcfg_req->ds_id != MGMTD_DS_CANDIDATEMGMTD__DATASTORE_ID__CANDIDATE_DS) {
695 fe_adapter_send_set_cfg_reply(
696 session, setcfg_req->ds_id, setcfg_req->req_id, false0,
697 "Set-Config on datastores other than Candidate DS not supported",
698 setcfg_req->implicit_commit);
699 return 0;
700 }
701 ds_ctx = mgmt_ds_get_ctx_by_id(mm, setcfg_req->ds_id);
702 assert(ds_ctx)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 702, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "ds_ctx", }; static const struct xref *
const xref_p_100 __attribute__((used, section("xref_array"))
) = &(_xref.xref); if (__builtin_expect((ds_ctx) ? 0 : 1,
0)) do { _zlog_assert_failed(&_xref, ((void*)0)); } while
(ds_ctx); })
;
703
704 /* MGMTD currently only supports targetting the running DS. */
705 if (setcfg_req->implicit_commit &&
706 setcfg_req->commit_ds_id != MGMTD_DS_RUNNINGMGMTD__DATASTORE_ID__RUNNING_DS) {
707 fe_adapter_send_set_cfg_reply(
708 session, setcfg_req->ds_id, setcfg_req->req_id, false0,
709 "Implicit commit on datastores other than running DS not supported",
710 setcfg_req->implicit_commit);
711 return 0;
712 }
713 dst_ds_ctx = mgmt_ds_get_ctx_by_id(mm, setcfg_req->commit_ds_id);
714 assert(dst_ds_ctx)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 714, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "dst_ds_ctx", }; static const struct xref
* const xref_p_101 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((dst_ds_ctx) ? 0
: 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0)); }
while (dst_ds_ctx); })
;
715
716 /* User should have write lock to change the DS */
717 if (!session->ds_locked[setcfg_req->ds_id]) {
718 fe_adapter_send_set_cfg_reply(session, setcfg_req->ds_id,
719 setcfg_req->req_id, false0,
720 "Candidate DS is not locked",
721 setcfg_req->implicit_commit);
722 return 0;
723 }
724
725 if (session->cfg_txn_id == MGMTD_TXN_ID_NONE0) {
726 /* as we have the lock no-one else should have a config txn */
727 assert(mgmt_config_txn_in_progress() == MGMTD_SESSION_ID_NONE)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 727, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "mgmt_config_txn_in_progress() == MGMTD_SESSION_ID_NONE"
, }; static const struct xref * const xref_p_102 __attribute__
((used, section("xref_array"))) = &(_xref.xref); if (__builtin_expect
((mgmt_config_txn_in_progress() == 0) ? 0 : 1, 0)) do { _zlog_assert_failed
(&_xref, ((void*)0)); } while (mgmt_config_txn_in_progress
() == 0); })
;
728
729 /* Start a CONFIG Transaction (if not started already) */
730 session->cfg_txn_id = mgmt_create_txn(session->session_id,
731 MGMTD_TXN_TYPE_CONFIG);
732 if (session->cfg_txn_id == MGMTD_SESSION_ID_NONE0) {
733 fe_adapter_send_set_cfg_reply(
734 session, setcfg_req->ds_id, setcfg_req->req_id,
735 false0,
736 "Failed to create a Configuration session!",
737 setcfg_req->implicit_commit);
738 return 0;
739 }
740 txn_created = true1;
741
742 MGMTD_FE_ADAPTER_DBG("Created new Config txn-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new Config txn-id: %" "llu"
" for session-id %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 744, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new Config txn-id: %"
"llu" " for session-id %" "llu"), .priority = (7), .ec = (0)
, .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_103 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new Config txn-id: %"
"llu" " for session-id %" "llu"), __func__, session->cfg_txn_id
, session->session_id); } while (0); } while (0)
743 " for session-id %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new Config txn-id: %" "llu"
" for session-id %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 744, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new Config txn-id: %"
"llu" " for session-id %" "llu"), .priority = (7), .ec = (0)
, .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_103 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new Config txn-id: %"
"llu" " for session-id %" "llu"), __func__, session->cfg_txn_id
, session->session_id); } while (0); } while (0)
744 session->cfg_txn_id, session->session_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new Config txn-id: %" "llu"
" for session-id %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 744, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new Config txn-id: %"
"llu" " for session-id %" "llu"), .priority = (7), .ec = (0)
, .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_103 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new Config txn-id: %"
"llu" " for session-id %" "llu"), __func__, session->cfg_txn_id
, session->session_id); } while (0); } while (0)
;
745 } else {
746 MGMTD_FE_ADAPTER_DBG("Config txn-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 749, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Config txn-id: %"
"llu" " for session-id: %" "llu" " already created"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_104 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), __func__, session->cfg_txn_id,
session->session_id); } while (0); } while (0)
747 " for session-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 749, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Config txn-id: %"
"llu" " for session-id: %" "llu" " already created"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_104 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), __func__, session->cfg_txn_id,
session->session_id); } while (0); } while (0)
748 " already created",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 749, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Config txn-id: %"
"llu" " for session-id: %" "llu" " already created"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_104 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), __func__, session->cfg_txn_id,
session->session_id); } while (0); } while (0)
749 session->cfg_txn_id, session->session_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 749, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Config txn-id: %"
"llu" " for session-id: %" "llu" " already created"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_104 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Config txn-id: %" "llu" " for session-id: %"
"llu" " already created"), __func__, session->cfg_txn_id,
session->session_id); } while (0); } while (0)
;
750
751 if (setcfg_req->implicit_commit) {
752 /*
753 * In this scenario need to skip cleanup of the txn,
754 * so setting implicit commit to false.
755 */
756 fe_adapter_send_set_cfg_reply(
757 session, setcfg_req->ds_id, setcfg_req->req_id,
758 false0,
759 "A Configuration transaction is already in progress!",
760 false0);
761 return 0;
762 }
763 }
764
765 /* Create the SETConfig request under the transaction. */
766 if (mgmt_txn_send_set_config_req(session->cfg_txn_id, setcfg_req->req_id,
767 setcfg_req->ds_id, ds_ctx,
768 setcfg_req->data, setcfg_req->n_data,
769 setcfg_req->implicit_commit,
770 setcfg_req->commit_ds_id,
771 dst_ds_ctx) != 0) {
772 fe_adapter_send_set_cfg_reply(session, setcfg_req->ds_id,
773 setcfg_req->req_id, false0,
774 "Request processing for SET-CONFIG failed!",
775 setcfg_req->implicit_commit);
776
777 /* delete transaction if we just created it */
778 if (txn_created)
779 mgmt_destroy_txn(&session->cfg_txn_id);
780 }
781
782 return 0;
783}
784
785static int mgmt_fe_session_handle_get_req_msg(struct mgmt_fe_session_ctx *session,
786 Mgmtd__FeGetReq *get_req)
787{
788 struct mgmt_ds_ctx *ds_ctx;
789 struct nb_config *cfg_root = NULL((void*)0);
790 Mgmtd__DatastoreId ds_id = get_req->ds_id;
791 uint64_t_uint64_t req_id = get_req->req_id;
792
793 if (ds_id != MGMTD_DS_CANDIDATEMGMTD__DATASTORE_ID__CANDIDATE_DS && ds_id != MGMTD_DS_RUNNINGMGMTD__DATASTORE_ID__RUNNING_DS) {
794 fe_adapter_send_get_reply(session, ds_id, req_id, false0, NULL((void*)0),
795 "get-req on unsupported datastore");
796 return 0;
797 }
798 ds_ctx = mgmt_ds_get_ctx_by_id(mm, ds_id);
799 assert(ds_ctx)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 799, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "ds_ctx", }; static const struct xref *
const xref_p_105 __attribute__((used, section("xref_array"))
) = &(_xref.xref); if (__builtin_expect((ds_ctx) ? 0 : 1,
0)) do { _zlog_assert_failed(&_xref, ((void*)0)); } while
(ds_ctx); })
;
800
801 if (session->txn_id == MGMTD_TXN_ID_NONE0) {
802 /*
803 * Start a SHOW Transaction (if not started already)
804 */
805 session->txn_id = mgmt_create_txn(session->session_id,
806 MGMTD_TXN_TYPE_SHOW);
807 if (session->txn_id == MGMTD_SESSION_ID_NONE0) {
808 fe_adapter_send_get_reply(session, ds_id, req_id, false0,
809 NULL((void*)0),
810 "Failed to create a Show transaction!");
811 return -1;
812 }
813
814 MGMTD_FE_ADAPTER_DBG("Created new show txn-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new show txn-id: %" "llu"
" for session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 816, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), .priority = (7), .ec = (0
), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_106 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
815 " for session-id: %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new show txn-id: %" "llu"
" for session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 816, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), .priority = (7), .ec = (0
), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_106 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
816 session->txn_id, session->session_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new show txn-id: %" "llu"
" for session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 816, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), .priority = (7), .ec = (0
), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_106 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
;
817 } else {
818 fe_adapter_send_get_reply(session, ds_id, req_id, false0, NULL((void*)0),
819 "Request processing for GET failed!");
820 MGMTD_FE_ADAPTER_DBG("Transaction in progress txn-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Transaction in progress txn-id: %"
"llu" " for session-id: %" "llu"), .hashu32 = {(7), (0)}, },
}; static const struct xref_logmsg _xref __attribute__( (used
)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 822
, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring = ("FE-ADAPTER: %s: "
"Transaction in progress txn-id: %" "llu" " for session-id: %"
"llu"), .priority = (7), .ec = (0), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_107 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Transaction in progress txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
821 " for session-id: %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Transaction in progress txn-id: %"
"llu" " for session-id: %" "llu"), .hashu32 = {(7), (0)}, },
}; static const struct xref_logmsg _xref __attribute__( (used
)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 822
, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring = ("FE-ADAPTER: %s: "
"Transaction in progress txn-id: %" "llu" " for session-id: %"
"llu"), .priority = (7), .ec = (0), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_107 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Transaction in progress txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
822 session->txn_id, session->session_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Transaction in progress txn-id: %"
"llu" " for session-id: %" "llu"), .hashu32 = {(7), (0)}, },
}; static const struct xref_logmsg _xref __attribute__( (used
)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 822
, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring = ("FE-ADAPTER: %s: "
"Transaction in progress txn-id: %" "llu" " for session-id: %"
"llu"), .priority = (7), .ec = (0), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_107 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Transaction in progress txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
;
823 return -1;
824 }
825
826 /*
827 * Get a copy of the datastore config root, avoids locking.
828 */
829 cfg_root = nb_config_dup(mgmt_ds_get_nb_config(ds_ctx));
830
831 /*
832 * Create a GET request under the transaction.
833 */
834 if (mgmt_txn_send_get_req(session->txn_id, req_id, ds_id, cfg_root,
835 get_req->data, get_req->n_data)) {
836 fe_adapter_send_get_reply(session, ds_id, req_id, false0, NULL((void*)0),
837 "Request processing for GET failed!");
838
839 goto failed;
840 }
841
842 return 0;
843failed:
844 if (cfg_root)
845 nb_config_free(cfg_root);
846 /*
847 * Destroy the transaction created recently.
848 */
849 if (session->txn_id != MGMTD_TXN_ID_NONE0)
850 mgmt_destroy_txn(&session->txn_id);
851
852 return -1;
853}
854
855
856static int mgmt_fe_session_handle_commit_config_req_msg(
857 struct mgmt_fe_session_ctx *session,
858 Mgmtd__FeCommitConfigReq *commcfg_req)
859{
860 struct mgmt_ds_ctx *src_ds_ctx, *dst_ds_ctx;
861
862 if (mm->perf_stats_en)
863 gettimeofday(&session->adapter->cmt_stats.last_start, NULL((void*)0));
864 session->adapter->cmt_stats.commit_cnt++;
865
866 /* Validate source and dest DS */
867 if (commcfg_req->src_ds_id != MGMTD_DS_CANDIDATEMGMTD__DATASTORE_ID__CANDIDATE_DS ||
868 commcfg_req->dst_ds_id != MGMTD_DS_RUNNINGMGMTD__DATASTORE_ID__RUNNING_DS) {
869 fe_adapter_send_commit_cfg_reply(
870 session, commcfg_req->src_ds_id, commcfg_req->dst_ds_id,
871 commcfg_req->req_id, MGMTD_INTERNAL_ERROR,
872 commcfg_req->validate_only,
873 "Source/Dest for commit must be candidate/running DS");
874 return 0;
875 }
876 src_ds_ctx = mgmt_ds_get_ctx_by_id(mm, commcfg_req->src_ds_id);
877 assert(src_ds_ctx)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 877, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "src_ds_ctx", }; static const struct xref
* const xref_p_108 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((src_ds_ctx) ? 0
: 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0)); }
while (src_ds_ctx); })
;
878 dst_ds_ctx = mgmt_ds_get_ctx_by_id(mm, commcfg_req->dst_ds_id);
879 assert(dst_ds_ctx)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 879, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "dst_ds_ctx", }; static const struct xref
* const xref_p_109 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((dst_ds_ctx) ? 0
: 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0)); }
while (dst_ds_ctx); })
;
880
881 /* User should have lock on both source and dest DS */
882 if (!session->ds_locked[commcfg_req->dst_ds_id] ||
883 !session->ds_locked[commcfg_req->src_ds_id]) {
884 fe_adapter_send_commit_cfg_reply(
885 session, commcfg_req->src_ds_id, commcfg_req->dst_ds_id,
886 commcfg_req->req_id, MGMTD_DS_LOCK_FAILED,
887 commcfg_req->validate_only,
888 "Commit requires lock on candidate and/or running DS");
889 return 0;
890 }
891
892 if (session->cfg_txn_id == MGMTD_TXN_ID_NONE0) {
893 /*
894 * Start a CONFIG Transaction (if not started already)
895 */
896 session->cfg_txn_id = mgmt_create_txn(session->session_id,
897 MGMTD_TXN_TYPE_CONFIG);
898 if (session->cfg_txn_id == MGMTD_SESSION_ID_NONE0) {
899 fe_adapter_send_commit_cfg_reply(
900 session, commcfg_req->src_ds_id,
901 commcfg_req->dst_ds_id, commcfg_req->req_id,
902 MGMTD_INTERNAL_ERROR, commcfg_req->validate_only,
903 "Failed to create a Configuration session!");
904 return 0;
905 }
906 MGMTD_FE_ADAPTER_DBG("Created txn-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 909, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created txn-id: %"
"llu" " for session-id %" "llu" " for COMMIT-CFG-REQ"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_110 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), __func__, session->cfg_txn_id
, session->session_id); } while (0); } while (0)
907 " for session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 909, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created txn-id: %"
"llu" " for session-id %" "llu" " for COMMIT-CFG-REQ"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_110 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), __func__, session->cfg_txn_id
, session->session_id); } while (0); } while (0)
908 " for COMMIT-CFG-REQ",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 909, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created txn-id: %"
"llu" " for session-id %" "llu" " for COMMIT-CFG-REQ"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_110 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), __func__, session->cfg_txn_id
, session->session_id); } while (0); } while (0)
909 session->cfg_txn_id, session->session_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 909, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created txn-id: %"
"llu" " for session-id %" "llu" " for COMMIT-CFG-REQ"), .priority
= (7), .ec = (0), .args = ("__func__, session->cfg_txn_id, session->session_id"
), }; static const struct xref * const xref_p_110 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created txn-id: %" "llu" " for session-id %"
"llu" " for COMMIT-CFG-REQ"), __func__, session->cfg_txn_id
, session->session_id); } while (0); } while (0)
;
910 }
911
912 /*
913 * Create COMMITConfig request under the transaction
914 */
915 if (mgmt_txn_send_commit_config_req(
916 session->cfg_txn_id, commcfg_req->req_id,
917 commcfg_req->src_ds_id, src_ds_ctx, commcfg_req->dst_ds_id,
918 dst_ds_ctx, commcfg_req->validate_only, commcfg_req->abort,
919 false0) != 0) {
920 fe_adapter_send_commit_cfg_reply(
921 session, commcfg_req->src_ds_id, commcfg_req->dst_ds_id,
922 commcfg_req->req_id, MGMTD_INTERNAL_ERROR,
923 commcfg_req->validate_only,
924 "Request processing for COMMIT-CONFIG failed!");
925 return 0;
926 }
927
928 return 0;
929}
930
931static int
932mgmt_fe_adapter_handle_msg(struct mgmt_fe_client_adapter *adapter,
933 Mgmtd__FeMessage *fe_msg)
934{
935 struct mgmt_fe_session_ctx *session;
936
937 /*
938 * protobuf-c adds a max size enum with an internal, and changing by
939 * version, name; cast to an int to avoid unhandled enum warnings
940 */
941 switch ((int)fe_msg->message_case) {
942 case MGMTD__FE_MESSAGE__MESSAGE_REGISTER_REQ:
943 MGMTD_FE_ADAPTER_DBG("Got REGISTER_REQ from '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got REGISTER_REQ from '%s'"), .
hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg _xref
__attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 944, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Got REGISTER_REQ from '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->register_req->client_name"
), }; static const struct xref * const xref_p_111 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got REGISTER_REQ from '%s'"
), __func__, fe_msg->register_req->client_name); } while
(0); } while (0)
944 fe_msg->register_req->client_name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got REGISTER_REQ from '%s'"), .
hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg _xref
__attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 944, "mgmtd/mgmt_fe_adapter.c", __func__, }
, .fmtstring = ("FE-ADAPTER: %s: " "Got REGISTER_REQ from '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->register_req->client_name"
), }; static const struct xref * const xref_p_111 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got REGISTER_REQ from '%s'"
), __func__, fe_msg->register_req->client_name); } while
(0); } while (0)
;
945
946 if (strlen(fe_msg->register_req->client_name)) {
947 strlcpy(adapter->name,
948 fe_msg->register_req->client_name,
949 sizeof(adapter->name));
950 mgmt_fe_adapter_cleanup_old_conn(adapter);
951 }
952 break;
953 case MGMTD__FE_MESSAGE__MESSAGE_SESSION_REQ:
954 if (fe_msg->session_req->create
955 && fe_msg->session_req->id_case
956 == MGMTD__FE_SESSION_REQ__ID_CLIENT_CONN_ID) {
957 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 961, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->client_conn_id, adapter->name"
), }; static const struct xref * const xref_p_112 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), __func__, fe_msg->session_req->client_conn_id
, adapter->name); } while (0); } while (0)
958 "Got SESSION_REQ (create) for client-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 961, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->client_conn_id, adapter->name"
), }; static const struct xref * const xref_p_112 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), __func__, fe_msg->session_req->client_conn_id
, adapter->name); } while (0); } while (0)
959 " from '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 961, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->client_conn_id, adapter->name"
), }; static const struct xref * const xref_p_112 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), __func__, fe_msg->session_req->client_conn_id
, adapter->name); } while (0); } while (0)
960 fe_msg->session_req->client_conn_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 961, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->client_conn_id, adapter->name"
), }; static const struct xref * const xref_p_112 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), __func__, fe_msg->session_req->client_conn_id
, adapter->name); } while (0); } while (0)
961 adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 961, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->client_conn_id, adapter->name"
), }; static const struct xref * const xref_p_112 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (create) for client-id %"
"llu" " from '%s'"), __func__, fe_msg->session_req->client_conn_id
, adapter->name); } while (0); } while (0)
;
962
963 session = mgmt_fe_create_session(
964 adapter, fe_msg->session_req->client_conn_id);
965 fe_adapter_send_session_reply(adapter, session, true1,
966 session ? true1 : false0);
967 } else if (
968 !fe_msg->session_req->create
969 && fe_msg->session_req->id_case
970 == MGMTD__FE_SESSION_REQ__ID_SESSION_ID) {
971 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 974, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_113 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), __func__, fe_msg->session_req->session_id
, adapter->name); } while (0); } while (0)
972 "Got SESSION_REQ (destroy) for session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 974, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_113 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), __func__, fe_msg->session_req->session_id
, adapter->name); } while (0); } while (0)
973 "from '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 974, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_113 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), __func__, fe_msg->session_req->session_id
, adapter->name); } while (0); } while (0)
974 fe_msg->session_req->session_id, adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 974, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->session_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_113 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SESSION_REQ (destroy) for session-id %"
"llu" "from '%s'"), __func__, fe_msg->session_req->session_id
, adapter->name); } while (0); } while (0)
;
975
976 session = mgmt_session_id2ctx(
977 fe_msg->session_req->session_id);
978 fe_adapter_send_session_reply(adapter, session, false0,
979 true1);
980 mgmt_fe_cleanup_session(&session);
981 }
982 break;
983 case MGMTD__FE_MESSAGE__MESSAGE_LOCKDS_REQ:
984 session = mgmt_session_id2ctx(
985 fe_msg->lockds_req->session_id);
986 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 991, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->lockds_req->lock ? \"\" : \"UN\", mgmt_ds_id2name(fe_msg->lockds_req->ds_id), fe_msg->lockds_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_114 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), __func__, fe_msg->lockds_req->lock
? "" : "UN", mgmt_ds_id2name(fe_msg->lockds_req->ds_id
), fe_msg->lockds_req->session_id, adapter->name); }
while (0); } while (0)
987 "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 991, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->lockds_req->lock ? \"\" : \"UN\", mgmt_ds_id2name(fe_msg->lockds_req->ds_id), fe_msg->lockds_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_114 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), __func__, fe_msg->lockds_req->lock
? "" : "UN", mgmt_ds_id2name(fe_msg->lockds_req->ds_id
), fe_msg->lockds_req->session_id, adapter->name); }
while (0); } while (0)
988 " from '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 991, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->lockds_req->lock ? \"\" : \"UN\", mgmt_ds_id2name(fe_msg->lockds_req->ds_id), fe_msg->lockds_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_114 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), __func__, fe_msg->lockds_req->lock
? "" : "UN", mgmt_ds_id2name(fe_msg->lockds_req->ds_id
), fe_msg->lockds_req->session_id, adapter->name); }
while (0); } while (0)
989 fe_msg->lockds_req->lock ? "" : "UN",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 991, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->lockds_req->lock ? \"\" : \"UN\", mgmt_ds_id2name(fe_msg->lockds_req->ds_id), fe_msg->lockds_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_114 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), __func__, fe_msg->lockds_req->lock
? "" : "UN", mgmt_ds_id2name(fe_msg->lockds_req->ds_id
), fe_msg->lockds_req->session_id, adapter->name); }
while (0); } while (0)
990 mgmt_ds_id2name(fe_msg->lockds_req->ds_id),do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 991, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->lockds_req->lock ? \"\" : \"UN\", mgmt_ds_id2name(fe_msg->lockds_req->ds_id), fe_msg->lockds_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_114 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), __func__, fe_msg->lockds_req->lock
? "" : "UN", mgmt_ds_id2name(fe_msg->lockds_req->ds_id
), fe_msg->lockds_req->session_id, adapter->name); }
while (0); } while (0)
991 fe_msg->lockds_req->session_id, adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 991, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, fe_msg->lockds_req->lock ? \"\" : \"UN\", mgmt_ds_id2name(fe_msg->lockds_req->ds_id), fe_msg->lockds_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_114 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got LOCKDS_REQ (%sLOCK) for DS:%s for session-id %"
"llu" " from '%s'"), __func__, fe_msg->lockds_req->lock
? "" : "UN", mgmt_ds_id2name(fe_msg->lockds_req->ds_id
), fe_msg->lockds_req->session_id, adapter->name); }
while (0); } while (0)
;
992 mgmt_fe_session_handle_lockds_req_msg(
993 session, fe_msg->lockds_req);
994 break;
995 case MGMTD__FE_MESSAGE__MESSAGE_SETCFG_REQ:
996 session = mgmt_session_id2ctx(
997 fe_msg->setcfg_req->session_id);
998 session->adapter->setcfg_stats.set_cfg_count++;
999 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1005, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, (int)fe_msg->setcfg_req->n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F', mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->setcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_115 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), __func__, (int)fe_msg->setcfg_req->
n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F'
, mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->
setcfg_req->session_id, adapter->name); } while (0); } while
(0)
1000 "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1005, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, (int)fe_msg->setcfg_req->n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F', mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->setcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_115 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), __func__, (int)fe_msg->setcfg_req->
n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F'
, mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->
setcfg_req->session_id, adapter->name); } while (0); } while
(0)
1001 " from '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1005, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, (int)fe_msg->setcfg_req->n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F', mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->setcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_115 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), __func__, (int)fe_msg->setcfg_req->
n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F'
, mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->
setcfg_req->session_id, adapter->name); } while (0); } while
(0)
1002 (int)fe_msg->setcfg_req->n_data,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1005, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, (int)fe_msg->setcfg_req->n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F', mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->setcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_115 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), __func__, (int)fe_msg->setcfg_req->
n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F'
, mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->
setcfg_req->session_id, adapter->name); } while (0); } while
(0)
1003 fe_msg->setcfg_req->implicit_commit ? 'T' : 'F',do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1005, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, (int)fe_msg->setcfg_req->n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F', mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->setcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_115 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), __func__, (int)fe_msg->setcfg_req->
n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F'
, mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->
setcfg_req->session_id, adapter->name); } while (0); } while
(0)
1004 mgmt_ds_id2name(fe_msg->setcfg_req->ds_id),do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1005, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, (int)fe_msg->setcfg_req->n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F', mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->setcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_115 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), __func__, (int)fe_msg->setcfg_req->
n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F'
, mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->
setcfg_req->session_id, adapter->name); } while (0); } while
(0)
1005 fe_msg->setcfg_req->session_id, adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1005, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, (int)fe_msg->setcfg_req->n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F', mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->setcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_115 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got SETCFG_REQ (%d Xpaths, Implicit:%c) on DS:%s for session-id %"
"llu" " from '%s'"), __func__, (int)fe_msg->setcfg_req->
n_data, fe_msg->setcfg_req->implicit_commit ? 'T' : 'F'
, mgmt_ds_id2name(fe_msg->setcfg_req->ds_id), fe_msg->
setcfg_req->session_id, adapter->name); } while (0); } while
(0)
;
1006
1007 mgmt_fe_session_handle_setcfg_req_msg(
1008 session, fe_msg->setcfg_req);
1009 break;
1010 case MGMTD__FE_MESSAGE__MESSAGE_COMMCFG_REQ:
1011 session = mgmt_session_id2ctx(
1012 fe_msg->commcfg_req->session_id);
1013 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1019, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_116 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->commcfg_req
->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id
), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req
->session_id, adapter->name); } while (0); } while (0)
1014 "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1019, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_116 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->commcfg_req
->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id
), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req
->session_id, adapter->name); } while (0); } while (0)
1015 " from '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1019, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_116 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->commcfg_req
->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id
), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req
->session_id, adapter->name); } while (0); } while (0)
1016 mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id),do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1019, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_116 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->commcfg_req
->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id
), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req
->session_id, adapter->name); } while (0); } while (0)
1017 mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id),do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1019, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_116 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->commcfg_req
->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id
), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req
->session_id, adapter->name); } while (0); } while (0)
1018 fe_msg->commcfg_req->abort ? 'T' : 'F',do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1019, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_116 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->commcfg_req
->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id
), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req
->session_id, adapter->name); } while (0); } while (0)
1019 fe_msg->commcfg_req->session_id, adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1019, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->commcfg_req->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_116 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got COMMCFG_REQ for src-DS:%s dst-DS:%s (Abort:%c) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->commcfg_req
->src_ds_id), mgmt_ds_id2name(fe_msg->commcfg_req->dst_ds_id
), fe_msg->commcfg_req->abort ? 'T' : 'F', fe_msg->commcfg_req
->session_id, adapter->name); } while (0); } while (0)
;
1020 mgmt_fe_session_handle_commit_config_req_msg(
1021 session, fe_msg->commcfg_req);
1022 break;
1023 case MGMTD__FE_MESSAGE__MESSAGE_GET_REQ:
1024 session = mgmt_session_id2ctx(fe_msg->get_req->session_id);
1025 MGMTD_FE_ADAPTER_DBG("Got GET_REQ for DS:%s (xpaths: %d) on session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1029, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->get_req->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_117 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->get_req
->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req
->session_id, adapter->name); } while (0); } while (0)
1026 " from '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1029, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->get_req->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_117 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->get_req
->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req
->session_id, adapter->name); } while (0); } while (0)
1027 mgmt_ds_id2name(fe_msg->get_req->ds_id),do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1029, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->get_req->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_117 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->get_req
->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req
->session_id, adapter->name); } while (0); } while (0)
1028 (int)fe_msg->get_req->n_data,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1029, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->get_req->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_117 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->get_req
->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req
->session_id, adapter->name); } while (0); } while (0)
1029 fe_msg->get_req->session_id, adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .hashu32 = {(7), (0)}, }, }; static const
struct xref_logmsg _xref __attribute__( (used)) = { .xref = {
(&_xrefdata.xrefdata), (XREFT_LOGMSG), 1029, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), .priority = (7), .ec = (0), .args = ("__func__, mgmt_ds_id2name(fe_msg->get_req->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req->session_id, adapter->name"
), }; static const struct xref * const xref_p_117 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Got GET_REQ for DS:%s (xpaths: %d) on session-id %"
"llu" " from '%s'"), __func__, mgmt_ds_id2name(fe_msg->get_req
->ds_id), (int)fe_msg->get_req->n_data, fe_msg->get_req
->session_id, adapter->name); } while (0); } while (0)
;
1030 mgmt_fe_session_handle_get_req_msg(session, fe_msg->get_req);
1031 break;
1032 case MGMTD__FE_MESSAGE__MESSAGE_NOTIFY_DATA_REQ:
1033 case MGMTD__FE_MESSAGE__MESSAGE_REGNOTIFY_REQ:
1034 MGMTD_FE_ADAPTER_ERR(do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Got unhandled message of type %u from '%s'"), .hashu32 = {(
3), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1036, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Got unhandled message of type %u from '%s'"
), .priority = (3), .ec = (0), .args = ("__func__, fe_msg->message_case, adapter->name"
), }; static const struct xref * const xref_p_118 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Got unhandled message of type %u from '%s'"
), __func__, fe_msg->message_case, adapter->name); } while
(0)
1035 "Got unhandled message of type %u from '%s'",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Got unhandled message of type %u from '%s'"), .hashu32 = {(
3), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1036, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Got unhandled message of type %u from '%s'"
), .priority = (3), .ec = (0), .args = ("__func__, fe_msg->message_case, adapter->name"
), }; static const struct xref * const xref_p_118 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Got unhandled message of type %u from '%s'"
), __func__, fe_msg->message_case, adapter->name); } while
(0)
1036 fe_msg->message_case, adapter->name)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Got unhandled message of type %u from '%s'"), .hashu32 = {(
3), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1036, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Got unhandled message of type %u from '%s'"
), .priority = (3), .ec = (0), .args = ("__func__, fe_msg->message_case, adapter->name"
), }; static const struct xref * const xref_p_118 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Got unhandled message of type %u from '%s'"
), __func__, fe_msg->message_case, adapter->name); } while
(0)
;
1037 /*
1038 * TODO: Add handling code in future.
1039 */
1040 break;
1041 /*
1042 * NOTE: The following messages are always sent from MGMTD to
1043 * Frontend clients only and/or need not be handled on MGMTd.
1044 */
1045 case MGMTD__FE_MESSAGE__MESSAGE_SESSION_REPLY:
1046 case MGMTD__FE_MESSAGE__MESSAGE_LOCKDS_REPLY:
1047 case MGMTD__FE_MESSAGE__MESSAGE_SETCFG_REPLY:
1048 case MGMTD__FE_MESSAGE__MESSAGE_COMMCFG_REPLY:
1049 case MGMTD__FE_MESSAGE__MESSAGE_GET_REPLY:
1050 case MGMTD__FE_MESSAGE__MESSAGE__NOT_SET:
1051 default:
1052 /*
1053 * A 'default' case is being added contrary to the
1054 * FRR code guidelines to take care of build
1055 * failures on certain build systems (courtesy of
1056 * the proto-c package).
1057 */
1058 break;
1059 }
1060
1061 return 0;
1062}
1063
1064/**
1065 * Send result of get-tree request back to the FE client.
1066 *
1067 * Args:
1068 * session: the session.
1069 * req_id: the request ID.
1070 * short_circuit_ok: if allowed to short circuit the message.
1071 * result_format: LYD_FORMAT for the sent output.
1072 * tree: the tree to send, can be NULL which will send an empty tree.
1073 * partial_error: if an error occurred during gathering results.
1074 *
1075 * Return:
1076 * Any error that occurs -- the message is likely not sent if non-zero.
1077 */
1078static int fe_adapter_send_tree_data(struct mgmt_fe_session_ctx *session,
1079 uint64_t_uint64_t req_id, bool_Bool short_circuit_ok,
1080 uint8_t result_type,
1081 const struct lyd_node *tree,
1082 int partial_error)
1083
1084{
1085 struct mgmt_msg_tree_data *msg;
1086 struct lyd_node *empty = NULL((void*)0);
1087 uint8_t *buf = NULL((void*)0);
1088 int ret = 0;
1089
1090 darr_append_n(buf, offsetof(typeof(*msg), result))({ uint __len = (((buf) == ((void*)0)) ? 0 : (((struct darr_metadata
*)(buf)) - 1)->len); ({ if ((ssize_t)(((buf) == ((void*)0
)) ? 0 : (((struct darr_metadata *)(buf)) - 1)->cap) < (
ssize_t)(__len + (__builtin_offsetof(typeof(*msg), result))))
({ ((buf)) = __darr_resize((buf), (__len + (__builtin_offsetof
(typeof(*msg), result))), sizeof(((buf))[0]), MTYPE_DARR); })
; (buf); }); (((struct darr_metadata *)(buf)) - 1)->len = __len
+ (__builtin_offsetof(typeof(*msg), result)); if (0) memset(
&(buf)[__len], 0, (__builtin_offsetof(typeof(*msg), result
))*sizeof((buf)[0])); &(buf)[__len]; })
;
1091 msg = (typeof(msg))buf;
1092 msg->refer_id = session->session_id;
1093 msg->req_id = req_id;
1094 msg->code = MGMT_MSG_CODE_TREE_DATA2;
1095 msg->partial_error = partial_error;
1096 msg->result_type = result_type;
1097
1098 if (!tree) {
1099 empty = yang_dnode_new(ly_native_ctx, false0);
1100 tree = empty;
1101 }
1102
1103 ret = yang_print_tree_append(&buf, tree, result_type,
1104 (LYD_PRINT_WD_EXPLICIT0x00 |
1105 LYD_PRINT_WITHSIBLINGS0x01));
1106 /* buf may have been reallocated and moved */
1107 msg = (typeof(msg))buf;
Value stored to 'msg' is never read
1108
1109
1110 if (ret != LY_SUCCESS) {
1111 MGMTD_FE_ADAPTER_ERR("Error building get-tree result for client %s session-id %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Error building get-tree result for client %s session-id %" "llu"
" req-id %" "llu" " scok %d result type %u"), .hashu32 = {(3
), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1115, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), .priority
= (3), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type"
), }; static const struct xref * const xref_p_119 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type); } while (0)
1112 " req-id %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Error building get-tree result for client %s session-id %" "llu"
" req-id %" "llu" " scok %d result type %u"), .hashu32 = {(3
), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1115, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), .priority
= (3), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type"
), }; static const struct xref * const xref_p_119 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type); } while (0)
1113 " scok %d result type %u",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Error building get-tree result for client %s session-id %" "llu"
" req-id %" "llu" " scok %d result type %u"), .hashu32 = {(3
), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1115, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), .priority
= (3), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type"
), }; static const struct xref * const xref_p_119 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type); } while (0)
1114 session->adapter->name, session->session_id,do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Error building get-tree result for client %s session-id %" "llu"
" req-id %" "llu" " scok %d result type %u"), .hashu32 = {(3
), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1115, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), .priority
= (3), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type"
), }; static const struct xref * const xref_p_119 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type); } while (0)
1115 req_id, short_circuit_ok, result_type)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"Error building get-tree result for client %s session-id %" "llu"
" req-id %" "llu" " scok %d result type %u"), .hashu32 = {(3
), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1115, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), .priority
= (3), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type"
), }; static const struct xref * const xref_p_119 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "Error building get-tree result for client %s session-id %"
"llu" " req-id %" "llu" " scok %d result type %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type); } while (0)
;
1116 goto done;
1117 }
1118
1119 MGMTD_FE_ADAPTER_DBG("Sending get-tree result from adapter %s to session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg _xref
__attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1122, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
priority = (7), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 : (((struct darr_metadata *)(buf)) - 1)->len)"
), }; static const struct xref * const xref_p_120 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 :
(((struct darr_metadata *)(buf)) - 1)->len)); } while (0)
; } while (0)
1120 " req-id %" PRIu64 " scok %d result type %u len %u",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg _xref
__attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1122, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
priority = (7), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 : (((struct darr_metadata *)(buf)) - 1)->len)"
), }; static const struct xref * const xref_p_120 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 :
(((struct darr_metadata *)(buf)) - 1)->len)); } while (0)
; } while (0)
1121 session->adapter->name, session->session_id, req_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg _xref
__attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1122, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
priority = (7), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 : (((struct darr_metadata *)(buf)) - 1)->len)"
), }; static const struct xref * const xref_p_120 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 :
(((struct darr_metadata *)(buf)) - 1)->len)); } while (0)
; } while (0)
1122 short_circuit_ok, result_type, darr_len(buf))do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg _xref
__attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1122, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), .
priority = (7), .ec = (0), .args = ("__func__, session->adapter->name, session->session_id, req_id, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 : (((struct darr_metadata *)(buf)) - 1)->len)"
), }; static const struct xref * const xref_p_120 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Sending get-tree result from adapter %s to session-id %"
"llu" " req-id %" "llu" " scok %d result type %u len %u"), __func__
, session->adapter->name, session->session_id, req_id
, short_circuit_ok, result_type, (((buf) == ((void*)0)) ? 0 :
(((struct darr_metadata *)(buf)) - 1)->len)); } while (0)
; } while (0)
;
1123
1124 ret = fe_adapter_send_native_msg(session->adapter, buf, darr_len(buf)(((buf) == ((void*)0)) ? 0 : (((struct darr_metadata *)(buf))
- 1)->len)
,
1125 short_circuit_ok);
1126done:
1127 if (empty)
1128 yang_dnode_free(empty);
1129 darr_free(buf)do { if ((buf)) { struct darr_metadata *__meta = (((struct darr_metadata
*)(buf)) - 1); do { qfree(__meta->mtype, __meta); __meta =
((void*)0); } while (0); (buf) = ((void*)0); } } while (0)
;
1130
1131 return ret;
1132}
1133
1134/**
1135 * Handle a get-tree message from the client.
1136 */
1137static void fe_adapter_handle_get_tree(struct mgmt_fe_session_ctx *session,
1138 void *data, size_t len)
1139{
1140 struct mgmt_msg_get_tree *msg = data;
1141 uint64_t_uint64_t req_id = msg->req_id;
1142 uint64_t_uint64_t clients;
1143 int ret;
1144
1145 MGMTD_FE_ADAPTER_DBG("Received get-tree request from client %s for session-id %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1148, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .priority = (7), .ec = (0), .args =
("__func__, session->adapter->name, session->session_id, msg->req_id"
), }; static const struct xref * const xref_p_121 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), __func__, session->adapter->
name, session->session_id, msg->req_id); } while (0); }
while (0)
1146 " req-id %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1148, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .priority = (7), .ec = (0), .args =
("__func__, session->adapter->name, session->session_id, msg->req_id"
), }; static const struct xref * const xref_p_121 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), __func__, session->adapter->
name, session->session_id, msg->req_id); } while (0); }
while (0)
1147 session->adapter->name, session->session_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1148, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .priority = (7), .ec = (0), .args =
("__func__, session->adapter->name, session->session_id, msg->req_id"
), }; static const struct xref * const xref_p_121 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), __func__, session->adapter->
name, session->session_id, msg->req_id); } while (0); }
while (0)
1148 msg->req_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1148, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), .priority = (7), .ec = (0), .args =
("__func__, session->adapter->name, session->session_id, msg->req_id"
), }; static const struct xref * const xref_p_121 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Received get-tree request from client %s for session-id %"
"llu" " req-id %" "llu"), __func__, session->adapter->
name, session->session_id, msg->req_id); } while (0); }
while (0)
;
1149
1150 if (session->txn_id != MGMTD_TXN_ID_NONE0) {
1151 fe_adapter_send_error(session, req_id, false0, -EINPROGRESS115,
1152 "Transaction in progress txn-id: %" PRIu64"llu"
1153 " for session-id: %" PRIu64"llu",
1154 session->txn_id, session->session_id);
1155 return;
1156 }
1157
1158 clients = mgmt_be_interested_clients(msg->xpath, false0);
1159 if (!clients) {
1160 MGMTD_FE_ADAPTER_DBG("No backends provide xpath: %s for txn-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1163, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .priority = (7), .ec = (0), .
args = ("__func__, msg->xpath, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_122 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), __func__, msg->xpath, session
->txn_id, session->session_id); } while (0); } while (0
)
1161 " session-id: %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1163, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .priority = (7), .ec = (0), .
args = ("__func__, msg->xpath, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_122 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), __func__, msg->xpath, session
->txn_id, session->session_id); } while (0); } while (0
)
1162 msg->xpath, session->txn_id,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1163, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .priority = (7), .ec = (0), .
args = ("__func__, msg->xpath, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_122 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), __func__, msg->xpath, session
->txn_id, session->session_id); } while (0); } while (0
)
1163 session->session_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1163, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), .priority = (7), .ec = (0), .
args = ("__func__, msg->xpath, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_122 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "No backends provide xpath: %s for txn-id: %"
"llu" " session-id: %" "llu"), __func__, msg->xpath, session
->txn_id, session->session_id); } while (0); } while (0
)
;
1164
1165 fe_adapter_send_tree_data(session, req_id, false0,
1166 msg->result_type, NULL((void*)0), 0);
1167 return;
1168 }
1169
1170 /* Start a SHOW Transaction */
1171 session->txn_id = mgmt_create_txn(session->session_id,
1172 MGMTD_TXN_TYPE_SHOW);
1173 if (session->txn_id == MGMTD_SESSION_ID_NONE0) {
1174 fe_adapter_send_error(session, req_id, false0, -EINPROGRESS115,
1175 "failed to create a 'show' txn");
1176 return;
1177 }
1178
1179 MGMTD_FE_ADAPTER_DBG("Created new show txn-id: %" PRIu64do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new show txn-id: %" "llu"
" for session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1181, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), .priority = (7), .ec = (0
), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_123 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
1180 " for session-id: %" PRIu64,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new show txn-id: %" "llu"
" for session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1181, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), .priority = (7), .ec = (0
), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_123 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
1181 session->txn_id, session->session_id)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Created new show txn-id: %" "llu"
" for session-id: %" "llu"), .hashu32 = {(7), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1181, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), .priority = (7), .ec = (0
), .args = ("__func__, session->txn_id, session->session_id"
), }; static const struct xref * const xref_p_123 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Created new show txn-id: %"
"llu" " for session-id: %" "llu"), __func__, session->txn_id
, session->session_id); } while (0); } while (0)
;
1182
1183 /* Create a GET-TREE request under the transaction */
1184 ret = mgmt_txn_send_get_tree_oper(session->txn_id, req_id, clients,
1185 msg->result_type, msg->xpath);
1186 if (ret) {
1187 /* destroy the just created txn */
1188 mgmt_destroy_txn(&session->txn_id);
1189 fe_adapter_send_error(session, req_id, false0, -EINPROGRESS115,
1190 "failed to create a 'show' txn");
1191 }
1192}
1193
1194/**
1195 * Handle a native encoded message from the FE client.
1196 */
1197static void fe_adapter_handle_native_msg(struct mgmt_fe_client_adapter *adapter,
1198 struct mgmt_msg_header *msg,
1199 size_t msg_len)
1200{
1201 struct mgmt_fe_session_ctx *session;
1202
1203 session = mgmt_session_id2ctx(msg->refer_id);
1204 if (!session) {
1205 MGMTD_FE_ADAPTER_ERR("adapter %s: recv msg unknown session-id %" PRIu64,do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"adapter %s: recv msg unknown session-id %" "llu"), .hashu32
= {(3), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1206, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "adapter %s: recv msg unknown session-id %"
"llu"), .priority = (3), .ec = (0), .args = ("__func__, adapter->name, msg->refer_id"
), }; static const struct xref * const xref_p_124 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "adapter %s: recv msg unknown session-id %"
"llu"), __func__, adapter->name, msg->refer_id); } while
(0)
1206 adapter->name, msg->refer_id)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"adapter %s: recv msg unknown session-id %" "llu"), .hashu32
= {(3), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1206, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "adapter %s: recv msg unknown session-id %"
"llu"), .priority = (3), .ec = (0), .args = ("__func__, adapter->name, msg->refer_id"
), }; static const struct xref * const xref_p_124 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "adapter %s: recv msg unknown session-id %"
"llu"), __func__, adapter->name, msg->refer_id); } while
(0)
;
1207 return;
1208 }
1209 assert(session->adapter == adapter)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 1209, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "session->adapter == adapter", }; static
const struct xref * const xref_p_125 __attribute__((used, section
("xref_array"))) = &(_xref.xref); if (__builtin_expect((session
->adapter == adapter) ? 0 : 1, 0)) do { _zlog_assert_failed
(&_xref, ((void*)0)); } while (session->adapter == adapter
); })
;
1210
1211 switch (msg->code) {
1212 case MGMT_MSG_CODE_GET_TREE1:
1213 fe_adapter_handle_get_tree(session, msg, msg_len);
1214 break;
1215 default:
1216 MGMTD_FE_ADAPTER_ERR("unknown native message session-id %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"unknown native message session-id %" "llu" " req-id %" "llu"
" code %u to FE adapter %s"), .hashu32 = {(3), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1220, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), .priority
= (3), .ec = (0), .args = ("__func__, msg->refer_id, msg->req_id, msg->code, adapter->name"
), }; static const struct xref * const xref_p_126 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), __func__
, msg->refer_id, msg->req_id, msg->code, adapter->
name); } while (0)
1217 " req-id %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"unknown native message session-id %" "llu" " req-id %" "llu"
" code %u to FE adapter %s"), .hashu32 = {(3), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1220, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), .priority
= (3), .ec = (0), .args = ("__func__, msg->refer_id, msg->req_id, msg->code, adapter->name"
), }; static const struct xref * const xref_p_126 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), __func__
, msg->refer_id, msg->req_id, msg->code, adapter->
name); } while (0)
1218 " code %u to FE adapter %s",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"unknown native message session-id %" "llu" " req-id %" "llu"
" code %u to FE adapter %s"), .hashu32 = {(3), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1220, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), .priority
= (3), .ec = (0), .args = ("__func__, msg->refer_id, msg->req_id, msg->code, adapter->name"
), }; static const struct xref * const xref_p_126 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), __func__
, msg->refer_id, msg->req_id, msg->code, adapter->
name); } while (0)
1219 msg->refer_id, msg->req_id, msg->code,do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"unknown native message session-id %" "llu" " req-id %" "llu"
" code %u to FE adapter %s"), .hashu32 = {(3), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1220, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), .priority
= (3), .ec = (0), .args = ("__func__, msg->refer_id, msg->req_id, msg->code, adapter->name"
), }; static const struct xref * const xref_p_126 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), __func__
, msg->refer_id, msg->req_id, msg->code, adapter->
name); } while (0)
1220 adapter->name)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"unknown native message session-id %" "llu" " req-id %" "llu"
" code %u to FE adapter %s"), .hashu32 = {(3), (0)}, }, }; static
const struct xref_logmsg _xref __attribute__( (used)) = { .xref
= { (&_xrefdata.xrefdata), (XREFT_LOGMSG), 1220, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), .priority
= (3), .ec = (0), .args = ("__func__, msg->refer_id, msg->req_id, msg->code, adapter->name"
), }; static const struct xref * const xref_p_126 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "unknown native message session-id %"
"llu" " req-id %" "llu" " code %u to FE adapter %s"), __func__
, msg->refer_id, msg->req_id, msg->code, adapter->
name); } while (0)
;
1221 break;
1222 }
1223}
1224
1225
1226static void mgmt_fe_adapter_process_msg(uint8_t version, uint8_t *data,
1227 size_t len, struct msg_conn *conn)
1228{
1229 struct mgmt_fe_client_adapter *adapter = conn->user;
1230 Mgmtd__FeMessage *fe_msg;
1231
1232 if (version == MGMT_MSG_VERSION_NATIVE1) {
1233 struct mgmt_msg_header *msg = (typeof(msg))data;
1234
1235 if (len >= sizeof(*msg))
1236 fe_adapter_handle_native_msg(adapter, msg, len);
1237 else
1238 MGMTD_FE_ADAPTER_ERR("native message to adapter %s too short %zu",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"native message to adapter %s too short %zu"), .hashu32 = {(
3), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1239, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "native message to adapter %s too short %zu"
), .priority = (3), .ec = (0), .args = ("__func__, adapter->name, len"
), }; static const struct xref * const xref_p_127 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "native message to adapter %s too short %zu"
), __func__, adapter->name, len); } while (0)
1239 adapter->name, len)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"native message to adapter %s too short %zu"), .hashu32 = {(
3), (0)}, }, }; static const struct xref_logmsg _xref __attribute__
( (used)) = { .xref = { (&_xrefdata.xrefdata), (XREFT_LOGMSG
), 1239, "mgmtd/mgmt_fe_adapter.c", __func__, }, .fmtstring =
("FE-ADAPTER: %s: ERROR: " "native message to adapter %s too short %zu"
), .priority = (3), .ec = (0), .args = ("__func__, adapter->name, len"
), }; static const struct xref * const xref_p_127 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "native message to adapter %s too short %zu"
), __func__, adapter->name, len); } while (0)
;
1240 return;
1241 }
1242
1243 fe_msg = mgmtd__fe_message__unpack(NULL((void*)0), len, data);
1244 if (!fe_msg) {
1245 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1247, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), .priority = (7), .ec = (0), .args = ("__func__, len, adapter->name"
), }; static const struct xref * const xref_p_128 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), __func__, len, adapter->name); } while (0); } while (0)
1246 "Failed to decode %zu bytes for adapter: %s", len,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1247, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), .priority = (7), .ec = (0), .args = ("__func__, len, adapter->name"
), }; static const struct xref * const xref_p_128 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), __func__, len, adapter->name); } while (0); } while (0)
1247 adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1247, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), .priority = (7), .ec = (0), .args = ("__func__, len, adapter->name"
), }; static const struct xref * const xref_p_128 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Failed to decode %zu bytes for adapter: %s"
), __func__, len, adapter->name); } while (0); } while (0)
;
1248 return;
1249 }
1250 MGMTD_FE_ADAPTER_DBG(do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1252, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), .priority = (7), .ec = (0), .args = ("__func__, len, fe_msg->message_case, adapter->name"
), }; static const struct xref * const xref_p_129 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), __func__, len, fe_msg->message_case, adapter->name);
} while (0); } while (0)
1251 "Decoded %zu bytes of message: %u from adapter: %s", len,do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1252, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), .priority = (7), .ec = (0), .args = ("__func__, len, fe_msg->message_case, adapter->name"
), }; static const struct xref * const xref_p_129 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), __func__, len, fe_msg->message_case, adapter->name);
} while (0); } while (0)
1252 fe_msg->message_case, adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1252, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), .priority = (7), .ec = (0), .args = ("__func__, len, fe_msg->message_case, adapter->name"
), }; static const struct xref * const xref_p_129 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Decoded %zu bytes of message: %u from adapter: %s"
), __func__, len, fe_msg->message_case, adapter->name);
} while (0); } while (0)
;
1253 (void)mgmt_fe_adapter_handle_msg(adapter, fe_msg);
1254 mgmtd__fe_message__free_unpacked(fe_msg, NULL((void*)0));
1255}
1256
1257void mgmt_fe_adapter_lock(struct mgmt_fe_client_adapter *adapter)
1258{
1259 adapter->refcount++;
1260}
1261
1262extern void mgmt_fe_adapter_unlock(struct mgmt_fe_client_adapter **adapter)
1263{
1264 struct mgmt_fe_client_adapter *a = *adapter;
1265 assert(a && a->refcount)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 1265, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "a && a->refcount", }; static
const struct xref * const xref_p_130 __attribute__((used, section
("xref_array"))) = &(_xref.xref); if (__builtin_expect((a
&& a->refcount) ? 0 : 1, 0)) do { _zlog_assert_failed
(&_xref, ((void*)0)); } while (a && a->refcount
); })
;
1266
1267 if (!--a->refcount) {
1268 mgmt_fe_adapters_del(&mgmt_fe_adapters, a);
1269 msg_server_conn_delete(a->conn);
1270 XFREE(MTYPE_MGMTD_FE_ADPATER, a)do { qfree(MTYPE_MGMTD_FE_ADPATER, a); a = ((void*)0); } while
(0)
;
1271 }
1272 *adapter = NULL((void*)0);
1273}
1274
1275/*
1276 * Initialize the FE adapter module
1277 */
1278void mgmt_fe_adapter_init(struct event_loop *tm)
1279{
1280 assert(!mgmt_loop)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 1280, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "!mgmt_loop", }; static const struct xref
* const xref_p_131 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((!mgmt_loop) ? 0
: 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0)); }
while (!mgmt_loop); })
;
1281 mgmt_loop = tm;
1282
1283 mgmt_fe_adapters_init(&mgmt_fe_adapters);
1284
1285 assert(!mgmt_fe_sessions)({ static const struct xref_assert _xref __attribute__( (used
)) = { .xref = { (((void*)0)), (XREFT_ASSERT), 1285, "mgmtd/mgmt_fe_adapter.c"
, __func__, }, .expr = "!mgmt_fe_sessions", }; static const struct
xref * const xref_p_132 __attribute__((used, section("xref_array"
))) = &(_xref.xref); if (__builtin_expect((!mgmt_fe_sessions
) ? 0 : 1, 0)) do { _zlog_assert_failed(&_xref, ((void*)0
)); } while (!mgmt_fe_sessions); })
;
1286 mgmt_fe_sessions =
1287 hash_create(mgmt_fe_session_hash_key, mgmt_fe_session_hash_cmp,
1288 "MGMT Frontend Sessions");
1289
1290 if (msg_server_init(&mgmt_fe_server, MGMTD_FE_SERVER_PATH"/var/run/frr/mgmtd_fe.sock", tm,
1291 mgmt_fe_create_adapter, "frontend",
1292 &mgmt_debug_fe)) {
1293 zlog_err("cannot initialize frontend server")do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("cannot initialize frontend server"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1293, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("cannot initialize frontend server"), .priority
= (3), .ec = (0), .args = (""), }; static const struct xref *
const xref_p_133 __attribute__((used, section("xref_array"))
) = &(_xref.xref); zlog_ref(&_xref, ("cannot initialize frontend server"
)); } while (0)
;
1294 exit(1);
1295 }
1296}
1297
1298static void mgmt_fe_abort_if_session(void *data)
1299{
1300 struct mgmt_fe_session_ctx *session = data;
1301
1302 MGMTD_FE_ADAPTER_ERR("found orphaned session id %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"found orphaned session id %" "llu" " client id %" "llu" " adapter %s"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1306, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), .priority = (3), .
ec = (0), .args = ("__func__, session->session_id, session->client_id, session->adapter ? session->adapter->name : \"NULL\""
), }; static const struct xref * const xref_p_134 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), __func__, session
->session_id, session->client_id, session->adapter ?
session->adapter->name : "NULL"); } while (0)
1303 " client id %" PRIu64 " adapter %s",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"found orphaned session id %" "llu" " client id %" "llu" " adapter %s"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1306, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), .priority = (3), .
ec = (0), .args = ("__func__, session->session_id, session->client_id, session->adapter ? session->adapter->name : \"NULL\""
), }; static const struct xref * const xref_p_134 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), __func__, session
->session_id, session->client_id, session->adapter ?
session->adapter->name : "NULL"); } while (0)
1304 session->session_id, session->client_id,do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"found orphaned session id %" "llu" " client id %" "llu" " adapter %s"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1306, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), .priority = (3), .
ec = (0), .args = ("__func__, session->session_id, session->client_id, session->adapter ? session->adapter->name : \"NULL\""
), }; static const struct xref * const xref_p_134 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), __func__, session
->session_id, session->client_id, session->adapter ?
session->adapter->name : "NULL"); } while (0)
1305 session->adapter ? session->adapter->namedo { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"found orphaned session id %" "llu" " client id %" "llu" " adapter %s"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1306, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), .priority = (3), .
ec = (0), .args = ("__func__, session->session_id, session->client_id, session->adapter ? session->adapter->name : \"NULL\""
), }; static const struct xref * const xref_p_134 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), __func__, session
->session_id, session->client_id, session->adapter ?
session->adapter->name : "NULL"); } while (0)
1306 : "NULL")do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"found orphaned session id %" "llu" " client id %" "llu" " adapter %s"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1306, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), .priority = (3), .
ec = (0), .args = ("__func__, session->session_id, session->client_id, session->adapter ? session->adapter->name : \"NULL\""
), }; static const struct xref * const xref_p_134 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: ERROR: " "found orphaned session id %"
"llu" " client id %" "llu" " adapter %s"), __func__, session
->session_id, session->client_id, session->adapter ?
session->adapter->name : "NULL"); } while (0)
;
1307 abort();
1308}
1309
1310/*
1311 * Destroy the FE adapter module
1312 */
1313void mgmt_fe_adapter_destroy(void)
1314{
1315 struct mgmt_fe_client_adapter *adapter;
1316
1317 msg_server_cleanup(&mgmt_fe_server);
1318
1319 /* Deleting the adapters will delete all the sessions */
1320 FOREACH_ADAPTER_IN_LIST (adapter)for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((adapter) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (adapter); (adapter) = mgmt_fe_adapters_safe
, mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe(&mgmt_fe_adapters
, mgmt_fe_adapters_safe))
1321 mgmt_fe_adapter_delete(adapter);
1322
1323 hash_clean_and_free(&mgmt_fe_sessions, mgmt_fe_abort_if_session);
1324}
1325
1326/*
1327 * The server accepted a new connection
1328 */
1329struct msg_conn *mgmt_fe_create_adapter(int conn_fd, union sockunion *from)
1330{
1331 struct mgmt_fe_client_adapter *adapter = NULL((void*)0);
1332
1333 adapter = mgmt_fe_find_adapter_by_fd(conn_fd);
1334 if (!adapter) {
1335 adapter = XCALLOC(MTYPE_MGMTD_FE_ADPATER,qcalloc(MTYPE_MGMTD_FE_ADPATER, sizeof(struct mgmt_fe_client_adapter
))
1336 sizeof(struct mgmt_fe_client_adapter))qcalloc(MTYPE_MGMTD_FE_ADPATER, sizeof(struct mgmt_fe_client_adapter
))
;
1337 snprintf(adapter->name, sizeof(adapter->name), "Unknown-FD-%d",
1338 conn_fd);
1339
1340 mgmt_fe_sessions_init(&adapter->fe_sessions);
1341 mgmt_fe_adapter_lock(adapter);
1342 mgmt_fe_adapters_add_tail(&mgmt_fe_adapters, adapter);
1343
1344 adapter->conn = msg_server_conn_create(
1345 mgmt_loop, conn_fd, mgmt_fe_adapter_notify_disconnect,
1346 mgmt_fe_adapter_process_msg, MGMTD_FE_MAX_NUM_MSG_PROC500,
1347 MGMTD_FE_MAX_NUM_MSG_WRITE100, MGMTD_FE_MAX_MSG_LEN(64 * 1024),
1348 adapter, "FE-adapter");
1349
1350 adapter->conn->debug = DEBUG_MODE_CHECK(&mgmt_debug_fe,((__c11_atomic_load(&(&mgmt_debug_fe)->flags, memory_order_seq_cst
)) & (((0x01000000 | 0x02000000))&(0x01000000 | 0x02000000
)))
1351 DEBUG_MODE_ALL)((__c11_atomic_load(&(&mgmt_debug_fe)->flags, memory_order_seq_cst
)) & (((0x01000000 | 0x02000000))&(0x01000000 | 0x02000000
)))
;
1352
1353 adapter->setcfg_stats.min_tm = ULONG_MAX(9223372036854775807L *2UL+1UL);
1354 adapter->cmt_stats.min_tm = ULONG_MAX(9223372036854775807L *2UL+1UL);
1355 MGMTD_FE_ADAPTER_DBG("Added new MGMTD Frontend adapter '%s'",do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Added new MGMTD Frontend adapter '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1356, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Added new MGMTD Frontend adapter '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_135 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Added new MGMTD Frontend adapter '%s'"
), __func__, adapter->name); } while (0); } while (0)
1356 adapter->name)do { if (((__c11_atomic_load(&(&mgmt_debug_fe)->flags
, memory_order_seq_cst)) & (((0x01000000 | 0x02000000))&
(0x01000000 | 0x02000000)))) do { static struct xrefdata_logmsg
_xrefdata = { .xrefdata = { .xref = ((void*)0), .uid = {}, .
hashstr = ("FE-ADAPTER: %s: " "Added new MGMTD Frontend adapter '%s'"
), .hashu32 = {(7), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1356, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: " "Added new MGMTD Frontend adapter '%s'"
), .priority = (7), .ec = (0), .args = ("__func__, adapter->name"
), }; static const struct xref * const xref_p_135 __attribute__
((used, section("xref_array"))) = &(_xref.xref); zlog_ref
(&_xref, ("FE-ADAPTER: %s: " "Added new MGMTD Frontend adapter '%s'"
), __func__, adapter->name); } while (0); } while (0)
;
1357 }
1358 return adapter->conn;
1359}
1360
1361int mgmt_fe_send_set_cfg_reply(uint64_t_uint64_t session_id, uint64_t_uint64_t txn_id,
1362 Mgmtd__DatastoreId ds_id, uint64_t_uint64_t req_id,
1363 enum mgmt_result result,
1364 const char *error_if_any,
1365 bool_Bool implicit_commit)
1366{
1367 struct mgmt_fe_session_ctx *session;
1368
1369 session = mgmt_session_id2ctx(session_id);
1370 if (!session || session->cfg_txn_id != txn_id) {
1371 if (session)
1372 MGMTD_FE_ADAPTER_ERR(do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1375, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "txn-id doesn't match, session txn-id is %"
"llu" " current txnid: %" "llu"), .priority = (3), .ec = (0)
, .args = ("__func__, session->cfg_txn_id, txn_id"), }; static
const struct xref * const xref_p_136 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), __func__, session->cfg_txn_id, txn_id); } while (
0)
1373 "txn-id doesn't match, session txn-id is %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1375, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "txn-id doesn't match, session txn-id is %"
"llu" " current txnid: %" "llu"), .priority = (3), .ec = (0)
, .args = ("__func__, session->cfg_txn_id, txn_id"), }; static
const struct xref * const xref_p_136 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), __func__, session->cfg_txn_id, txn_id); } while (
0)
1374 " current txnid: %" PRIu64,do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1375, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "txn-id doesn't match, session txn-id is %"
"llu" " current txnid: %" "llu"), .priority = (3), .ec = (0)
, .args = ("__func__, session->cfg_txn_id, txn_id"), }; static
const struct xref * const xref_p_136 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), __func__, session->cfg_txn_id, txn_id); } while (
0)
1375 session->cfg_txn_id, txn_id)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1375, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "txn-id doesn't match, session txn-id is %"
"llu" " current txnid: %" "llu"), .priority = (3), .ec = (0)
, .args = ("__func__, session->cfg_txn_id, txn_id"), }; static
const struct xref * const xref_p_136 __attribute__((used, section
("xref_array"))) = &(_xref.xref); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: "
"txn-id doesn't match, session txn-id is %" "llu" " current txnid: %"
"llu"), __func__, session->cfg_txn_id, txn_id); } while (
0)
;
1376 return -1;
1377 }
1378
1379 return fe_adapter_send_set_cfg_reply(session, ds_id, req_id,
1380 result == MGMTD_SUCCESS,
1381 error_if_any, implicit_commit);
1382}
1383
1384int mgmt_fe_send_commit_cfg_reply(uint64_t_uint64_t session_id, uint64_t_uint64_t txn_id,
1385 Mgmtd__DatastoreId src_ds_id,
1386 Mgmtd__DatastoreId dst_ds_id,
1387 uint64_t_uint64_t req_id, bool_Bool validate_only,
1388 enum mgmt_result result,
1389 const char *error_if_any)
1390{
1391 struct mgmt_fe_session_ctx *session;
1392
1393 session = mgmt_session_id2ctx(session_id);
1394 if (!session || session->cfg_txn_id != txn_id)
1395 return -1;
1396
1397 return fe_adapter_send_commit_cfg_reply(session, src_ds_id, dst_ds_id,
1398 req_id, result, validate_only,
1399 error_if_any);
1400}
1401
1402int mgmt_fe_send_get_reply(uint64_t_uint64_t session_id, uint64_t_uint64_t txn_id,
1403 Mgmtd__DatastoreId ds_id, uint64_t_uint64_t req_id,
1404 enum mgmt_result result,
1405 Mgmtd__YangDataReply *data_resp,
1406 const char *error_if_any)
1407{
1408 struct mgmt_fe_session_ctx *session;
1409
1410 session = mgmt_session_id2ctx(session_id);
1411 if (!session || session->txn_id != txn_id)
1412 return -1;
1413
1414 return fe_adapter_send_get_reply(session, ds_id, req_id,
1415 result == MGMTD_SUCCESS, data_resp,
1416 error_if_any);
1417}
1418
1419int mgmt_fe_adapter_send_tree_data(uint64_t_uint64_t session_id, uint64_t_uint64_t txn_id,
1420 uint64_t_uint64_t req_id, LYD_FORMAT result_type,
1421 const struct lyd_node *tree,
1422 int partial_error, bool_Bool short_circuit_ok)
1423{
1424 struct mgmt_fe_session_ctx *session;
1425 int ret;
1426
1427 session = mgmt_session_id2ctx(session_id);
1428 if (!session || session->txn_id != txn_id)
1429 return -1;
1430
1431 ret = fe_adapter_send_tree_data(session, req_id, short_circuit_ok,
1432 result_type, tree, partial_error);
1433
1434 mgmt_destroy_txn(&session->txn_id);
1435
1436 return ret;
1437}
1438
1439/**
1440 * Send an error back to the FE client and cleanup any in-progress txn.
1441 */
1442int mgmt_fe_adapter_txn_error(uint64_t_uint64_t txn_id, uint64_t_uint64_t req_id,
1443 bool_Bool short_circuit_ok, int16_t error,
1444 const char *errstr)
1445{
1446 struct mgmt_fe_session_ctx *session;
1447 int ret;
1448
1449 session = fe_adapter_session_by_txn_id(txn_id);
1450 if (!session) {
1451 MGMTD_FE_ADAPTER_ERR("failed sending error for txn-id %" PRIu64do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"failed sending error for txn-id %" "llu" " session not found"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1453, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "failed sending error for txn-id %"
"llu" " session not found"), .priority = (3), .ec = (0), .args
= ("__func__, txn_id"), }; static const struct xref * const xref_p_137
__attribute__((used, section("xref_array"))) = &(_xref.xref
); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: " "failed sending error for txn-id %"
"llu" " session not found"), __func__, txn_id); } while (0)
1452 " session not found",do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"failed sending error for txn-id %" "llu" " session not found"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1453, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "failed sending error for txn-id %"
"llu" " session not found"), .priority = (3), .ec = (0), .args
= ("__func__, txn_id"), }; static const struct xref * const xref_p_137
__attribute__((used, section("xref_array"))) = &(_xref.xref
); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: " "failed sending error for txn-id %"
"llu" " session not found"), __func__, txn_id); } while (0)
1453 txn_id)do { static struct xrefdata_logmsg _xrefdata = { .xrefdata = {
.xref = ((void*)0), .uid = {}, .hashstr = ("FE-ADAPTER: %s: ERROR: "
"failed sending error for txn-id %" "llu" " session not found"
), .hashu32 = {(3), (0)}, }, }; static const struct xref_logmsg
_xref __attribute__( (used)) = { .xref = { (&_xrefdata.xrefdata
), (XREFT_LOGMSG), 1453, "mgmtd/mgmt_fe_adapter.c", __func__,
}, .fmtstring = ("FE-ADAPTER: %s: ERROR: " "failed sending error for txn-id %"
"llu" " session not found"), .priority = (3), .ec = (0), .args
= ("__func__, txn_id"), }; static const struct xref * const xref_p_137
__attribute__((used, section("xref_array"))) = &(_xref.xref
); zlog_ref(&_xref, ("FE-ADAPTER: %s: ERROR: " "failed sending error for txn-id %"
"llu" " session not found"), __func__, txn_id); } while (0)
;
1454 return -ENOENT2;
1455 }
1456
1457
1458 ret = fe_adapter_send_error(session, req_id, false0, error, "%s", errstr);
1459
1460 mgmt_destroy_txn(&session->txn_id);
1461
1462 return ret;
1463}
1464
1465
1466struct mgmt_setcfg_stats *mgmt_fe_get_session_setcfg_stats(uint64_t_uint64_t session_id)
1467{
1468 struct mgmt_fe_session_ctx *session;
1469
1470 session = mgmt_session_id2ctx(session_id);
1471 if (!session || !session->adapter)
1472 return NULL((void*)0);
1473
1474 return &session->adapter->setcfg_stats;
1475}
1476
1477struct mgmt_commit_stats *
1478mgmt_fe_get_session_commit_stats(uint64_t_uint64_t session_id)
1479{
1480 struct mgmt_fe_session_ctx *session;
1481
1482 session = mgmt_session_id2ctx(session_id);
1483 if (!session || !session->adapter)
1484 return NULL((void*)0);
1485
1486 return &session->adapter->cmt_stats;
1487}
1488
1489static void
1490mgmt_fe_adapter_cmt_stats_write(struct vty *vty,
1491 struct mgmt_fe_client_adapter *adapter)
1492{
1493 char buf[MGMT_LONG_TIME_MAX_LEN30];
1494
1495 if (!mm->perf_stats_en)
1496 return;
1497
1498 vty_out(vty, " Num-Commits: \t\t\t%lu\n",
1499 adapter->cmt_stats.commit_cnt);
1500 if (adapter->cmt_stats.commit_cnt > 0) {
1501 if (mm->perf_stats_en)
1502 vty_out(vty, " Max-Commit-Duration: \t\t%lu uSecs\n",
1503 adapter->cmt_stats.max_tm);
1504 vty_out(vty, " Max-Commit-Batch-Size: \t\t%lu\n",
1505 adapter->cmt_stats.max_batch_cnt);
1506 if (mm->perf_stats_en)
1507 vty_out(vty, " Min-Commit-Duration: \t\t%lu uSecs\n",
1508 adapter->cmt_stats.min_tm);
1509 vty_out(vty, " Min-Commit-Batch-Size: \t\t%lu\n",
1510 adapter->cmt_stats.min_batch_cnt);
1511 if (mm->perf_stats_en)
1512 vty_out(vty,
1513 " Last-Commit-Duration: \t\t%lu uSecs\n",
1514 adapter->cmt_stats.last_exec_tm);
1515 vty_out(vty, " Last-Commit-Batch-Size: \t\t%lu\n",
1516 adapter->cmt_stats.last_batch_cnt);
1517 vty_out(vty, " Last-Commit-CfgData-Reqs: \t\t%lu\n",
1518 adapter->cmt_stats.last_num_cfgdata_reqs);
1519 vty_out(vty, " Last-Commit-CfgApply-Reqs: \t\t%lu\n",
1520 adapter->cmt_stats.last_num_apply_reqs);
1521 if (mm->perf_stats_en) {
1522 vty_out(vty, " Last-Commit-Details:\n");
1523 vty_out(vty, " Commit Start: \t\t\t%s\n",
1524 mgmt_realtime_to_string(
1525 &adapter->cmt_stats.last_start, buf,
1526 sizeof(buf)));
1527#ifdef MGMTD_LOCAL_VALIDATIONS_ENABLED
1528 vty_out(vty, " Config-Validate Start: \t\t%s\n",
1529 mgmt_realtime_to_string(
1530 &adapter->cmt_stats.validate_start, buf,
1531 sizeof(buf)));
1532#endif
1533 vty_out(vty, " Prep-Config Start: \t\t%s\n",
1534 mgmt_realtime_to_string(
1535 &adapter->cmt_stats.prep_cfg_start, buf,
1536 sizeof(buf)));
1537 vty_out(vty, " Txn-Create Start: \t\t%s\n",
1538 mgmt_realtime_to_string(
1539 &adapter->cmt_stats.txn_create_start,
1540 buf, sizeof(buf)));
1541 vty_out(vty,
1542#ifdef MGMTD_LOCAL_VALIDATIONS_ENABLED
1543 " Send-Config Start: \t\t%s\n",
1544#else
1545 " Send-Config-Validate Start: \t%s\n",
1546#endif
1547 mgmt_realtime_to_string(
1548 &adapter->cmt_stats.send_cfg_start, buf,
1549 sizeof(buf)));
1550 vty_out(vty, " Apply-Config Start: \t\t%s\n",
1551 mgmt_realtime_to_string(
1552 &adapter->cmt_stats.apply_cfg_start,
1553 buf, sizeof(buf)));
1554 vty_out(vty, " Apply-Config End: \t\t%s\n",
1555 mgmt_realtime_to_string(
1556 &adapter->cmt_stats.apply_cfg_end, buf,
1557 sizeof(buf)));
1558 vty_out(vty, " Txn-Delete Start: \t\t%s\n",
1559 mgmt_realtime_to_string(
1560 &adapter->cmt_stats.txn_del_start, buf,
1561 sizeof(buf)));
1562 vty_out(vty, " Commit End: \t\t\t%s\n",
1563 mgmt_realtime_to_string(
1564 &adapter->cmt_stats.last_end, buf,
1565 sizeof(buf)));
1566 }
1567 }
1568}
1569
1570static void
1571mgmt_fe_adapter_setcfg_stats_write(struct vty *vty,
1572 struct mgmt_fe_client_adapter *adapter)
1573{
1574 char buf[MGMT_LONG_TIME_MAX_LEN30];
1575
1576 if (!mm->perf_stats_en)
1577 return;
1578
1579 vty_out(vty, " Num-Set-Cfg: \t\t\t%lu\n",
1580 adapter->setcfg_stats.set_cfg_count);
1581 if (mm->perf_stats_en && adapter->setcfg_stats.set_cfg_count > 0) {
1582 vty_out(vty, " Max-Set-Cfg-Duration: \t\t%lu uSec\n",
1583 adapter->setcfg_stats.max_tm);
1584 vty_out(vty, " Min-Set-Cfg-Duration: \t\t%lu uSec\n",
1585 adapter->setcfg_stats.min_tm);
1586 vty_out(vty, " Avg-Set-Cfg-Duration: \t\t%lu uSec\n",
1587 adapter->setcfg_stats.avg_tm);
1588 vty_out(vty, " Last-Set-Cfg-Details:\n");
1589 vty_out(vty, " Set-Cfg Start: \t\t\t%s\n",
1590 mgmt_realtime_to_string(
1591 &adapter->setcfg_stats.last_start, buf,
1592 sizeof(buf)));
1593 vty_out(vty, " Set-Cfg End: \t\t\t%s\n",
1594 mgmt_realtime_to_string(&adapter->setcfg_stats.last_end,
1595 buf, sizeof(buf)));
1596 }
1597}
1598
1599void mgmt_fe_adapter_status_write(struct vty *vty, bool_Bool detail)
1600{
1601 struct mgmt_fe_client_adapter *adapter;
1602 struct mgmt_fe_session_ctx *session;
1603 Mgmtd__DatastoreId ds_id;
1604 bool_Bool locked = false0;
1605
1606 vty_out(vty, "MGMTD Frontend Adpaters\n");
1607
1608 FOREACH_ADAPTER_IN_LIST (adapter)for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((adapter) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (adapter); (adapter) = mgmt_fe_adapters_safe
, mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe(&mgmt_fe_adapters
, mgmt_fe_adapters_safe))
{
1609 vty_out(vty, " Client: \t\t\t\t%s\n", adapter->name);
1610 vty_out(vty, " Conn-FD: \t\t\t\t%d\n", adapter->conn->fd);
1611 if (detail) {
1612 mgmt_fe_adapter_setcfg_stats_write(vty, adapter);
1613 mgmt_fe_adapter_cmt_stats_write(vty, adapter);
1614 }
1615 vty_out(vty, " Sessions\n");
1616 FOREACH_SESSION_IN_LIST (adapter, session)for (typeof(mgmt_fe_sessions_next_safe(&(adapter)->fe_sessions
, ((void*)0))) mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe
(&(adapter)->fe_sessions, ((session) = mgmt_fe_sessions_first
(&(adapter)->fe_sessions))); (session); (session) = mgmt_fe_sessions_safe
, mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe(&(adapter
)->fe_sessions, mgmt_fe_sessions_safe))
{
1617 vty_out(vty, " Session: \t\t\t\t%p\n", session);
1618 vty_out(vty, " Client-Id: \t\t\t%" PRIu64"llu" "\n",
1619 session->client_id);
1620 vty_out(vty, " Session-Id: \t\t\t%" PRIu64"llu" "\n",
1621 session->session_id);
1622 vty_out(vty, " DS-Locks:\n");
1623 FOREACH_MGMTD_DS_ID (ds_id)for ((ds_id) = MGMTD__DATASTORE_ID__DS_NONE; (ds_id) < MGMTD__DATASTORE_ID__OPERATIONAL_DS
+ 1; (ds_id)++)
{
1624 if (session->ds_locked[ds_id]) {
1625 locked = true1;
1626 vty_out(vty, " %s\n",
1627 mgmt_ds_id2name(ds_id));
1628 }
1629 }
1630 if (!locked)
1631 vty_out(vty, " None\n");
1632 }
1633 vty_out(vty, " Total-Sessions: \t\t\t%d\n",
1634 (int)mgmt_fe_sessions_count(&adapter->fe_sessions));
1635 vty_out(vty, " Msg-Recvd: \t\t\t\t%" PRIu64"llu" "\n",
1636 adapter->conn->mstate.nrxm);
1637 vty_out(vty, " Bytes-Recvd: \t\t\t%" PRIu64"llu" "\n",
1638 adapter->conn->mstate.nrxb);
1639 vty_out(vty, " Msg-Sent: \t\t\t\t%" PRIu64"llu" "\n",
1640 adapter->conn->mstate.ntxm);
1641 vty_out(vty, " Bytes-Sent: \t\t\t%" PRIu64"llu" "\n",
1642 adapter->conn->mstate.ntxb);
1643 }
1644 vty_out(vty, " Total: %d\n",
1645 (int)mgmt_fe_adapters_count(&mgmt_fe_adapters));
1646}
1647
1648void mgmt_fe_adapter_perf_measurement(struct vty *vty, bool_Bool config)
1649{
1650 mm->perf_stats_en = config;
1651}
1652
1653void mgmt_fe_adapter_reset_perf_stats(struct vty *vty)
1654{
1655 struct mgmt_fe_client_adapter *adapter;
1656 struct mgmt_fe_session_ctx *session;
1657
1658 FOREACH_ADAPTER_IN_LIST (adapter)for (typeof(mgmt_fe_adapters_next_safe(&mgmt_fe_adapters,
((void*)0))) mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe
(&mgmt_fe_adapters, ((adapter) = mgmt_fe_adapters_first(&
mgmt_fe_adapters))); (adapter); (adapter) = mgmt_fe_adapters_safe
, mgmt_fe_adapters_safe = mgmt_fe_adapters_next_safe(&mgmt_fe_adapters
, mgmt_fe_adapters_safe))
{
1659 memset(&adapter->setcfg_stats, 0,
1660 sizeof(adapter->setcfg_stats));
1661 FOREACH_SESSION_IN_LIST (adapter, session)for (typeof(mgmt_fe_sessions_next_safe(&(adapter)->fe_sessions
, ((void*)0))) mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe
(&(adapter)->fe_sessions, ((session) = mgmt_fe_sessions_first
(&(adapter)->fe_sessions))); (session); (session) = mgmt_fe_sessions_safe
, mgmt_fe_sessions_safe = mgmt_fe_sessions_next_safe(&(adapter
)->fe_sessions, mgmt_fe_sessions_safe))
{
1662 memset(&adapter->cmt_stats, 0,
1663 sizeof(adapter->cmt_stats));
1664 }
1665 }
1666}