diff options
author | Serhey Popovych <serhe.popovych@gmail.com> | 2018-02-15 23:23:22 +0200 |
---|---|---|
committer | David Ahern <dsahern@gmail.com> | 2018-02-16 08:14:20 -0800 |
commit | fcac9665265510735252760b7a0040f9adaa34a2 (patch) | |
tree | 08706477a869cdb10982800931c9e384790230dc /include/utils.h | |
parent | 0cec58dac4c249a6773a39e00b0f13530534cda7 (diff) |
utils: Introduce and use get_ifname_rta()
Be consistent in handling of IFLA_IFNAME attribute in all places: if
there is no attribute report bug to stderr and use ll_idx_n2a() as
last measure to get name in "if%u" format instead of "<nil>".
Use check_ifname() to validate network device name: this catches both
unexpected return from kernel and ll_idx_n2a().
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Diffstat (limited to 'include/utils.h')
-rw-r--r-- | include/utils.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/utils.h b/include/utils.h index 867e5404..84ca873e 100644 --- a/include/utils.h +++ b/include/utils.h @@ -183,6 +183,7 @@ void duparg(const char *, const char *) __attribute__((noreturn)); void duparg2(const char *, const char *) __attribute__((noreturn)); int check_ifname(const char *); int get_ifname(char *, const char *); +const char *get_ifname_rta(int ifindex, const struct rtattr *rta); int matches(const char *arg, const char *pattern); int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits); int inet_addr_match_rta(const inet_prefix *m, const struct rtattr *rta); |