netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ward <david.ward@ll.mit.edu>
To: <netdev@vger.kernel.org>
Cc: David Ward <david.ward@ll.mit.edu>
Subject: [PATCH iproute2 5/7] ip/xfrm: Command syntax should not expect a key for compression
Date: Mon, 25 Mar 2013 10:23:17 -0400	[thread overview]
Message-ID: <1364221399-1024-5-git-send-email-david.ward@ll.mit.edu> (raw)
In-Reply-To: <1364221399-1024-1-git-send-email-david.ward@ll.mit.edu>

Compression algorithms do not use a key.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 ip/xfrm_state.c    |   26 +++++++++++++++++---------
 man/man8/ip-xfrm.8 |   13 ++++++++-----
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 08a4980..9b374ee 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -78,13 +78,14 @@ static void usage(void)
 	fprintf(stderr, "ALGO-LIST := [ ALGO-LIST ] ALGO\n");
 	fprintf(stderr, "ALGO := { ");
 	fprintf(stderr, "%s | ", strxf_algotype(XFRMA_ALG_CRYPT));
-	fprintf(stderr, "%s | ", strxf_algotype(XFRMA_ALG_AUTH));
-	fprintf(stderr, "%s", strxf_algotype(XFRMA_ALG_COMP));
+	fprintf(stderr, "%s", strxf_algotype(XFRMA_ALG_AUTH));
 	fprintf(stderr, " } ALGO-NAME ALGO-KEY |\n");
+	fprintf(stderr, "        %s", strxf_algotype(XFRMA_ALG_AUTH_TRUNC));
+	fprintf(stderr, " ALGO-NAME ALGO-KEY ALGO-TRUNC-LEN |\n");
 	fprintf(stderr, "        %s", strxf_algotype(XFRMA_ALG_AEAD));
 	fprintf(stderr, " ALGO-NAME ALGO-KEY ALGO-ICV-LEN |\n");
-	fprintf(stderr, "        %s", strxf_algotype(XFRMA_ALG_AUTH_TRUNC));
-	fprintf(stderr, " ALGO-NAME ALGO-KEY ALGO-TRUNC-LEN\n");
+	fprintf(stderr, "        %s", strxf_algotype(XFRMA_ALG_COMP));
+	fprintf(stderr, " ALGO-NAME\n");
  	fprintf(stderr, "MODE := transport | tunnel | ro | in_trigger | beet\n");
 	fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
 	fprintf(stderr, "FLAG := noecn | decap-dscp | nopmtudisc | wildrecv | icmp | af-unspec | align4\n");
@@ -374,7 +375,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
 				int len;
 				__u32 icvlen, trunclen;
 				char *name;
-				char *key;
+				char *key = "";
 				char *buf;
 
 				switch (type) {
@@ -409,10 +410,17 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
 				NEXT_ARG();
 				name = *argv;
 
-				if (!NEXT_ARG_OK())
-					missarg("ALGO-KEY");
-				NEXT_ARG();
-				key = *argv;
+				switch (type) {
+				case XFRMA_ALG_AEAD:
+				case XFRMA_ALG_CRYPT:
+				case XFRMA_ALG_AUTH:
+				case XFRMA_ALG_AUTH_TRUNC:
+					if (!NEXT_ARG_OK())
+						missarg("ALGO-KEY");
+					NEXT_ARG();
+					key = *argv;
+					break;
+				}
 
 				buf = alg.u.alg.alg_key;
 				len = sizeof(alg.u.alg);
diff --git a/man/man8/ip-xfrm.8 b/man/man8/ip-xfrm.8
index f359773..6017bc2 100644
--- a/man/man8/ip-xfrm.8
+++ b/man/man8/ip-xfrm.8
@@ -117,14 +117,17 @@ ip-xfrm \- transform configuration
 
 .ti -8
 .IR ALGO " :="
-.RB "{ " enc " | " auth " | " comp " } " 
+.RB "{ " enc " | " auth " } " 
 .IR ALGO-NAME " " ALGO-KEY " |"
 .br
-.B  aead
-.IR ALGO-NAME " " ALGO-KEY " " ALGO-ICV-LEN  " |"
-.br
 .B auth-trunc
-.IR ALGO-NAME " " ALGO-KEY " " ALGO-TRUNC-LEN
+.IR ALGO-NAME " " ALGO-KEY " " ALGO-TRUNC-LEN " |"
+.br
+.B aead
+.IR ALGO-NAME " " ALGO-KEY " " ALGO-ICV-LEN " |"
+.br
+.B comp
+.IR ALGO-NAME
 
 .ti -8
 .IR MODE " := "
-- 
1.7.1

  parent reply	other threads:[~2013-03-25 14:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 14:23 [PATCH iproute2 1/7] ip/xfrm: Extend SPI validity checking David Ward
2013-03-25 14:23 ` [PATCH iproute2 2/7] ip/xfrm: Do not allow redundant algorithm combinations to be specified David Ward
2013-03-25 14:23 ` [PATCH iproute2 3/7] ip/xfrm: Improve transform protocol-specific parameter checking David Ward
2013-03-25 14:23 ` [PATCH iproute2 4/7] ip/xfrm: Do not print a zero-length algorithm key David Ward
2013-03-25 14:23 ` David Ward [this message]
2013-03-25 14:23 ` [PATCH iproute2 6/7] ip/xfrm: Improve usage text and documentation David Ward
2013-03-25 14:23 ` [PATCH iproute2 7/7] ip/xfrm: Improve error strings David Ward
2013-03-28 21:47   ` Stephen Hemminger
2013-03-25 15:03 ` [PATCH iproute2 1/7] ip/xfrm: Extend SPI validity checking Stephen Hemminger

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=1364221399-1024-5-git-send-email-david.ward@ll.mit.edu \
    --to=david.ward@ll.mit.edu \
    --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;
as well as URLs for NNTP newsgroup(s).