Lines Matching full:msg

68 	int (*format)(struct tipc_nl_compat_msg *msg, struct nlattr **attrs);
74 struct sk_buff *skb, struct tipc_nl_compat_msg *msg);
182 struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_dumpit() argument
202 buf->sk = msg->dst_sk; in __tipc_nl_compat_dumpit()
203 if (__tipc_dump_start(&cb, msg->net)) { in __tipc_nl_compat_dumpit()
238 err = (*cmd->format)(msg, attrbuf); in __tipc_nl_compat_dumpit()
242 if (tipc_skb_tailroom(msg->rep) <= 1) { in __tipc_nl_compat_dumpit()
264 if ((TIPC_SKB_MAX - msg->rep->len) <= 1) { in __tipc_nl_compat_dumpit()
265 char *tail = skb_tail_pointer(msg->rep); in __tipc_nl_compat_dumpit()
279 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_dumpit() argument
285 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_dumpit()
286 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_dumpit()
289 msg->rep = tipc_tlv_alloc(msg->rep_size); in tipc_nl_compat_dumpit()
290 if (!msg->rep) in tipc_nl_compat_dumpit()
293 if (msg->rep_type) in tipc_nl_compat_dumpit()
294 tipc_tlv_init(msg->rep, msg->rep_type); in tipc_nl_compat_dumpit()
297 err = (*cmd->header)(msg); in tipc_nl_compat_dumpit()
299 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
300 msg->rep = NULL; in tipc_nl_compat_dumpit()
307 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
308 msg->rep = NULL; in tipc_nl_compat_dumpit()
315 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
316 msg->rep = NULL; in tipc_nl_compat_dumpit()
321 err = __tipc_nl_compat_dumpit(cmd, msg, arg); in tipc_nl_compat_dumpit()
323 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
324 msg->rep = NULL; in tipc_nl_compat_dumpit()
332 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_doit() argument
362 err = (*cmd->transcode)(cmd, trans_buf, msg); in __tipc_nl_compat_doit()
372 doit_buf->sk = msg->dst_sk; in __tipc_nl_compat_doit()
388 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_doit() argument
392 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_doit()
393 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_doit()
396 err = __tipc_nl_compat_doit(cmd, msg); in tipc_nl_compat_doit()
401 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_doit()
402 if (!msg->rep) in tipc_nl_compat_doit()
408 static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_bearer_dump() argument
422 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME, in tipc_nl_compat_bearer_dump()
429 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_enable() argument
436 b = (struct tipc_bearer_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_enable()
442 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_enable()
472 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_disable() argument
478 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_disable()
484 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_disable()
505 static void __fill_bc_link_stat(struct tipc_nl_compat_msg *msg, in __fill_bc_link_stat() argument
508 tipc_tlv_sprintf(msg->rep, " Window:%u packets\n", in __fill_bc_link_stat()
511 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
519 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
527 tipc_tlv_sprintf(msg->rep, " RX naks:%u defs:%u dups:%u\n", in __fill_bc_link_stat()
532 tipc_tlv_sprintf(msg->rep, " TX naks:%u acks:%u dups:%u\n", in __fill_bc_link_stat()
537 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
544 static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_stat_dump() argument
580 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_stat_dump()
582 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_stat_dump()
593 tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n", in tipc_nl_compat_link_stat_dump()
597 __fill_bc_link_stat(msg, prop, stats); in tipc_nl_compat_link_stat_dump()
602 tipc_tlv_sprintf(msg->rep, " ACTIVE"); in tipc_nl_compat_link_stat_dump()
604 tipc_tlv_sprintf(msg->rep, " STANDBY"); in tipc_nl_compat_link_stat_dump()
606 tipc_tlv_sprintf(msg->rep, " DEFUNCT"); in tipc_nl_compat_link_stat_dump()
608 tipc_tlv_sprintf(msg->rep, " MTU:%u Priority:%u", in tipc_nl_compat_link_stat_dump()
612 tipc_tlv_sprintf(msg->rep, " Tolerance:%u ms Window:%u packets\n", in tipc_nl_compat_link_stat_dump()
616 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
625 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()
640 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
651 tipc_tlv_sprintf(msg->rep, "-16384:%u%% -32768:%u%% -66000:%u%%\n", in tipc_nl_compat_link_stat_dump()
659 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
667 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
675 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
684 static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_dump() argument
704 return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, in tipc_nl_compat_link_dump()
709 struct tipc_nl_compat_msg *msg, in __tipc_add_link_prop() argument
712 switch (msg->cmd) { in __tipc_add_link_prop()
725 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_media_set() argument
731 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_media_set()
744 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_media_set()
752 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_set() argument
758 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_set()
771 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_bearer_set()
779 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_link_set() argument
785 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in __tipc_nl_compat_link_set()
798 __tipc_add_link_prop(skb, msg, lc); in __tipc_nl_compat_link_set()
807 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_set() argument
814 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_link_set()
816 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_set()
828 return tipc_nl_compat_media_set(skb, msg); in tipc_nl_compat_link_set()
831 bearer = tipc_bearer_find(msg->net, lc->name); in tipc_nl_compat_link_set()
834 return tipc_nl_compat_bearer_set(skb, msg); in tipc_nl_compat_link_set()
837 return __tipc_nl_compat_link_set(skb, msg); in tipc_nl_compat_link_set()
842 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_reset_stats() argument
848 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_reset_stats()
854 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_reset_stats()
870 static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_name_table_dump_header() argument
882 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump_header()
883 if (TLV_GET_DATA_LEN(msg->req) < (int)sizeof(struct tipc_name_table_query)) in tipc_nl_compat_name_table_dump_header()
891 tipc_tlv_sprintf(msg->rep, header[i]); in tipc_nl_compat_name_table_dump_header()
892 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump_header()
897 static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_name_table_dump() argument
927 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump()
942 tipc_tlv_sprintf(msg->rep, "%-10u ", in tipc_nl_compat_name_table_dump()
948 tipc_tlv_sprintf(msg->rep, "%-10u %-10u ", in tipc_nl_compat_name_table_dump()
958 tipc_tlv_sprintf(msg->rep, "%-26s ", port_str); in tipc_nl_compat_name_table_dump()
963 tipc_tlv_sprintf(msg->rep, "%-10u %s", in tipc_nl_compat_name_table_dump()
967 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump()
972 static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_publ_dump() argument
992 tipc_tlv_sprintf(msg->rep, " {%u,%u}", type, lower); in __tipc_nl_compat_publ_dump()
994 tipc_tlv_sprintf(msg->rep, " {%u,%u,%u}", type, lower, upper); in __tipc_nl_compat_publ_dump()
999 static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) in tipc_nl_compat_publ_dump() argument
1035 err = __tipc_nl_compat_dumpit(&dump, msg, args); in tipc_nl_compat_publ_dump()
1042 static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_sk_dump() argument
1058 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref); in tipc_nl_compat_sk_dump()
1072 tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>", in tipc_nl_compat_sk_dump()
1079 tipc_tlv_sprintf(msg->rep, " via {%u,%u}\n", in tipc_nl_compat_sk_dump()
1083 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1085 tipc_tlv_sprintf(msg->rep, " bound to"); in tipc_nl_compat_sk_dump()
1087 err = tipc_nl_compat_publ_dump(msg, sock_ref); in tipc_nl_compat_sk_dump()
1091 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1096 static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_media_dump() argument
1110 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME, in tipc_nl_compat_media_dump()
1115 static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_node_dump() argument
1133 return tipc_add_tlv(msg->rep, TIPC_TLV_NODE_INFO, &node_info, in tipc_nl_compat_node_dump()
1139 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_net_set() argument
1144 val = ntohl(*(__be32 *)TLV_DATA(msg->req)); in tipc_nl_compat_net_set()
1150 if (msg->cmd == TIPC_CMD_SET_NODE_ADDR) { in tipc_nl_compat_net_set()
1153 } else if (msg->cmd == TIPC_CMD_SET_NETID) { in tipc_nl_compat_net_set()
1162 static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_net_dump() argument
1179 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); in tipc_nl_compat_net_dump()
1182 static int tipc_cmd_show_stats_compat(struct tipc_nl_compat_msg *msg) in tipc_cmd_show_stats_compat() argument
1184 msg->rep = tipc_tlv_alloc(ULTRA_STRING_MAX_LEN); in tipc_cmd_show_stats_compat()
1185 if (!msg->rep) in tipc_cmd_show_stats_compat()
1188 tipc_tlv_init(msg->rep, TIPC_TLV_ULTRA_STRING); in tipc_cmd_show_stats_compat()
1189 tipc_tlv_sprintf(msg->rep, "TIPC version " TIPC_MOD_VER "\n"); in tipc_cmd_show_stats_compat()
1194 static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_handle() argument
1202 switch (msg->cmd) { in tipc_nl_compat_handle()
1204 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_handle()
1205 if (!msg->rep) in tipc_nl_compat_handle()
1209 msg->rep_size = MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME); in tipc_nl_compat_handle()
1212 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1214 msg->req_type = TIPC_TLV_BEARER_CONFIG; in tipc_nl_compat_handle()
1217 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1219 msg->req_type = TIPC_TLV_BEARER_NAME; in tipc_nl_compat_handle()
1222 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1224 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1225 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1226 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1229 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1231 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1232 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1235 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1239 msg->req_type = TIPC_TLV_LINK_CONFIG; in tipc_nl_compat_handle()
1242 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1244 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1247 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1249 msg->req_type = TIPC_TLV_NAME_TBL_QUERY; in tipc_nl_compat_handle()
1250 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1251 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1255 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1257 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1258 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1261 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1263 msg->rep_size = MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME); in tipc_nl_compat_handle()
1266 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1268 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1271 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1273 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1276 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1278 msg->req_type = TIPC_TLV_UNSIGNED; in tipc_nl_compat_handle()
1281 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1283 msg->rep_size = sizeof(u32); in tipc_nl_compat_handle()
1286 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1288 return tipc_cmd_show_stats_compat(msg); in tipc_nl_compat_handle()
1298 struct tipc_nl_compat_msg msg; in tipc_nl_compat_recv() local
1303 memset(&msg, 0, sizeof(msg)); in tipc_nl_compat_recv()
1306 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN; in tipc_nl_compat_recv()
1307 msg.cmd = req_userhdr->cmd; in tipc_nl_compat_recv()
1308 msg.net = genl_info_net(info); in tipc_nl_compat_recv()
1309 msg.dst_sk = skb->sk; in tipc_nl_compat_recv()
1311 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) { in tipc_nl_compat_recv()
1312 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_NET_ADMIN); in tipc_nl_compat_recv()
1317 msg.req_size = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); in tipc_nl_compat_recv()
1318 if (msg.req_size && !TLV_OK(msg.req, msg.req_size)) { in tipc_nl_compat_recv()
1319 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1324 err = tipc_nl_compat_handle(&msg); in tipc_nl_compat_recv()
1326 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1328 msg.rep = tipc_get_err_tlv(TIPC_CFG_TLV_ERROR); in tipc_nl_compat_recv()
1330 if (!msg.rep) in tipc_nl_compat_recv()
1334 skb_push(msg.rep, len); in tipc_nl_compat_recv()
1335 rep_nlh = nlmsg_hdr(msg.rep); in tipc_nl_compat_recv()
1337 rep_nlh->nlmsg_len = msg.rep->len; in tipc_nl_compat_recv()
1338 genlmsg_unicast(msg.net, msg.rep, NETLINK_CB(skb).portid); in tipc_nl_compat_recv()