From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2] genl: remove dead code
Date: Thu, 15 Nov 2018 09:23:02 -0800 [thread overview]
Message-ID: <20181115172302.8112-1-stephen@networkplumber.org> (raw)
The function genl_ctrl_resolve_family is defined but never used
in current code.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
genl/ctrl.c | 71 -----------------------------------------------
genl/genl_utils.h | 2 --
2 files changed, 73 deletions(-)
diff --git a/genl/ctrl.c b/genl/ctrl.c
index 6133336ab435..0fb464b01cfb 100644
--- a/genl/ctrl.c
+++ b/genl/ctrl.c
@@ -38,77 +38,6 @@ static int usage(void)
return -1;
}
-int genl_ctrl_resolve_family(const char *family)
-{
- struct rtnl_handle rth;
- int ret = 0;
- struct {
- struct nlmsghdr n;
- struct genlmsghdr g;
- char buf[4096];
- } req = {
- .n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN),
- .n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK,
- .n.nlmsg_type = GENL_ID_CTRL,
- .g.cmd = CTRL_CMD_GETFAMILY,
- };
- struct nlmsghdr *nlh = &req.n;
- struct genlmsghdr *ghdr = &req.g;
- struct nlmsghdr *answer = NULL;
-
- if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0) {
- fprintf(stderr, "Cannot open generic netlink socket\n");
- exit(1);
- }
-
- addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME, family, strlen(family) + 1);
-
- if (rtnl_talk(&rth, nlh, &answer) < 0) {
- fprintf(stderr, "Error talking to the kernel\n");
- goto errout;
- }
-
- {
- struct rtattr *tb[CTRL_ATTR_MAX + 1];
- int len = answer->nlmsg_len;
- struct rtattr *attrs;
-
- if (answer->nlmsg_type != GENL_ID_CTRL) {
- fprintf(stderr, "Not a controller message, nlmsg_len=%d "
- "nlmsg_type=0x%x\n", answer->nlmsg_len, answer->nlmsg_type);
- goto errout;
- }
-
- if (ghdr->cmd != CTRL_CMD_NEWFAMILY) {
- fprintf(stderr, "Unknown controller command %d\n", ghdr->cmd);
- goto errout;
- }
-
- len -= NLMSG_LENGTH(GENL_HDRLEN);
-
- if (len < 0) {
- fprintf(stderr, "wrong controller message len %d\n", len);
- free(answer);
- return -1;
- }
-
- attrs = (struct rtattr *) ((char *) answer + NLMSG_LENGTH(GENL_HDRLEN));
- parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len);
-
- if (tb[CTRL_ATTR_FAMILY_ID] == NULL) {
- fprintf(stderr, "Missing family id TLV\n");
- goto errout;
- }
-
- ret = rta_getattr_u16(tb[CTRL_ATTR_FAMILY_ID]);
- }
-
-errout:
- free(answer);
- rtnl_close(&rth);
- return ret;
-}
-
static void print_ctrl_cmd_flags(FILE *fp, __u32 fl)
{
fprintf(fp, "\n\t\tCapabilities (0x%x):\n ", fl);
diff --git a/genl/genl_utils.h b/genl/genl_utils.h
index cc1f3fb76596..a8d433a9574f 100644
--- a/genl/genl_utils.h
+++ b/genl/genl_utils.h
@@ -13,6 +13,4 @@ struct genl_util
int (*print_genlopt)(struct nlmsghdr *n, void *arg);
};
-int genl_ctrl_resolve_family(const char *family);
-
#endif
--
2.17.1
reply other threads:[~2018-11-16 3:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181115172302.8112-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox