]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
macsec: fix input of 'port', improve documentation of 'address'
authorDavide Caratti <dcaratti@redhat.com>
Tue, 30 Aug 2016 11:23:12 +0000 (13:23 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 1 Sep 2016 16:08:50 +0000 (09:08 -0700)
remove hardcoded base 10 parsing of 'port' parameter, update man page
and fix usage() functions as well. Fix misleading line in man page that
theoretically allowed specifying 'port' keyword right after 'sci' keyword.
Provide documentation of 'address' parameter in man pages and in usage()
functions as well.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
ip/ipmacsec.c
man/man8/ip-link.8.in
man/man8/ip-macsec.8

index 6bd1f54fbfd7c0a97aa9f95b24622497a7acfada..c75e9d3ca9def70f5b4ea227b0d0469f843aa813 100644 (file)
@@ -95,7 +95,7 @@ static void ipmacsec_usage(void)
        fprintf(stderr, "where  OPTS := [ pn <u32> ] [ on | off ]\n");
        fprintf(stderr, "       ID   := 128-bit hex string\n");
        fprintf(stderr, "       KEY  := 128-bit hex string\n");
-       fprintf(stderr, "       SCI  := { sci <u64> | port <u16> address <lladdr> }\n");
+       fprintf(stderr, "       SCI  := { sci <u64> | port { 1..2^16-1 } address <lladdr> }\n");
 
        exit(-1);
 }
@@ -139,7 +139,7 @@ static int get_sci(__u64 *sci, const char *arg)
 
 static int get_port(__be16 *port, const char *arg)
 {
-       return get_be16(port, arg, 10);
+       return get_be16(port, arg, 0);
 }
 
 #define _STR(a) #a
@@ -1069,7 +1069,7 @@ static bool check_txsc_flags(bool es, bool scb, bool sci)
 static void usage(FILE *f)
 {
        fprintf(f,
-               "Usage: ... macsec [ port PORT | sci SCI ]\n"
+               "Usage: ... macsec [ [ address <lladdr> ] port { 1..2^16-1 } | sci <u64> ]\n"
                "                  [ cipher { default | gcm-aes-128 } ]\n"
                "                  [ icvlen { 8..16 } ]\n"
                "                  [ encrypt { on | off } ]\n"
index 58247ced448df719a581cfa94bda79b522e73ca4..6fb5ad6c0b050651c7d821ee492e448ab1959beb 100644 (file)
@@ -952,7 +952,9 @@ For a link of type
 the following additional arguments are supported:
 
 .BI "ip link add link " DEVICE " name " NAME " type macsec"
-[
+[ [
+.BI address " <lladdr>"
+]
 .BI port " PORT"
 |
 .BI sci " SCI"
@@ -976,8 +978,14 @@ the following additional arguments are supported:
 
 .in +8
 .sp
-.BI  port " PORT "
-- sets the port number for this MACsec device.
+.BI address " <lladdr> "
+- sets the system identifier component of secure channel for this MACsec device.
+
+.sp
+.BI port " PORT "
+- sets the port number component of secure channel for this MACsec device, in a
+range from 1 to 65535 inclusive. Numbers with a leading " 0 " or " 0x " are
+interpreted as octal and hexadecimal, respectively.
 
 .sp
 .BI sci " SCI "
index 105aeecd850d150daf1451c3d9dc390715d9a696..1aca3bdcab6e03423f50971b37b85d66d675694b 100644 (file)
@@ -3,10 +3,12 @@
 ip-macsec \- MACsec device configuration
 .SH "SYNOPSIS"
 .BI "ip link add link " DEVICE " name " NAME " type macsec "
-[
+[ [
+.BI address " <lladdr>"
+]
 .BI port " PORT"
 |
-.BI sci  " SCI"
+.BI sci " <u64>"
 ] [
 .BR cipher " { " default " | " gcm-aes-128 " } ] ["
 .BI icvlen " ICVLEN"
@@ -62,8 +64,12 @@ ip-macsec \- MACsec device configuration
 .IR SCI " := { "
 .B sci
 .IR <u64> " | "
-.BI port " <u16> " address " <lladdr> "
+.BI port
+.IR PORT
+.BI address " <lladdr> "
 }
+.br
+.IR PORT " := { " 1..2^16-1 " } "
 
 
 .SH DESCRIPTION