iproute2 small patches for xfrm
Subsystems (2)
Hi,
I found the tool "ip xfrm" is not able to add "cipher_null" because there is no possibility to set key with zero length.
I solved it by this change:
- if (slen > 2 && strncmp(key, "0x", 2) == 0) {
+ if (slen >= 2 && strncmp(key, "0x", 2) == 0) {
By this change you can specify key as "0x" which will pass for key existence and set key len to 0.
this patch is against version iproute2-3.14.0
Second patch enable use proto ip. Because it is supported by kernel.
Have a nice day :)
Regards
Jarek
ip/xfrm_state.c +1 -1
@@ -125,7 +125,7 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, enum xfrm_attr_type_t type,strncpy (alg->alg_name, name,sizeof (alg->alg_name)); -if (slen >2 &&strncmp (key,"0x" ,2 ) ==0 ) { +if (slen >=2 &&strncmp (key,"0x" ,2 ) ==0 ) {/* split two chars "0x" from the top */ char *p = key +2 ;int plen = slen -2 ;
ip/ipxfrm.c +1 -0
@@ -1280,6 +1281,7 @@ static int xfrm_selector_upspec_parse(struct xfrm_selector *sel,missarg ("UPSPEC" );if (sportp || dportp) {switch (sel->proto) { +case IPPROTO_IP :case IPPROTO_TCP :case IPPROTO_UDP :case IPPROTO_SCTP :
Quoted 12 lines · On Fri, 01 Aug 2014 13:16:09 +0200 Jaroslav Šafka <[email protected]>…
Hi,
I found the tool "ip xfrm" is not able to add "cipher_null" because there is no possibility to set key with zero length.I solved it by this change:
ip/xfrm_state.c +1
-1-if (slen >2 &&strncmp (key,"0x" ,2 ) ==0 ) { +if (slen >=2 &&strncmp (key,"0x" ,2 ) ==0 ) {By this change you can specify key as "0x" which will pass for key existence and set key len to 0.
Quoted 8 lines
this patch is against version iproute2-3.14.0
Second patch enable use proto ip. Because it is supported by kernel.
Have a nice day :)
Regards
Jarek
Please format patches in same manner as kernel patches as described in Documentation/SubmittingPatches. One patch per email; email with [PATCH] in subject line; and please don't use attachments if possible.