Skip to contentSkip to conversation

uapi: fix linux/packet_diag.h userspace compilation error

RFC PATCH In review Dmitry V. Levin 2 participants 6 messages Feb 28, 2017 – Mar 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 uapi: fix linux/packet_diag.h userspace compilation error

Replace MAX_ADDR_LEN with its numeric value to fix the following linux/packet_diag.h userspace compilation error:

/usr/include/linux/packet_diag.h:67:17: error: 'MAX_ADDR_LEN' undeclared here (not in a function)
__u8 pdmc_addr[MAX_ADDR_LEN];

This is not the first case in the UAPI where the numeric value of MAX_ADDR_LEN is used, uapi/linux/if_link.h already does the same, and there are no UAPI headers besides these two that use MAX_ADDR_LEN.

The alternative fix would be to include <linux/netdevice.h> which pulls in other headers and a lot of definitions with them.

---
I'm not quite comfortable with this approach but the alternative has its own drawbacks.

 include/uapi/linux/packet_diag.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/packet_diag.h +1 -1
index d08c63f..0c5d5dd 100644
@@ -64,7 +64,7 @@ struct packet_diag_mclist {
 	__u32	pdmc_count;
 	__u16	pdmc_type;
 	__u16	pdmc_alen;
-	__u8	pdmc_addr[MAX_ADDR_LEN];
+	__u8	pdmc_addr[32]; /* MAX_ADDR_LEN */
 };
 
 struct packet_diag_ring {
Signature · 1 line
ldv
maintainer
#1 lore raw

From: "Dmitry V. Levin" <[email protected]>
Date: Tue, 28 Feb 2017 04:39:30 +0300

Quoted 6 lines

Replace MAX_ADDR_LEN with its numeric value to fix the following linux/packet_diag.h userspace compilation error:

/usr/include/linux/packet_diag.h:67:17: error: 'MAX_ADDR_LEN' undeclared here (not in a function)
__u8 pdmc_addr[MAX_ADDR_LEN];

Quoted 8 lines

This is not the first case in the UAPI where the numeric value of MAX_ADDR_LEN is used, uapi/linux/if_link.h already does the same, and there are no UAPI headers besides these two that use MAX_ADDR_LEN.

The alternative fix would be to include <linux/netdevice.h> which pulls in other headers and a lot of definitions with them.

If if_link.h includes netdevice.h properly, let's try to do the same here as well.

Thanks.

#2 lore raw
Quoted 13 lines · David Miller

From: "Dmitry V. Levin" <[email protected]>
Date: Tue, 28 Feb 2017 04:39:30 +0300

Quoted 10 lines

Replace MAX_ADDR_LEN with its numeric value to fix the following linux/packet_diag.h userspace compilation error:

/usr/include/linux/packet_diag.h:67:17: error: 'MAX_ADDR_LEN' undeclared here (not in a function)
__u8 pdmc_addr[MAX_ADDR_LEN];

This is not the first case in the UAPI where the numeric value of MAX_ADDR_LEN is used, uapi/linux/if_link.h already does the same, and there are no UAPI headers besides these two that use MAX_ADDR_LEN.

Quoted 6 lines
Quoted 4 lines

The alternative fix would be to include <linux/netdevice.h> which pulls in other headers and a lot of definitions with them.

If if_link.h includes netdevice.h properly, let's try to do the same here as well.

Sorry if my words weren't clear enough: no, if_link.h doesn't include netdevice.h, it uses the _numeric_ value instead:

$ grep MAX_ADDR_LEN include/uapi/linux/if_link.h 
	__u8 mac[32]; /* MAX_ADDR_LEN */
Signature · 1 line
ldv
maintainer
#3 lore raw

From: "Dmitry V. Levin" <[email protected]>
Date: Tue, 7 Mar 2017 23:28:02 +0300

Quoted 19 lines · David Miller
Quoted 18 lines

From: "Dmitry V. Levin" <[email protected]>
Date: Tue, 28 Feb 2017 04:39:30 +0300

Quoted 14 lines

Replace MAX_ADDR_LEN with its numeric value to fix the following linux/packet_diag.h userspace compilation error:

/usr/include/linux/packet_diag.h:67:17: error: 'MAX_ADDR_LEN' undeclared here (not in a function)
__u8 pdmc_addr[MAX_ADDR_LEN];

This is not the first case in the UAPI where the numeric value of MAX_ADDR_LEN is used, uapi/linux/if_link.h already does the same, and there are no UAPI headers besides these two that use MAX_ADDR_LEN.

The alternative fix would be to include <linux/netdevice.h> which pulls in other headers and a lot of definitions with them.

Quoted 7 lines
Quoted 1 line

If if_link.h includes netdevice.h properly, let's try to do the same here as well.

Sorry if my words weren't clear enough: no, if_link.h doesn't include netdevice.h, it uses the _numeric_ value instead:

$ grep MAX_ADDR_LEN include/uapi/linux/if_link.h 
	__u8 mac[32]; /* MAX_ADDR_LEN */

Ok then we might as well do the same thing here, please resubmit this patch formally.

Thanks.

#4 lore raw

PATCH 1/1 uapi: fix linux/packet_diag.h userspace compilation error

Replace MAX_ADDR_LEN with its numeric value to fix the following linux/packet_diag.h userspace compilation error:

/usr/include/linux/packet_diag.h:67:17: error: 'MAX_ADDR_LEN' undeclared here (not in a function)
__u8 pdmc_addr[MAX_ADDR_LEN];

This is not the first case in the UAPI where the numeric value of MAX_ADDR_LEN is used instead of symbolic one, uapi/linux/if_link.h already does the same:

$ grep MAX_ADDR_LEN include/uapi/linux/if_link.h 
	__u8 mac[32]; /* MAX_ADDR_LEN */

There are no UAPI headers besides these two that use MAX_ADDR_LEN.

---
 include/uapi/linux/packet_diag.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/packet_diag.h +1 -1
index d08c63f..0c5d5dd 100644
@@ -64,7 +64,7 @@ struct packet_diag_mclist {
 	__u32	pdmc_count;
 	__u16	pdmc_type;
 	__u16	pdmc_alen;
-	__u8	pdmc_addr[MAX_ADDR_LEN];
+	__u8	pdmc_addr[32]; /* MAX_ADDR_LEN */
 };
 
 struct packet_diag_ring {
Signature · 1 line
ldv
maintainer
#5 lore raw

From: "Dmitry V. Levin" <[email protected]>
Date: Tue, 7 Mar 2017 23:50:50 +0300

Quoted 10 lines

Replace MAX_ADDR_LEN with its numeric value to fix the following linux/packet_diag.h userspace compilation error:

/usr/include/linux/packet_diag.h:67:17: error: 'MAX_ADDR_LEN' undeclared here (not in a function)
__u8 pdmc_addr[MAX_ADDR_LEN];

This is not the first case in the UAPI where the numeric value of MAX_ADDR_LEN is used instead of symbolic one, uapi/linux/if_link.h already does the same:

Quoted 7 lines
$ grep MAX_ADDR_LEN include/uapi/linux/if_link.h 
	__u8 mac[32]; /* MAX_ADDR_LEN */

There are no UAPI headers besides these two that use MAX_ADDR_LEN.

Applied and queued up for -stable.