Lines Matching refs:msg

69 	int (*format)(struct tipc_nl_compat_msg *msg, struct nlattr **attrs);
75 struct sk_buff *skb, struct tipc_nl_compat_msg *msg);
178 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()
234 err = (*cmd->format)(msg, attrbuf); in __tipc_nl_compat_dumpit()
238 if (tipc_skb_tailroom(msg->rep) <= 1) { in __tipc_nl_compat_dumpit()
260 if ((TIPC_SKB_MAX - msg->rep->len) <= 1) { in __tipc_nl_compat_dumpit()
261 char *tail = skb_tail_pointer(msg->rep); in __tipc_nl_compat_dumpit()
275 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_dumpit() argument
281 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_dumpit()
282 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_dumpit()
285 msg->rep = tipc_tlv_alloc(msg->rep_size); in tipc_nl_compat_dumpit()
286 if (!msg->rep) in tipc_nl_compat_dumpit()
289 if (msg->rep_type) in tipc_nl_compat_dumpit()
290 tipc_tlv_init(msg->rep, msg->rep_type); in tipc_nl_compat_dumpit()
293 err = (*cmd->header)(msg); in tipc_nl_compat_dumpit()
295 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
296 msg->rep = NULL; in tipc_nl_compat_dumpit()
303 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
304 msg->rep = NULL; in tipc_nl_compat_dumpit()
311 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
312 msg->rep = NULL; in tipc_nl_compat_dumpit()
317 err = __tipc_nl_compat_dumpit(cmd, msg, arg); in tipc_nl_compat_dumpit()
319 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
320 msg->rep = NULL; in tipc_nl_compat_dumpit()
328 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_doit() argument
358 err = (*cmd->transcode)(cmd, trans_buf, msg); in __tipc_nl_compat_doit()
368 doit_buf->sk = msg->dst_sk; in __tipc_nl_compat_doit()
384 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_doit() argument
388 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_doit()
389 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_doit()
392 err = __tipc_nl_compat_doit(cmd, msg); in tipc_nl_compat_doit()
397 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_doit()
398 if (!msg->rep) in tipc_nl_compat_doit()
404 static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_bearer_dump() argument
418 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME, in tipc_nl_compat_bearer_dump()
425 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_enable() argument
432 b = (struct tipc_bearer_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_enable()
438 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_enable()
468 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_disable() argument
474 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_disable()
480 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_disable()
501 static void __fill_bc_link_stat(struct tipc_nl_compat_msg *msg, in __fill_bc_link_stat() argument
504 tipc_tlv_sprintf(msg->rep, " Window:%u packets\n", in __fill_bc_link_stat()
507 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
515 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
523 tipc_tlv_sprintf(msg->rep, " RX naks:%u defs:%u dups:%u\n", in __fill_bc_link_stat()
528 tipc_tlv_sprintf(msg->rep, " TX naks:%u acks:%u dups:%u\n", in __fill_bc_link_stat()
533 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
540 static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_stat_dump() argument
576 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_stat_dump()
578 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_stat_dump()
589 tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n", in tipc_nl_compat_link_stat_dump()
593 __fill_bc_link_stat(msg, prop, stats); in tipc_nl_compat_link_stat_dump()
598 tipc_tlv_sprintf(msg->rep, " ACTIVE"); in tipc_nl_compat_link_stat_dump()
600 tipc_tlv_sprintf(msg->rep, " STANDBY"); in tipc_nl_compat_link_stat_dump()
602 tipc_tlv_sprintf(msg->rep, " DEFUNCT"); in tipc_nl_compat_link_stat_dump()
604 tipc_tlv_sprintf(msg->rep, " MTU:%u Priority:%u", in tipc_nl_compat_link_stat_dump()
608 tipc_tlv_sprintf(msg->rep, " Tolerance:%u ms Window:%u packets\n", in tipc_nl_compat_link_stat_dump()
612 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
621 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
630 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
636 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
647 tipc_tlv_sprintf(msg->rep, "-16384:%u%% -32768:%u%% -66000:%u%%\n", in tipc_nl_compat_link_stat_dump()
655 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
663 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
671 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
680 static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_dump() argument
700 return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, in tipc_nl_compat_link_dump()
705 struct tipc_nl_compat_msg *msg, in __tipc_add_link_prop() argument
708 switch (msg->cmd) { in __tipc_add_link_prop()
721 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_media_set() argument
727 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_media_set()
740 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_media_set()
748 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_set() argument
754 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_set()
767 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_bearer_set()
775 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()
794 __tipc_add_link_prop(skb, msg, lc); in __tipc_nl_compat_link_set()
803 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_set() argument
810 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_link_set()
812 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_set()
824 return tipc_nl_compat_media_set(skb, msg); in tipc_nl_compat_link_set()
827 bearer = tipc_bearer_find(msg->net, lc->name); in tipc_nl_compat_link_set()
830 return tipc_nl_compat_bearer_set(skb, msg); in tipc_nl_compat_link_set()
833 return __tipc_nl_compat_link_set(skb, msg); in tipc_nl_compat_link_set()
838 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_reset_stats() argument
844 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_reset_stats()
850 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_reset_stats()
866 static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_name_table_dump_header() argument
878 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump_header()
879 if (TLV_GET_DATA_LEN(msg->req) < (int)sizeof(struct tipc_name_table_query)) in tipc_nl_compat_name_table_dump_header()
887 tipc_tlv_sprintf(msg->rep, header[i]); in tipc_nl_compat_name_table_dump_header()
888 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump_header()
893 static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_name_table_dump() argument
923 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump()
938 tipc_tlv_sprintf(msg->rep, "%-10u ", in tipc_nl_compat_name_table_dump()
944 tipc_tlv_sprintf(msg->rep, "%-10u %-10u ", in tipc_nl_compat_name_table_dump()
954 tipc_tlv_sprintf(msg->rep, "%-26s ", port_str); in tipc_nl_compat_name_table_dump()
959 tipc_tlv_sprintf(msg->rep, "%-10u %s", in tipc_nl_compat_name_table_dump()
963 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump()
968 static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_publ_dump() argument
988 tipc_tlv_sprintf(msg->rep, " {%u,%u}", type, lower); in __tipc_nl_compat_publ_dump()
990 tipc_tlv_sprintf(msg->rep, " {%u,%u,%u}", type, lower, upper); in __tipc_nl_compat_publ_dump()
995 static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) in tipc_nl_compat_publ_dump() argument
1031 err = __tipc_nl_compat_dumpit(&dump, msg, args); in tipc_nl_compat_publ_dump()
1038 static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_sk_dump() argument
1054 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref); in tipc_nl_compat_sk_dump()
1068 tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>", in tipc_nl_compat_sk_dump()
1075 tipc_tlv_sprintf(msg->rep, " via {%u,%u}\n", in tipc_nl_compat_sk_dump()
1079 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1081 tipc_tlv_sprintf(msg->rep, " bound to"); in tipc_nl_compat_sk_dump()
1083 err = tipc_nl_compat_publ_dump(msg, sock_ref); in tipc_nl_compat_sk_dump()
1087 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1092 static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_media_dump() argument
1106 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME, in tipc_nl_compat_media_dump()
1111 static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_node_dump() argument
1129 return tipc_add_tlv(msg->rep, TIPC_TLV_NODE_INFO, &node_info, in tipc_nl_compat_node_dump()
1135 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_net_set() argument
1140 val = ntohl(*(__be32 *)TLV_DATA(msg->req)); in tipc_nl_compat_net_set()
1146 if (msg->cmd == TIPC_CMD_SET_NODE_ADDR) { in tipc_nl_compat_net_set()
1149 } else if (msg->cmd == TIPC_CMD_SET_NETID) { in tipc_nl_compat_net_set()
1158 static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_net_dump() argument
1175 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); in tipc_nl_compat_net_dump()
1178 static int tipc_cmd_show_stats_compat(struct tipc_nl_compat_msg *msg) in tipc_cmd_show_stats_compat() argument
1180 msg->rep = tipc_tlv_alloc(ULTRA_STRING_MAX_LEN); in tipc_cmd_show_stats_compat()
1181 if (!msg->rep) in tipc_cmd_show_stats_compat()
1184 tipc_tlv_init(msg->rep, TIPC_TLV_ULTRA_STRING); in tipc_cmd_show_stats_compat()
1185 tipc_tlv_sprintf(msg->rep, "TIPC version " TIPC_MOD_VER "\n"); in tipc_cmd_show_stats_compat()
1190 static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_handle() argument
1198 switch (msg->cmd) { in tipc_nl_compat_handle()
1200 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_handle()
1201 if (!msg->rep) in tipc_nl_compat_handle()
1205 msg->rep_size = MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME); in tipc_nl_compat_handle()
1208 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1210 msg->req_type = TIPC_TLV_BEARER_CONFIG; in tipc_nl_compat_handle()
1213 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1215 msg->req_type = TIPC_TLV_BEARER_NAME; in tipc_nl_compat_handle()
1218 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1220 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1221 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1222 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1225 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1227 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1228 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1231 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1235 msg->req_type = TIPC_TLV_LINK_CONFIG; in tipc_nl_compat_handle()
1238 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1240 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1243 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1245 msg->req_type = TIPC_TLV_NAME_TBL_QUERY; in tipc_nl_compat_handle()
1246 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1247 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1251 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1253 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1254 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1257 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1259 msg->rep_size = MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME); in tipc_nl_compat_handle()
1262 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1264 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1267 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1269 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1272 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1274 msg->req_type = TIPC_TLV_UNSIGNED; in tipc_nl_compat_handle()
1277 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1279 msg->rep_size = sizeof(u32); in tipc_nl_compat_handle()
1282 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1284 return tipc_cmd_show_stats_compat(msg); in tipc_nl_compat_handle()
1294 struct tipc_nl_compat_msg msg; in tipc_nl_compat_recv() local
1299 memset(&msg, 0, sizeof(msg)); in tipc_nl_compat_recv()
1302 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN; in tipc_nl_compat_recv()
1303 msg.cmd = req_userhdr->cmd; in tipc_nl_compat_recv()
1304 msg.net = genl_info_net(info); in tipc_nl_compat_recv()
1305 msg.dst_sk = skb->sk; in tipc_nl_compat_recv()
1307 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) { in tipc_nl_compat_recv()
1308 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_NET_ADMIN); in tipc_nl_compat_recv()
1313 msg.req_size = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); in tipc_nl_compat_recv()
1314 if (msg.req_size && !TLV_OK(msg.req, msg.req_size)) { in tipc_nl_compat_recv()
1315 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1320 err = tipc_nl_compat_handle(&msg); in tipc_nl_compat_recv()
1322 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1324 msg.rep = tipc_get_err_tlv(TIPC_CFG_TLV_ERROR); in tipc_nl_compat_recv()
1326 if (!msg.rep) in tipc_nl_compat_recv()
1330 skb_push(msg.rep, len); in tipc_nl_compat_recv()
1331 rep_nlh = nlmsg_hdr(msg.rep); in tipc_nl_compat_recv()
1333 rep_nlh->nlmsg_len = msg.rep->len; in tipc_nl_compat_recv()
1334 genlmsg_unicast(msg.net, msg.rep, NETLINK_CB(skb).portid); in tipc_nl_compat_recv()