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);
179 struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_dumpit() argument
199 buf->sk = msg->dst_sk; in __tipc_nl_compat_dumpit()
200 if (__tipc_dump_start(&cb, msg->net)) { in __tipc_nl_compat_dumpit()
235 err = (*cmd->format)(msg, attrbuf); in __tipc_nl_compat_dumpit()
239 if (tipc_skb_tailroom(msg->rep) <= 1) { in __tipc_nl_compat_dumpit()
261 if ((TIPC_SKB_MAX - msg->rep->len) <= 1) { in __tipc_nl_compat_dumpit()
262 char *tail = skb_tail_pointer(msg->rep); in __tipc_nl_compat_dumpit()
276 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_dumpit() argument
282 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_dumpit()
283 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_dumpit()
286 msg->rep = tipc_tlv_alloc(msg->rep_size); in tipc_nl_compat_dumpit()
287 if (!msg->rep) in tipc_nl_compat_dumpit()
290 if (msg->rep_type) in tipc_nl_compat_dumpit()
291 tipc_tlv_init(msg->rep, msg->rep_type); in tipc_nl_compat_dumpit()
294 err = (*cmd->header)(msg); in tipc_nl_compat_dumpit()
296 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
297 msg->rep = NULL; in tipc_nl_compat_dumpit()
304 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
305 msg->rep = NULL; in tipc_nl_compat_dumpit()
312 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
313 msg->rep = NULL; in tipc_nl_compat_dumpit()
318 err = __tipc_nl_compat_dumpit(cmd, msg, arg); in tipc_nl_compat_dumpit()
320 kfree_skb(msg->rep); in tipc_nl_compat_dumpit()
321 msg->rep = NULL; in tipc_nl_compat_dumpit()
329 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_doit() argument
359 err = (*cmd->transcode)(cmd, trans_buf, msg); in __tipc_nl_compat_doit()
369 doit_buf->sk = msg->dst_sk; in __tipc_nl_compat_doit()
385 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_doit() argument
389 if (msg->req_type && (!msg->req_size || in tipc_nl_compat_doit()
390 !TLV_CHECK_TYPE(msg->req, msg->req_type))) in tipc_nl_compat_doit()
393 err = __tipc_nl_compat_doit(cmd, msg); in tipc_nl_compat_doit()
398 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_doit()
399 if (!msg->rep) in tipc_nl_compat_doit()
405 static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_bearer_dump() argument
419 return tipc_add_tlv(msg->rep, TIPC_TLV_BEARER_NAME, in tipc_nl_compat_bearer_dump()
426 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_enable() argument
433 b = (struct tipc_bearer_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_enable()
439 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_enable()
469 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_disable() argument
475 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_disable()
481 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_bearer_disable()
502 static void __fill_bc_link_stat(struct tipc_nl_compat_msg *msg, in __fill_bc_link_stat() argument
505 tipc_tlv_sprintf(msg->rep, " Window:%u packets\n", in __fill_bc_link_stat()
508 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
516 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
524 tipc_tlv_sprintf(msg->rep, " RX naks:%u defs:%u dups:%u\n", in __fill_bc_link_stat()
529 tipc_tlv_sprintf(msg->rep, " TX naks:%u acks:%u dups:%u\n", in __fill_bc_link_stat()
534 tipc_tlv_sprintf(msg->rep, in __fill_bc_link_stat()
541 static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_stat_dump() argument
577 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_stat_dump()
579 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_stat_dump()
590 tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n", in tipc_nl_compat_link_stat_dump()
594 __fill_bc_link_stat(msg, prop, stats); in tipc_nl_compat_link_stat_dump()
599 tipc_tlv_sprintf(msg->rep, " ACTIVE"); in tipc_nl_compat_link_stat_dump()
601 tipc_tlv_sprintf(msg->rep, " STANDBY"); in tipc_nl_compat_link_stat_dump()
603 tipc_tlv_sprintf(msg->rep, " DEFUNCT"); in tipc_nl_compat_link_stat_dump()
605 tipc_tlv_sprintf(msg->rep, " MTU:%u Priority:%u", in tipc_nl_compat_link_stat_dump()
609 tipc_tlv_sprintf(msg->rep, " Tolerance:%u ms Window:%u packets\n", in tipc_nl_compat_link_stat_dump()
613 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
622 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
631 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
637 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
648 tipc_tlv_sprintf(msg->rep, "-16384:%u%% -32768:%u%% -66000:%u%%\n", in tipc_nl_compat_link_stat_dump()
656 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
664 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
672 tipc_tlv_sprintf(msg->rep, in tipc_nl_compat_link_stat_dump()
681 static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_link_dump() argument
701 return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, in tipc_nl_compat_link_dump()
706 struct tipc_nl_compat_msg *msg, in __tipc_add_link_prop() argument
709 switch (msg->cmd) { in __tipc_add_link_prop()
722 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_media_set() argument
728 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_media_set()
741 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_media_set()
749 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_bearer_set() argument
755 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_bearer_set()
768 __tipc_add_link_prop(skb, msg, lc); in tipc_nl_compat_bearer_set()
776 struct tipc_nl_compat_msg *msg) in __tipc_nl_compat_link_set() argument
782 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in __tipc_nl_compat_link_set()
795 __tipc_add_link_prop(skb, msg, lc); in __tipc_nl_compat_link_set()
804 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_set() argument
811 lc = (struct tipc_link_config *)TLV_DATA(msg->req); in tipc_nl_compat_link_set()
813 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_set()
825 return tipc_nl_compat_media_set(skb, msg); in tipc_nl_compat_link_set()
828 bearer = tipc_bearer_find(msg->net, lc->name); in tipc_nl_compat_link_set()
831 return tipc_nl_compat_bearer_set(skb, msg); in tipc_nl_compat_link_set()
834 return __tipc_nl_compat_link_set(skb, msg); in tipc_nl_compat_link_set()
839 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_link_reset_stats() argument
845 name = (char *)TLV_DATA(msg->req); in tipc_nl_compat_link_reset_stats()
851 len = TLV_GET_DATA_LEN(msg->req); in tipc_nl_compat_link_reset_stats()
867 static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_name_table_dump_header() argument
879 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump_header()
880 if (TLV_GET_DATA_LEN(msg->req) < (int)sizeof(struct tipc_name_table_query)) in tipc_nl_compat_name_table_dump_header()
888 tipc_tlv_sprintf(msg->rep, header[i]); in tipc_nl_compat_name_table_dump_header()
889 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump_header()
894 static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_name_table_dump() argument
924 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); in tipc_nl_compat_name_table_dump()
939 tipc_tlv_sprintf(msg->rep, "%-10u ", in tipc_nl_compat_name_table_dump()
945 tipc_tlv_sprintf(msg->rep, "%-10u %-10u ", in tipc_nl_compat_name_table_dump()
955 tipc_tlv_sprintf(msg->rep, "%-26s ", port_str); in tipc_nl_compat_name_table_dump()
960 tipc_tlv_sprintf(msg->rep, "%-10u %s", in tipc_nl_compat_name_table_dump()
964 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_name_table_dump()
969 static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, in __tipc_nl_compat_publ_dump() argument
989 tipc_tlv_sprintf(msg->rep, " {%u,%u}", type, lower); in __tipc_nl_compat_publ_dump()
991 tipc_tlv_sprintf(msg->rep, " {%u,%u,%u}", type, lower, upper); in __tipc_nl_compat_publ_dump()
996 static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) in tipc_nl_compat_publ_dump() argument
1032 err = __tipc_nl_compat_dumpit(&dump, msg, args); in tipc_nl_compat_publ_dump()
1039 static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_sk_dump() argument
1055 tipc_tlv_sprintf(msg->rep, "%u:", sock_ref); in tipc_nl_compat_sk_dump()
1069 tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>", in tipc_nl_compat_sk_dump()
1076 tipc_tlv_sprintf(msg->rep, " via {%u,%u}\n", in tipc_nl_compat_sk_dump()
1080 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1082 tipc_tlv_sprintf(msg->rep, " bound to"); in tipc_nl_compat_sk_dump()
1084 err = tipc_nl_compat_publ_dump(msg, sock_ref); in tipc_nl_compat_sk_dump()
1088 tipc_tlv_sprintf(msg->rep, "\n"); in tipc_nl_compat_sk_dump()
1093 static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_media_dump() argument
1107 return tipc_add_tlv(msg->rep, TIPC_TLV_MEDIA_NAME, in tipc_nl_compat_media_dump()
1112 static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_node_dump() argument
1130 return tipc_add_tlv(msg->rep, TIPC_TLV_NODE_INFO, &node_info, in tipc_nl_compat_node_dump()
1136 struct tipc_nl_compat_msg *msg) in tipc_nl_compat_net_set() argument
1141 val = ntohl(*(__be32 *)TLV_DATA(msg->req)); in tipc_nl_compat_net_set()
1147 if (msg->cmd == TIPC_CMD_SET_NODE_ADDR) { in tipc_nl_compat_net_set()
1150 } else if (msg->cmd == TIPC_CMD_SET_NETID) { in tipc_nl_compat_net_set()
1159 static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, in tipc_nl_compat_net_dump() argument
1176 return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); in tipc_nl_compat_net_dump()
1179 static int tipc_cmd_show_stats_compat(struct tipc_nl_compat_msg *msg) in tipc_cmd_show_stats_compat() argument
1181 msg->rep = tipc_tlv_alloc(ULTRA_STRING_MAX_LEN); in tipc_cmd_show_stats_compat()
1182 if (!msg->rep) in tipc_cmd_show_stats_compat()
1185 tipc_tlv_init(msg->rep, TIPC_TLV_ULTRA_STRING); in tipc_cmd_show_stats_compat()
1186 tipc_tlv_sprintf(msg->rep, "TIPC version " TIPC_MOD_VER "\n"); in tipc_cmd_show_stats_compat()
1191 static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) in tipc_nl_compat_handle() argument
1199 switch (msg->cmd) { in tipc_nl_compat_handle()
1201 msg->rep = tipc_tlv_alloc(0); in tipc_nl_compat_handle()
1202 if (!msg->rep) in tipc_nl_compat_handle()
1206 msg->rep_size = MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME); in tipc_nl_compat_handle()
1209 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1211 msg->req_type = TIPC_TLV_BEARER_CONFIG; in tipc_nl_compat_handle()
1214 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1216 msg->req_type = TIPC_TLV_BEARER_NAME; in tipc_nl_compat_handle()
1219 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1221 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1222 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1223 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1226 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1228 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1229 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1232 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1236 msg->req_type = TIPC_TLV_LINK_CONFIG; in tipc_nl_compat_handle()
1239 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1241 msg->req_type = TIPC_TLV_LINK_NAME; in tipc_nl_compat_handle()
1244 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1246 msg->req_type = TIPC_TLV_NAME_TBL_QUERY; in tipc_nl_compat_handle()
1247 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1248 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1252 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1254 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1255 msg->rep_type = TIPC_TLV_ULTRA_STRING; in tipc_nl_compat_handle()
1258 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1260 msg->rep_size = MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME); in tipc_nl_compat_handle()
1263 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1265 msg->rep_size = ULTRA_STRING_MAX_LEN; in tipc_nl_compat_handle()
1268 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1270 msg->req_type = TIPC_TLV_NET_ADDR; in tipc_nl_compat_handle()
1273 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1275 msg->req_type = TIPC_TLV_UNSIGNED; in tipc_nl_compat_handle()
1278 return tipc_nl_compat_doit(&doit, msg); in tipc_nl_compat_handle()
1280 msg->rep_size = sizeof(u32); in tipc_nl_compat_handle()
1283 return tipc_nl_compat_dumpit(&dump, msg); in tipc_nl_compat_handle()
1285 return tipc_cmd_show_stats_compat(msg); in tipc_nl_compat_handle()
1295 struct tipc_nl_compat_msg msg; in tipc_nl_compat_recv() local
1300 memset(&msg, 0, sizeof(msg)); in tipc_nl_compat_recv()
1303 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN; in tipc_nl_compat_recv()
1304 msg.cmd = req_userhdr->cmd; in tipc_nl_compat_recv()
1305 msg.net = genl_info_net(info); in tipc_nl_compat_recv()
1306 msg.dst_sk = skb->sk; in tipc_nl_compat_recv()
1308 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) { in tipc_nl_compat_recv()
1309 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_NET_ADMIN); in tipc_nl_compat_recv()
1314 msg.req_size = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); in tipc_nl_compat_recv()
1315 if (msg.req_size && !TLV_OK(msg.req, msg.req_size)) { in tipc_nl_compat_recv()
1316 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1321 err = tipc_nl_compat_handle(&msg); in tipc_nl_compat_recv()
1323 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); in tipc_nl_compat_recv()
1325 msg.rep = tipc_get_err_tlv(TIPC_CFG_TLV_ERROR); in tipc_nl_compat_recv()
1327 if (!msg.rep) in tipc_nl_compat_recv()
1331 skb_push(msg.rep, len); in tipc_nl_compat_recv()
1332 rep_nlh = nlmsg_hdr(msg.rep); in tipc_nl_compat_recv()
1334 rep_nlh->nlmsg_len = msg.rep->len; in tipc_nl_compat_recv()
1335 genlmsg_unicast(msg.net, msg.rep, NETLINK_CB(skb).portid); in tipc_nl_compat_recv()