Lines Matching refs:msg
68 int (*format)(struct tipc_nl_compat_msg *msg, struct nlattr **attrs);
74 struct sk_buff *skb, struct tipc_nl_compat_msg *msg);
181 struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_dumpit() argument
198 buf->sk = msg->dst_sk; in __tipc_nl_compat_dumpit()
199 if (__tipc_dump_start(&cb, msg->net)) { in __tipc_nl_compat_dumpit()
216 err = (*cmd->format)(msg, attrs); in __tipc_nl_compat_dumpit()
220 if (tipc_skb_tailroom(msg->rep) <= 1) { in __tipc_nl_compat_dumpit()
241 if ((TIPC_SKB_MAX - msg->rep->len) <= 1) { in __tipc_nl_compat_dumpit()
242 char *tail = skb_tail_pointer(msg->rep); in __tipc_nl_compat_dumpit()
256 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_dumpit() argument
261 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_dumpit()
262 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_dumpit()
265 msg->rep = tipc_tlv_alloc(msg->rep_size); in tipc_nl_compat_dumpit()
266 if (!msg->rep) in tipc_nl_compat_dumpit()
269 if (msg->rep_type) in tipc_nl_compat_dumpit()
270 tipc_tlv_init(msg->rep, msg->rep_type); in tipc_nl_compat_dumpit()
273 err = (*cmd->header)(msg); in tipc_nl_compat_dumpit()
275 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
276 msg->rep = NULL; in tipc_nl_compat_dumpit()
283 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
284 msg->rep = NULL; in tipc_nl_compat_dumpit()
288 err = __tipc_nl_compat_dumpit(cmd, msg, arg); in tipc_nl_compat_dumpit()
290 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
291 msg->rep = NULL; in tipc_nl_compat_dumpit()
299 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_doit() argument
329 err = (*cmd->transcode)(cmd, trans_buf, msg); in __tipc_nl_compat_doit()
339 doit_buf->sk = msg->dst_sk; in __tipc_nl_compat_doit()
355 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_doit() argument
359 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_doit()
360 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_doit()
363 err = __tipc_nl_compat_doit(cmd, msg); in tipc_nl_compat_doit()
368 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_doit()
369 if (!msg->rep) in tipc_nl_compat_doit()
375 static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_bearer_dump() argument
389 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME, in tipc_nl_compat_bearer_dump()
396 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_enable() argument
403 b = (struct tipc_bearer_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_enable()
409 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_enable()
439 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_disable() argument
445 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_disable()
451 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_disable()
472 static void __fill_bc_link_stat(struct tipc_nl_compat_msg *msg, in __fill_bc_link_stat() argument
475 tipc_tlv_sprintf(msg->rep, " Window:%u packets\n", in __fill_bc_link_stat()
478 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
486 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
494 tipc_tlv_sprintf(msg->rep, " RX naks:%u defs:%u dups:%u\n", in __fill_bc_link_stat()
499 tipc_tlv_sprintf(msg->rep, " TX naks:%u acks:%u dups:%u\n", in __fill_bc_link_stat()
504 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
511 static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_stat_dump() argument
547 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_stat_dump()
549 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_stat_dump()
560 tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n", in tipc_nl_compat_link_stat_dump()
564 __fill_bc_link_stat(msg, prop, stats); in tipc_nl_compat_link_stat_dump()
569 tipc_tlv_sprintf(msg->rep, " ACTIVE"); in tipc_nl_compat_link_stat_dump()
571 tipc_tlv_sprintf(msg->rep, " STANDBY"); in tipc_nl_compat_link_stat_dump()
573 tipc_tlv_sprintf(msg->rep, " DEFUNCT"); in tipc_nl_compat_link_stat_dump()
575 tipc_tlv_sprintf(msg->rep, " MTU:%u Priority:%u", in tipc_nl_compat_link_stat_dump()
579 tipc_tlv_sprintf(msg->rep, " Tolerance:%u ms Window:%u packets\n", in tipc_nl_compat_link_stat_dump()
583 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
592 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
601 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
607 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
618 tipc_tlv_sprintf(msg->rep, "-16384:%u%% -32768:%u%% -66000:%u%%\n", in tipc_nl_compat_link_stat_dump()
626 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
634 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
642 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
651 static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_dump() argument
671 return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, in tipc_nl_compat_link_dump()
676 struct tipc_nl_compat_msg *msg, in __tipc_add_link_prop() argument
679 switch (msg->cmd) { in __tipc_add_link_prop()
692 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_media_set() argument
698 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_media_set()
711 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_media_set()
719 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_set() argument
725 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_set()
738 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_bearer_set()
746 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_link_set() argument
752 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in __tipc_nl_compat_link_set()
765 __tipc_add_link_prop(skb, msg, lc); in __tipc_nl_compat_link_set()
774 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_set() argument
781 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_link_set()
783 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_set()
795 return tipc_nl_compat_media_set(skb, msg); in tipc_nl_compat_link_set()
798 bearer = tipc_bearer_find(msg->net, lc->name); in tipc_nl_compat_link_set()
801 return tipc_nl_compat_bearer_set(skb, msg); in tipc_nl_compat_link_set()
804 return __tipc_nl_compat_link_set(skb, msg); in tipc_nl_compat_link_set()
809 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_reset_stats() argument
815 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_reset_stats()
821 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_reset_stats()
837 static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_name_table_dump_header() argument
849 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump_header()
850 if (TLV_GET_DATA_LEN(msg->req) < sizeof(struct tipc_name_table_query)) in tipc_nl_compat_name_table_dump_header()
858 tipc_tlv_sprintf(msg->rep, header[i]); in tipc_nl_compat_name_table_dump_header()
859 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump_header()
864 static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_name_table_dump() argument
894 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump()
909 tipc_tlv_sprintf(msg->rep, "%-10u ", in tipc_nl_compat_name_table_dump()
915 tipc_tlv_sprintf(msg->rep, "%-10u %-10u ", in tipc_nl_compat_name_table_dump()
925 tipc_tlv_sprintf(msg->rep, "%-26s ", port_str); in tipc_nl_compat_name_table_dump()
930 tipc_tlv_sprintf(msg->rep, "%-10u %s", in tipc_nl_compat_name_table_dump()
934 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump()
939 static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_publ_dump() argument
959 tipc_tlv_sprintf(msg->rep, " {%u,%u}", type, lower); in __tipc_nl_compat_publ_dump()
961 tipc_tlv_sprintf(msg->rep, " {%u,%u,%u}", type, lower, upper); in __tipc_nl_compat_publ_dump()
966 static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) in tipc_nl_compat_publ_dump() argument
1002 err = __tipc_nl_compat_dumpit(&dump, msg, args); in tipc_nl_compat_publ_dump()
1009 static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_sk_dump() argument
1025 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref); in tipc_nl_compat_sk_dump()
1039 tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>", in tipc_nl_compat_sk_dump()
1046 tipc_tlv_sprintf(msg->rep, " via {%u,%u}\n", in tipc_nl_compat_sk_dump()
1050 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1052 tipc_tlv_sprintf(msg->rep, " bound to"); in tipc_nl_compat_sk_dump()
1054 err = tipc_nl_compat_publ_dump(msg, sock_ref); in tipc_nl_compat_sk_dump()
1058 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1063 static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_media_dump() argument
1077 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME, in tipc_nl_compat_media_dump()
1082 static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_node_dump() argument
1100 return tipc_add_tlv(msg->rep, TIPC_TLV_NODE_INFO, &node_info, in tipc_nl_compat_node_dump()
1106 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_net_set() argument
1111 val = ntohl(*(__be32 *)TLV_DATA(msg->req)); in tipc_nl_compat_net_set()
1117 if (msg->cmd == TIPC_CMD_SET_NODE_ADDR) { in tipc_nl_compat_net_set()
1120 } else if (msg->cmd == TIPC_CMD_SET_NETID) { in tipc_nl_compat_net_set()
1129 static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_net_dump() argument
1146 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); in tipc_nl_compat_net_dump()
1149 static int tipc_cmd_show_stats_compat(struct tipc_nl_compat_msg *msg) in tipc_cmd_show_stats_compat() argument
1151 msg->rep = tipc_tlv_alloc(ULTRA_STRING_MAX_LEN); in tipc_cmd_show_stats_compat()
1152 if (!msg->rep) in tipc_cmd_show_stats_compat()
1155 tipc_tlv_init(msg->rep, TIPC_TLV_ULTRA_STRING); in tipc_cmd_show_stats_compat()
1156 tipc_tlv_sprintf(msg->rep, "TIPC version " TIPC_MOD_VER "\n"); in tipc_cmd_show_stats_compat()
1161 static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_handle() argument
1169 switch (msg->cmd) { in tipc_nl_compat_handle()
1171 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_handle()
1172 if (!msg->rep) in tipc_nl_compat_handle()
1176 msg->rep_size = MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME); in tipc_nl_compat_handle()
1179 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1181 msg->req_type = TIPC_TLV_BEARER_CONFIG; in tipc_nl_compat_handle()
1184 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1186 msg->req_type = TIPC_TLV_BEARER_NAME; in tipc_nl_compat_handle()
1189 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1191 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1192 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1193 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1196 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1198 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1199 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1202 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1206 msg->req_type = TIPC_TLV_LINK_CONFIG; in tipc_nl_compat_handle()
1209 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1211 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1214 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1216 msg->req_type = TIPC_TLV_NAME_TBL_QUERY; in tipc_nl_compat_handle()
1217 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1218 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1222 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1224 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1225 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1228 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1230 msg->rep_size = MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME); in tipc_nl_compat_handle()
1233 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1235 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1238 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1240 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1243 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1245 msg->req_type = TIPC_TLV_UNSIGNED; in tipc_nl_compat_handle()
1248 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1250 msg->rep_size = sizeof(u32); in tipc_nl_compat_handle()
1253 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1255 return tipc_cmd_show_stats_compat(msg); in tipc_nl_compat_handle()
1265 struct tipc_nl_compat_msg msg; in tipc_nl_compat_recv() local
1270 memset(&msg, 0, sizeof(msg)); in tipc_nl_compat_recv()
1273 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN; in tipc_nl_compat_recv()
1274 msg.cmd = req_userhdr->cmd; in tipc_nl_compat_recv()
1275 msg.net = genl_info_net(info); in tipc_nl_compat_recv()
1276 msg.dst_sk = skb->sk; in tipc_nl_compat_recv()
1278 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) { in tipc_nl_compat_recv()
1279 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_NET_ADMIN); in tipc_nl_compat_recv()
1284 msg.req_size = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); in tipc_nl_compat_recv()
1285 if (msg.req_size && !TLV_OK(msg.req, msg.req_size)) { in tipc_nl_compat_recv()
1286 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1291 err = tipc_nl_compat_handle(&msg); in tipc_nl_compat_recv()
1293 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1295 msg.rep = tipc_get_err_tlv(TIPC_CFG_TLV_ERROR); in tipc_nl_compat_recv()
1297 if (!msg.rep) in tipc_nl_compat_recv()
1301 skb_push(msg.rep, len); in tipc_nl_compat_recv()
1302 rep_nlh = nlmsg_hdr(msg.rep); in tipc_nl_compat_recv()
1304 rep_nlh->nlmsg_len = msg.rep->len; in tipc_nl_compat_recv()
1305 genlmsg_unicast(msg.net, msg.rep, NETLINK_CB(skb).portid); in tipc_nl_compat_recv()