* [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined
@ 2020-08-21 10:18 Yang Xu
2020-08-28 8:43 ` Petr Vorel
2020-08-28 8:48 ` Petr Vorel
0 siblings, 2 replies; 7+ messages in thread
From: Yang Xu @ 2020-08-21 10:18 UTC (permalink / raw)
To: ltp
On older kernel such as 3.10.0-1136.el7.x86_64, compile failed as below:
tst_af_alg.c: In function ?tst_alg_sendmsg?:
tst_af_alg.c:205:21: error: ?ALG_SET_AEAD_ASSOCLEN? undeclared (first use in this function)
cmsg->cmsg_type = ALG_SET_AEAD_ASSOCLEN;
^
tst_af_alg.c:205:21: note: each undeclared identifier is reported only once for each function it appears in
make: *** [tst_af_alg.o] Error 1
It compile failed because ltp lapi/if_alg.h can't handle fallback logic, so corret it.
The ALG_SET_AEAD_ASSOCLEN flag was introduced since kernel commit af8e80731a
("crypto: af_alg - add user space interface for AEAD") in 2014.
Fixes: 3cbb963abb ("lib/tst_af_alg: add tst_alg_sendmsg()")
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
configure.ac | 6 ++++++
include/lapi/if_alg.h | 39 ++++++++++++++++++++++++++++++---------
2 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 382963d8b..f711ac123 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,6 +193,12 @@ AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
#include <linux/netfilter_ipv4/ip_tables.h>
])
+AC_CHECK_TYPES([struct sockaddr_alg, struct af_alg_iv],,,[
+#ifdef HAVE_LINUX_IF_ALG_H
+# include <linux/if_alg.h>
+#endif
+])
+
# Tools knobs
# Expect
diff --git a/include/lapi/if_alg.h b/include/lapi/if_alg.h
index 5a74df99b..9c04a444c 100644
--- a/include/lapi/if_alg.h
+++ b/include/lapi/if_alg.h
@@ -8,9 +8,10 @@
#ifdef HAVE_LINUX_IF_ALG_H
# include <linux/if_alg.h>
-#else
+#endif
# include <stdint.h>
+#ifndef HAVE_STRUCT_SOCKADDR_ALG
struct sockaddr_alg {
uint16_t salg_family;
uint8_t salg_type[14];
@@ -18,21 +19,41 @@ struct sockaddr_alg {
uint32_t salg_mask;
uint8_t salg_name[64];
};
+#endif
+#ifndef HAVE_STRUCT_AF_ALG_IV
struct af_alg_iv {
uint32_t ivlen;
uint8_t iv[0];
};
+#endif
-#define ALG_SET_KEY 1
-#define ALG_SET_IV 2
-#define ALG_SET_OP 3
-#define ALG_SET_AEAD_ASSOCLEN 4
-#define ALG_SET_AEAD_AUTHSIZE 5
+#ifndef ALG_SET_KEY
+# define ALG_SET_KEY 1
+#endif
-#define ALG_OP_DECRYPT 0
-#define ALG_OP_ENCRYPT 1
+#ifndef ALG_SET_IV
+# define ALG_SET_IV 2
+#endif
-#endif /* !HAVE_LINUX_IF_ALG_H */
+#ifndef ALG_SET_OP
+# define ALG_SET_OP 3
+#endif
+
+#ifndef ALG_SET_AEAD_ASSOCLEN
+# define ALG_SET_AEAD_ASSOCLEN 4
+#endif
+
+#ifndef ALG_SET_AEAD_AUTHSIZE
+# define ALG_SET_AEAD_AUTHSIZE 5
+#endif
+
+#ifndef ALG_OP_DECRYPT
+# define ALG_OP_DECRYPT 0
+#endif
+
+#ifndef ALG_OP_ENCRYPT
+# define ALG_OP_ENCRYPT 1
+#endif
#endif /* IF_ALG_H__ */
--
2.23.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined
2020-08-21 10:18 [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined Yang Xu
@ 2020-08-28 8:43 ` Petr Vorel
2020-08-28 9:27 ` Yang Xu
2020-08-28 8:48 ` Petr Vorel
1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-08-28 8:43 UTC (permalink / raw)
To: ltp
Hi,
> configure.ac | 6 ++++++
> include/lapi/if_alg.h | 39 ++++++++++++++++++++++++++++++---------
> 2 files changed, 36 insertions(+), 9 deletions(-)
> diff --git a/configure.ac b/configure.ac
> index 382963d8b..f711ac123 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -193,6 +193,12 @@ AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
> #include <linux/netfilter_ipv4/ip_tables.h>
> ])
> +AC_CHECK_TYPES([struct sockaddr_alg, struct af_alg_iv],,,[
> +#ifdef HAVE_LINUX_IF_ALG_H
> +# include <linux/if_alg.h>
> +#endif
> +])
nit: This list was meant to be sorted. I'll handle that during merge.
> +
> # Tools knobs
> # Expect
> diff --git a/include/lapi/if_alg.h b/include/lapi/if_alg.h
> index 5a74df99b..9c04a444c 100644
> --- a/include/lapi/if_alg.h
> +++ b/include/lapi/if_alg.h
> @@ -8,9 +8,10 @@
> #ifdef HAVE_LINUX_IF_ALG_H
> # include <linux/if_alg.h>
> -#else
> +#endif
> # include <stdint.h>
BTW <stdint.h> is needed only for "#ifndef HAVE_STRUCT_SOCKADDR_ALG" and "#ifndef
HAVE_STRUCT_AF_ALG_IVL" (for uint*_t) but we can ignore that as a detail (better
than have complicated guarder:
#if ! (defined(HAVE_STRUCT_SOCKADDR_ALG) && defined(HAVE_STRUCT_AF_ALG_IVL)
(and later forgot to update it).
> +#ifndef HAVE_STRUCT_SOCKADDR_ALG
> struct sockaddr_alg {
> uint16_t salg_family;
> uint8_t salg_type[14];
> @@ -18,21 +19,41 @@ struct sockaddr_alg {
> uint32_t salg_mask;
> uint8_t salg_name[64];
> };
> +#endif
The rest lgtm:
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined
2020-08-21 10:18 [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined Yang Xu
2020-08-28 8:43 ` Petr Vorel
@ 2020-08-28 8:48 ` Petr Vorel
2020-08-28 9:34 ` Yang Xu
1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-08-28 8:48 UTC (permalink / raw)
To: ltp
Hi,
...
> --- a/configure.ac
> +++ b/configure.ac
> @@ -193,6 +193,12 @@ AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
> #include <linux/netfilter_ipv4/ip_tables.h>
> ])
> +AC_CHECK_TYPES([struct sockaddr_alg, struct af_alg_iv],,,[
> +#ifdef HAVE_LINUX_IF_ALG_H
> +# include <linux/if_alg.h>
> +#endif
IMHO <linux/if_alg.h> does not need to be guarded.
(as the definitions are in it it either fail because missing or fail because not
loaded)
> +])
> +
> # Tools knobs
...
Kind regards,
Petr
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined
2020-08-28 8:43 ` Petr Vorel
@ 2020-08-28 9:27 ` Yang Xu
0 siblings, 0 replies; 7+ messages in thread
From: Yang Xu @ 2020-08-28 9:27 UTC (permalink / raw)
To: ltp
Hi Petr
> Hi,
>
>> configure.ac | 6 ++++++
>> include/lapi/if_alg.h | 39 ++++++++++++++++++++++++++++++---------
>> 2 files changed, 36 insertions(+), 9 deletions(-)
>
>> diff --git a/configure.ac b/configure.ac
>> index 382963d8b..f711ac123 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -193,6 +193,12 @@ AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
>> #include <linux/netfilter_ipv4/ip_tables.h>
>> ])
>
>> +AC_CHECK_TYPES([struct sockaddr_alg, struct af_alg_iv],,,[
>> +#ifdef HAVE_LINUX_IF_ALG_H
>> +# include <linux/if_alg.h>
>> +#endif
>> +])
> nit: This list was meant to be sorted. I'll handle that during merge.
Thanks.
>> +
>> # Tools knobs
>
>> # Expect
>> diff --git a/include/lapi/if_alg.h b/include/lapi/if_alg.h
>> index 5a74df99b..9c04a444c 100644
>> --- a/include/lapi/if_alg.h
>> +++ b/include/lapi/if_alg.h
>> @@ -8,9 +8,10 @@
>
>> #ifdef HAVE_LINUX_IF_ALG_H
>> # include <linux/if_alg.h>
>> -#else
>> +#endif
>> # include <stdint.h>
> BTW <stdint.h> is needed only for "#ifndef HAVE_STRUCT_SOCKADDR_ALG" and "#ifndef
> HAVE_STRUCT_AF_ALG_IVL" (for uint*_t) but we can ignore that as a detail (better
> than have complicated guarder:
> #if ! (defined(HAVE_STRUCT_SOCKADDR_ALG) && defined(HAVE_STRUCT_AF_ALG_IVL)
Agree. ignore it is better.
>
> (and later forgot to update it).
>
>> +#ifndef HAVE_STRUCT_SOCKADDR_ALG
>> struct sockaddr_alg {
>> uint16_t salg_family;
>> uint8_t salg_type[14];
>> @@ -18,21 +19,41 @@ struct sockaddr_alg {
>> uint32_t salg_mask;
>> uint8_t salg_name[64];
>> };
>> +#endif
>
> The rest lgtm:
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Kind regards,
> Petr
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined
2020-08-28 8:48 ` Petr Vorel
@ 2020-08-28 9:34 ` Yang Xu
2020-08-28 10:33 ` Petr Vorel
2020-08-28 10:40 ` Petr Vorel
0 siblings, 2 replies; 7+ messages in thread
From: Yang Xu @ 2020-08-28 9:34 UTC (permalink / raw)
To: ltp
Hi Petr
> Hi,
>
> ...
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -193,6 +193,12 @@ AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
>> #include <linux/netfilter_ipv4/ip_tables.h>
>> ])
>
>> +AC_CHECK_TYPES([struct sockaddr_alg, struct af_alg_iv],,,[
>> +#ifdef HAVE_LINUX_IF_ALG_H
>> +# include <linux/if_alg.h>
>> +#endif
> IMHO <linux/if_alg.h> does not need to be guarded.
> (as the definitions are in it it either fail because missing or fail because not
> loaded)
>> +])
Yes. Do you merge this patch with deleting this ifdef? Or I sent a v2
patch for this.
Also, I think you can remove" #ifdef HAVE_LINUX_IF_PACKET_H" pair in
configure.ac
AC_CHECK_TYPES([struct tpacket_req3],,,[
#ifdef HAVE_LINUX_IF_PACKET_H
# include <linux/if_packet.h>
#endif
])
Best Regards
Yang Xu
>> +
>> # Tools knobs
> ...
>
> Kind regards,
> Petr
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined
2020-08-28 9:34 ` Yang Xu
@ 2020-08-28 10:33 ` Petr Vorel
2020-08-28 10:40 ` Petr Vorel
1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2020-08-28 10:33 UTC (permalink / raw)
To: ltp
Hi Xu,
> Hi Petr
> > Hi,
> > ...
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -193,6 +193,12 @@ AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
> > > #include <linux/netfilter_ipv4/ip_tables.h>
> > > ])
> > > +AC_CHECK_TYPES([struct sockaddr_alg, struct af_alg_iv],,,[
> > > +#ifdef HAVE_LINUX_IF_ALG_H
> > > +# include <linux/if_alg.h>
> > > +#endif
> > IMHO <linux/if_alg.h> does not need to be guarded.
> > (as the definitions are in it it either fail because missing or fail because not
> > loaded)
> > > +])
> Yes. Do you merge this patch with deleting this ifdef? Or I sent a v2 patch
> for this.
> Also, I think you can remove" #ifdef HAVE_LINUX_IF_PACKET_H" pair in
> configure.ac
> AC_CHECK_TYPES([struct tpacket_req3],,,[
> #ifdef HAVE_LINUX_IF_PACKET_H
> # include <linux/if_packet.h>
> #endif
> ])
I'll fix it and merge.
Kind regards,
Petr
> Best Regards
> Yang Xu
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined
2020-08-28 9:34 ` Yang Xu
2020-08-28 10:33 ` Petr Vorel
@ 2020-08-28 10:40 ` Petr Vorel
1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2020-08-28 10:40 UTC (permalink / raw)
To: ltp
Hi,
> > ...
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -193,6 +193,12 @@ AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
> > > #include <linux/netfilter_ipv4/ip_tables.h>
> > > ])
> > > +AC_CHECK_TYPES([struct sockaddr_alg, struct af_alg_iv],,,[
> > > +#ifdef HAVE_LINUX_IF_ALG_H
> > > +# include <linux/if_alg.h>
> > > +#endif
> > IMHO <linux/if_alg.h> does not need to be guarded.
> > (as the definitions are in it it either fail because missing or fail because not
> > loaded)
> > > +])
> Yes. Do you merge this patch with deleting this ifdef? Or I sent a v2 patch
> for this.
Merged.
> Also, I think you can remove" #ifdef HAVE_LINUX_IF_PACKET_H" pair in
> configure.ac
> AC_CHECK_TYPES([struct tpacket_req3],,,[
> #ifdef HAVE_LINUX_IF_PACKET_H
> # include <linux/if_packet.h>
> #endif
> ])
I'll cleanup this in a separate patch.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-08-28 10:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-21 10:18 [LTP] [PATCH] tst_af_alg: fix build error when ALG_SET_AEAD_ASSOCLEN undefined Yang Xu
2020-08-28 8:43 ` Petr Vorel
2020-08-28 9:27 ` Yang Xu
2020-08-28 8:48 ` Petr Vorel
2020-08-28 9:34 ` Yang Xu
2020-08-28 10:33 ` Petr Vorel
2020-08-28 10:40 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.