Lines Matching refs:msg

66 	int (*format)(struct tipc_nl_compat_msg *msg, struct nlattr **attrs);
71 int (*transcode)(struct sk_buff *skb, struct tipc_nl_compat_msg *msg);
168 struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_dumpit() argument
185 buf->sk = msg->dst_sk; in __tipc_nl_compat_dumpit()
199 err = (*cmd->format)(msg, attrs); in __tipc_nl_compat_dumpit()
203 if (tipc_skb_tailroom(msg->rep) <= 1) { in __tipc_nl_compat_dumpit()
223 if ((TIPC_SKB_MAX - msg->rep->len) <= 1) { in __tipc_nl_compat_dumpit()
224 char *tail = skb_tail_pointer(msg->rep); in __tipc_nl_compat_dumpit()
238 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_dumpit() argument
243 if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type)) in tipc_nl_compat_dumpit()
246 msg->rep = tipc_tlv_alloc(msg->rep_size); in tipc_nl_compat_dumpit()
247 if (!msg->rep) in tipc_nl_compat_dumpit()
250 if (msg->rep_type) in tipc_nl_compat_dumpit()
251 tipc_tlv_init(msg->rep, msg->rep_type); in tipc_nl_compat_dumpit()
254 (*cmd->header)(msg); in tipc_nl_compat_dumpit()
258 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
262 err = __tipc_nl_compat_dumpit(cmd, msg, arg); in tipc_nl_compat_dumpit()
264 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
272 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_doit() argument
284 err = (*cmd->transcode)(trans_buf, msg); in __tipc_nl_compat_doit()
307 doit_buf->sk = msg->dst_sk; in __tipc_nl_compat_doit()
324 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_doit() argument
328 if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type)) in tipc_nl_compat_doit()
331 err = __tipc_nl_compat_doit(cmd, msg); in tipc_nl_compat_doit()
336 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_doit()
337 if (!msg->rep) in tipc_nl_compat_doit()
343 static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_bearer_dump() argument
351 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME, in tipc_nl_compat_bearer_dump()
357 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_enable() argument
363 b = (struct tipc_bearer_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_enable()
389 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_disable() argument
394 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_disable()
413 static void __fill_bc_link_stat(struct tipc_nl_compat_msg *msg, in __fill_bc_link_stat() argument
416 tipc_tlv_sprintf(msg->rep, " Window:%u packets\n", in __fill_bc_link_stat()
419 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
427 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
435 tipc_tlv_sprintf(msg->rep, " RX naks:%u defs:%u dups:%u\n", in __fill_bc_link_stat()
440 tipc_tlv_sprintf(msg->rep, " TX naks:%u acks:%u dups:%u\n", in __fill_bc_link_stat()
445 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
452 static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_stat_dump() argument
468 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_stat_dump()
472 tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n", in tipc_nl_compat_link_stat_dump()
476 __fill_bc_link_stat(msg, prop, stats); in tipc_nl_compat_link_stat_dump()
481 tipc_tlv_sprintf(msg->rep, " ACTIVE"); in tipc_nl_compat_link_stat_dump()
483 tipc_tlv_sprintf(msg->rep, " STANDBY"); in tipc_nl_compat_link_stat_dump()
485 tipc_tlv_sprintf(msg->rep, " DEFUNCT"); in tipc_nl_compat_link_stat_dump()
487 tipc_tlv_sprintf(msg->rep, " MTU:%u Priority:%u", in tipc_nl_compat_link_stat_dump()
491 tipc_tlv_sprintf(msg->rep, " Tolerance:%u ms Window:%u packets\n", in tipc_nl_compat_link_stat_dump()
495 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
504 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
513 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
519 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
530 tipc_tlv_sprintf(msg->rep, "-16384:%u%% -32768:%u%% -66000:%u%%\n", in tipc_nl_compat_link_stat_dump()
538 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
546 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
554 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
563 static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_dump() argument
575 return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, in tipc_nl_compat_link_dump()
580 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_set() argument
586 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_link_set()
599 if (msg->cmd == TIPC_CMD_SET_LINK_PRI) { in tipc_nl_compat_link_set()
602 } else if (msg->cmd == TIPC_CMD_SET_LINK_TOL) { in tipc_nl_compat_link_set()
605 } else if (msg->cmd == TIPC_CMD_SET_LINK_WINDOW) { in tipc_nl_compat_link_set()
617 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_reset_stats() argument
622 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_reset_stats()
636 static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_name_table_dump_header() argument
648 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump_header()
655 tipc_tlv_sprintf(msg->rep, header[i]); in tipc_nl_compat_name_table_dump_header()
656 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump_header()
661 static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_name_table_dump() argument
678 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump()
693 tipc_tlv_sprintf(msg->rep, "%-10u ", in tipc_nl_compat_name_table_dump()
699 tipc_tlv_sprintf(msg->rep, "%-10u %-10u ", in tipc_nl_compat_name_table_dump()
709 tipc_tlv_sprintf(msg->rep, "%-26s ", port_str); in tipc_nl_compat_name_table_dump()
714 tipc_tlv_sprintf(msg->rep, "%-10u %s", in tipc_nl_compat_name_table_dump()
718 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump()
723 static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_publ_dump() argument
736 tipc_tlv_sprintf(msg->rep, " {%u,%u}", type, lower); in __tipc_nl_compat_publ_dump()
738 tipc_tlv_sprintf(msg->rep, " {%u,%u,%u}", type, lower, upper); in __tipc_nl_compat_publ_dump()
743 static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) in tipc_nl_compat_publ_dump() argument
775 err = __tipc_nl_compat_dumpit(&dump, msg, args); in tipc_nl_compat_publ_dump()
782 static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_sk_dump() argument
792 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref); in tipc_nl_compat_sk_dump()
802 tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>", in tipc_nl_compat_sk_dump()
809 tipc_tlv_sprintf(msg->rep, " via {%u,%u}\n", in tipc_nl_compat_sk_dump()
813 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
815 tipc_tlv_sprintf(msg->rep, " bound to"); in tipc_nl_compat_sk_dump()
817 err = tipc_nl_compat_publ_dump(msg, sock_ref); in tipc_nl_compat_sk_dump()
821 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
826 static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_media_dump() argument
834 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME, in tipc_nl_compat_media_dump()
839 static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_node_dump() argument
850 return tipc_add_tlv(msg->rep, TIPC_TLV_NODE_INFO, &node_info, in tipc_nl_compat_node_dump()
855 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_net_set() argument
860 val = ntohl(*(__be32 *)TLV_DATA(msg->req)); in tipc_nl_compat_net_set()
866 if (msg->cmd == TIPC_CMD_SET_NODE_ADDR) { in tipc_nl_compat_net_set()
869 } else if (msg->cmd == TIPC_CMD_SET_NETID) { in tipc_nl_compat_net_set()
878 static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_net_dump() argument
887 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); in tipc_nl_compat_net_dump()
890 static int tipc_cmd_show_stats_compat(struct tipc_nl_compat_msg *msg) in tipc_cmd_show_stats_compat() argument
892 msg->rep = tipc_tlv_alloc(ULTRA_STRING_MAX_LEN); in tipc_cmd_show_stats_compat()
893 if (!msg->rep) in tipc_cmd_show_stats_compat()
896 tipc_tlv_init(msg->rep, TIPC_TLV_ULTRA_STRING); in tipc_cmd_show_stats_compat()
897 tipc_tlv_sprintf(msg->rep, "TIPC version " TIPC_MOD_VER "\n"); in tipc_cmd_show_stats_compat()
902 static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_handle() argument
910 switch (msg->cmd) { in tipc_nl_compat_handle()
912 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_handle()
913 if (!msg->rep) in tipc_nl_compat_handle()
917 msg->rep_size = MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME); in tipc_nl_compat_handle()
920 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
922 msg->req_type = TIPC_TLV_BEARER_CONFIG; in tipc_nl_compat_handle()
925 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
927 msg->req_type = TIPC_TLV_BEARER_NAME; in tipc_nl_compat_handle()
930 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
932 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
933 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
934 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
937 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
939 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
940 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
943 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
947 msg->req_type = TIPC_TLV_LINK_CONFIG; in tipc_nl_compat_handle()
950 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
952 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
955 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
957 msg->req_type = TIPC_TLV_NAME_TBL_QUERY; in tipc_nl_compat_handle()
958 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
959 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
963 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
965 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
966 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
969 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
971 msg->rep_size = MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME); in tipc_nl_compat_handle()
974 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
976 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
979 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
981 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
984 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
986 msg->req_type = TIPC_TLV_UNSIGNED; in tipc_nl_compat_handle()
989 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
991 msg->rep_size = sizeof(u32); in tipc_nl_compat_handle()
994 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
996 return tipc_cmd_show_stats_compat(msg); in tipc_nl_compat_handle()
1006 struct tipc_nl_compat_msg msg; in tipc_nl_compat_recv() local
1012 memset(&msg, 0, sizeof(msg)); in tipc_nl_compat_recv()
1015 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN; in tipc_nl_compat_recv()
1016 msg.cmd = req_userhdr->cmd; in tipc_nl_compat_recv()
1017 msg.dst_sk = info->dst_sk; in tipc_nl_compat_recv()
1019 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) { in tipc_nl_compat_recv()
1020 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_NET_ADMIN); in tipc_nl_compat_recv()
1026 if (TLV_GET_LEN(msg.req) && !TLV_OK(msg.req, len)) { in tipc_nl_compat_recv()
1027 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1032 err = tipc_nl_compat_handle(&msg); in tipc_nl_compat_recv()
1034 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1036 msg.rep = tipc_get_err_tlv(TIPC_CFG_TLV_ERROR); in tipc_nl_compat_recv()
1038 if (!msg.rep) in tipc_nl_compat_recv()
1042 skb_push(msg.rep, len); in tipc_nl_compat_recv()
1043 rep_nlh = nlmsg_hdr(msg.rep); in tipc_nl_compat_recv()
1045 rep_nlh->nlmsg_len = msg.rep->len; in tipc_nl_compat_recv()
1046 genlmsg_unicast(net, msg.rep, NETLINK_CB(skb).portid); in tipc_nl_compat_recv()