Lines Matching refs:msg
67 int (*format)(struct tipc_nl_compat_msg *msg, struct nlattr **attrs);
73 struct sk_buff *skb, struct tipc_nl_compat_msg *msg);
170 struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_dumpit() argument
187 buf->sk = msg->dst_sk; in __tipc_nl_compat_dumpit()
201 err = (*cmd->format)(msg, attrs); in __tipc_nl_compat_dumpit()
205 if (tipc_skb_tailroom(msg->rep) <= 1) { in __tipc_nl_compat_dumpit()
225 if ((TIPC_SKB_MAX - msg->rep->len) <= 1) { in __tipc_nl_compat_dumpit()
226 char *tail = skb_tail_pointer(msg->rep); in __tipc_nl_compat_dumpit()
240 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_dumpit() argument
245 if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type)) in tipc_nl_compat_dumpit()
248 msg->rep = tipc_tlv_alloc(msg->rep_size); in tipc_nl_compat_dumpit()
249 if (!msg->rep) in tipc_nl_compat_dumpit()
252 if (msg->rep_type) in tipc_nl_compat_dumpit()
253 tipc_tlv_init(msg->rep, msg->rep_type); in tipc_nl_compat_dumpit()
256 (*cmd->header)(msg); in tipc_nl_compat_dumpit()
260 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
264 err = __tipc_nl_compat_dumpit(cmd, msg, arg); in tipc_nl_compat_dumpit()
266 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
274 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_doit() argument
286 err = (*cmd->transcode)(cmd, trans_buf, msg); in __tipc_nl_compat_doit()
309 doit_buf->sk = msg->dst_sk; in __tipc_nl_compat_doit()
326 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_doit() argument
330 if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type)) in tipc_nl_compat_doit()
333 err = __tipc_nl_compat_doit(cmd, msg); in tipc_nl_compat_doit()
338 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_doit()
339 if (!msg->rep) in tipc_nl_compat_doit()
345 static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_bearer_dump() argument
353 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME, in tipc_nl_compat_bearer_dump()
360 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_enable() argument
366 b = (struct tipc_bearer_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_enable()
393 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_disable() argument
398 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_disable()
417 static void __fill_bc_link_stat(struct tipc_nl_compat_msg *msg, in __fill_bc_link_stat() argument
420 tipc_tlv_sprintf(msg->rep, " Window:%u packets\n", in __fill_bc_link_stat()
423 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
431 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
439 tipc_tlv_sprintf(msg->rep, " RX naks:%u defs:%u dups:%u\n", in __fill_bc_link_stat()
444 tipc_tlv_sprintf(msg->rep, " TX naks:%u acks:%u dups:%u\n", in __fill_bc_link_stat()
449 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
456 static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_stat_dump() argument
472 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_stat_dump()
476 tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n", in tipc_nl_compat_link_stat_dump()
480 __fill_bc_link_stat(msg, prop, stats); in tipc_nl_compat_link_stat_dump()
485 tipc_tlv_sprintf(msg->rep, " ACTIVE"); in tipc_nl_compat_link_stat_dump()
487 tipc_tlv_sprintf(msg->rep, " STANDBY"); in tipc_nl_compat_link_stat_dump()
489 tipc_tlv_sprintf(msg->rep, " DEFUNCT"); in tipc_nl_compat_link_stat_dump()
491 tipc_tlv_sprintf(msg->rep, " MTU:%u Priority:%u", in tipc_nl_compat_link_stat_dump()
495 tipc_tlv_sprintf(msg->rep, " Tolerance:%u ms Window:%u packets\n", in tipc_nl_compat_link_stat_dump()
499 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
508 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
517 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
523 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
534 tipc_tlv_sprintf(msg->rep, "-16384:%u%% -32768:%u%% -66000:%u%%\n", in tipc_nl_compat_link_stat_dump()
542 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
550 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
558 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
567 static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_dump() argument
579 return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, in tipc_nl_compat_link_dump()
584 struct tipc_nl_compat_msg *msg, in __tipc_add_link_prop() argument
587 switch (msg->cmd) { in __tipc_add_link_prop()
600 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_media_set() argument
606 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_media_set()
619 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_media_set()
627 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_set() argument
633 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_set()
646 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_bearer_set()
654 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_link_set() argument
660 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in __tipc_nl_compat_link_set()
673 __tipc_add_link_prop(skb, msg, lc); in __tipc_nl_compat_link_set()
682 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_set() argument
688 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_link_set()
693 return tipc_nl_compat_media_set(skb, msg); in tipc_nl_compat_link_set()
696 bearer = tipc_bearer_find(msg->net, lc->name); in tipc_nl_compat_link_set()
699 return tipc_nl_compat_bearer_set(skb, msg); in tipc_nl_compat_link_set()
702 return __tipc_nl_compat_link_set(skb, msg); in tipc_nl_compat_link_set()
707 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_reset_stats() argument
712 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_reset_stats()
726 static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_name_table_dump_header() argument
738 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump_header()
745 tipc_tlv_sprintf(msg->rep, header[i]); in tipc_nl_compat_name_table_dump_header()
746 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump_header()
751 static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_name_table_dump() argument
768 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump()
783 tipc_tlv_sprintf(msg->rep, "%-10u ", in tipc_nl_compat_name_table_dump()
789 tipc_tlv_sprintf(msg->rep, "%-10u %-10u ", in tipc_nl_compat_name_table_dump()
799 tipc_tlv_sprintf(msg->rep, "%-26s ", port_str); in tipc_nl_compat_name_table_dump()
804 tipc_tlv_sprintf(msg->rep, "%-10u %s", in tipc_nl_compat_name_table_dump()
808 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump()
813 static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_publ_dump() argument
826 tipc_tlv_sprintf(msg->rep, " {%u,%u}", type, lower); in __tipc_nl_compat_publ_dump()
828 tipc_tlv_sprintf(msg->rep, " {%u,%u,%u}", type, lower, upper); in __tipc_nl_compat_publ_dump()
833 static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) in tipc_nl_compat_publ_dump() argument
865 err = __tipc_nl_compat_dumpit(&dump, msg, args); in tipc_nl_compat_publ_dump()
872 static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_sk_dump() argument
882 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref); in tipc_nl_compat_sk_dump()
892 tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>", in tipc_nl_compat_sk_dump()
899 tipc_tlv_sprintf(msg->rep, " via {%u,%u}\n", in tipc_nl_compat_sk_dump()
903 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
905 tipc_tlv_sprintf(msg->rep, " bound to"); in tipc_nl_compat_sk_dump()
907 err = tipc_nl_compat_publ_dump(msg, sock_ref); in tipc_nl_compat_sk_dump()
911 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
916 static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_media_dump() argument
924 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME, in tipc_nl_compat_media_dump()
929 static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_node_dump() argument
940 return tipc_add_tlv(msg->rep, TIPC_TLV_NODE_INFO, &node_info, in tipc_nl_compat_node_dump()
946 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_net_set() argument
951 val = ntohl(*(__be32 *)TLV_DATA(msg->req)); in tipc_nl_compat_net_set()
957 if (msg->cmd == TIPC_CMD_SET_NODE_ADDR) { in tipc_nl_compat_net_set()
960 } else if (msg->cmd == TIPC_CMD_SET_NETID) { in tipc_nl_compat_net_set()
969 static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_net_dump() argument
978 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); in tipc_nl_compat_net_dump()
981 static int tipc_cmd_show_stats_compat(struct tipc_nl_compat_msg *msg) in tipc_cmd_show_stats_compat() argument
983 msg->rep = tipc_tlv_alloc(ULTRA_STRING_MAX_LEN); in tipc_cmd_show_stats_compat()
984 if (!msg->rep) in tipc_cmd_show_stats_compat()
987 tipc_tlv_init(msg->rep, TIPC_TLV_ULTRA_STRING); in tipc_cmd_show_stats_compat()
988 tipc_tlv_sprintf(msg->rep, "TIPC version " TIPC_MOD_VER "\n"); in tipc_cmd_show_stats_compat()
993 static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_handle() argument
1001 switch (msg->cmd) { in tipc_nl_compat_handle()
1003 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_handle()
1004 if (!msg->rep) in tipc_nl_compat_handle()
1008 msg->rep_size = MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME); in tipc_nl_compat_handle()
1011 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1013 msg->req_type = TIPC_TLV_BEARER_CONFIG; in tipc_nl_compat_handle()
1016 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1018 msg->req_type = TIPC_TLV_BEARER_NAME; in tipc_nl_compat_handle()
1021 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1023 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1024 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1025 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1028 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1030 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1031 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1034 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1038 msg->req_type = TIPC_TLV_LINK_CONFIG; in tipc_nl_compat_handle()
1041 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1043 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1046 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1048 msg->req_type = TIPC_TLV_NAME_TBL_QUERY; in tipc_nl_compat_handle()
1049 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1050 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1054 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1056 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1057 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1060 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1062 msg->rep_size = MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME); in tipc_nl_compat_handle()
1065 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1067 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1070 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1072 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1075 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1077 msg->req_type = TIPC_TLV_UNSIGNED; in tipc_nl_compat_handle()
1080 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1082 msg->rep_size = sizeof(u32); in tipc_nl_compat_handle()
1085 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1087 return tipc_cmd_show_stats_compat(msg); in tipc_nl_compat_handle()
1097 struct tipc_nl_compat_msg msg; in tipc_nl_compat_recv() local
1102 memset(&msg, 0, sizeof(msg)); in tipc_nl_compat_recv()
1105 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN; in tipc_nl_compat_recv()
1106 msg.cmd = req_userhdr->cmd; in tipc_nl_compat_recv()
1107 msg.dst_sk = info->dst_sk; in tipc_nl_compat_recv()
1108 msg.net = genl_info_net(info); in tipc_nl_compat_recv()
1110 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) { in tipc_nl_compat_recv()
1111 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_NET_ADMIN); in tipc_nl_compat_recv()
1117 if (len && !TLV_OK(msg.req, len)) { in tipc_nl_compat_recv()
1118 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1123 err = tipc_nl_compat_handle(&msg); in tipc_nl_compat_recv()
1125 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1127 msg.rep = tipc_get_err_tlv(TIPC_CFG_TLV_ERROR); in tipc_nl_compat_recv()
1129 if (!msg.rep) in tipc_nl_compat_recv()
1133 skb_push(msg.rep, len); in tipc_nl_compat_recv()
1134 rep_nlh = nlmsg_hdr(msg.rep); in tipc_nl_compat_recv()
1136 rep_nlh->nlmsg_len = msg.rep->len; in tipc_nl_compat_recv()
1137 genlmsg_unicast(msg.net, msg.rep, NETLINK_CB(skb).portid); in tipc_nl_compat_recv()