]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
macsec: show usage even if the module is not available
authorSabrina Dubroca <sd@queasysnail.net>
Tue, 16 Aug 2016 14:26:56 +0000 (16:26 +0200)
committerStephen Hemminger <sthemmin@microsoft.com>
Wed, 17 Aug 2016 20:59:52 +0000 (13:59 -0700)
Currently, the `ip macsec` command tries to initialize a genl context
even when we just want to see the help for the command, which doesn't
require to talk to the kernel at all.

Delay genl initialization, which can fail if the module isn't loaded,
until the point where we will actually need it.

Fixes: b26fc590ce62 ("ip: add MACsec support")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
ip/ipmacsec.c

index 9eabfe2419807f498f23fbaf2ddcac89c58510e3..6bd1f54fbfd7c0a97aa9f95b24622497a7acfada 100644 (file)
@@ -986,15 +986,15 @@ static int do_show(int argc, char **argv)
 
 int do_ipmacsec(int argc, char **argv)
 {
-       if (genl_init_handle(&genl_rth, MACSEC_GENL_NAME, &genl_family))
-               exit(1);
-
        if (argc < 1)
                ipmacsec_usage();
 
        if (matches(*argv, "help") == 0)
                ipmacsec_usage();
 
+       if (genl_init_handle(&genl_rth, MACSEC_GENL_NAME, &genl_family))
+               exit(1);
+
        if (matches(*argv, "show") == 0)
                return do_show(argc-1, argv+1);