All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] net: if_arp: use define instead of hard-coded value
@ 2018-09-21 10:39 Håkon Bugge
  2018-09-21 10:39 ` [PATCH 1/2] net: if_arp: Fix incorrect indents Håkon Bugge
  2018-09-21 10:39 ` [PATCH 2/2] net: if_arp: use define instead of hard-coded value Håkon Bugge
  0 siblings, 2 replies; 4+ messages in thread
From: Håkon Bugge @ 2018-09-21 10:39 UTC (permalink / raw)
  To: David S . Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
  Cc: linux-kernel, netdev

Struct arpreq contains the name of the device. All other places in the
kernel, the define IFNAMSIZ is used to designate its size. But in
if_arp.h, a literal constant is used.

As it could be good reasons to use constants instead of the defines in
include files under uapi, it seems to be OK to use the define here,
without opening a can of worms in user-land.

This because if_arp.h includes netdevice.h, which also uses
IFNAMSIZ. For the distros I have checked, this also holds true for the
use-land side.

The series also fixes some incorrect indents.

Håkon Bugge (2):
  net: if_arp: Fix incorrect indents
  net: if_arp: use define instead of hard-coded value

 include/uapi/linux/if_arp.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--
2.14.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] net: if_arp: Fix incorrect indents
  2018-09-21 10:39 [PATCH 0/2] net: if_arp: use define instead of hard-coded value Håkon Bugge
@ 2018-09-21 10:39 ` Håkon Bugge
  2018-09-21 10:39 ` [PATCH 2/2] net: if_arp: use define instead of hard-coded value Håkon Bugge
  1 sibling, 0 replies; 4+ messages in thread
From: Håkon Bugge @ 2018-09-21 10:39 UTC (permalink / raw)
  To: David S . Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
  Cc: linux-kernel, netdev

Fixing incorrect indents and align comments.

Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
---
 include/uapi/linux/if_arp.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
index 4605527ca41b..b68b4b3d9172 100644
--- a/include/uapi/linux/if_arp.h
+++ b/include/uapi/linux/if_arp.h
@@ -114,18 +114,18 @@
 
 /* ARP ioctl request. */
 struct arpreq {
-  struct sockaddr	arp_pa;		/* protocol address		*/
-  struct sockaddr	arp_ha;		/* hardware address		*/
-  int			arp_flags;	/* flags			*/
-  struct sockaddr       arp_netmask;    /* netmask (only for proxy arps) */
-  char			arp_dev[16];
+	struct sockaddr	arp_pa;		/* protocol address		 */
+	struct sockaddr	arp_ha;		/* hardware address		 */
+	int		arp_flags;	/* flags			 */
+	struct sockaddr arp_netmask;    /* netmask (only for proxy arps) */
+	char		arp_dev[16];
 };
 
 struct arpreq_old {
-  struct sockaddr	arp_pa;		/* protocol address		*/
-  struct sockaddr	arp_ha;		/* hardware address		*/
-  int			arp_flags;	/* flags			*/
-  struct sockaddr       arp_netmask;    /* netmask (only for proxy arps) */
+	struct sockaddr	arp_pa;		/* protocol address		 */
+	struct sockaddr	arp_ha;		/* hardware address		 */
+	int		arp_flags;	/* flags			 */
+	struct sockaddr	arp_netmask;    /* netmask (only for proxy arps) */
 };
 
 /* ARP Flag values. */
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net: if_arp: use define instead of hard-coded value
  2018-09-21 10:39 [PATCH 0/2] net: if_arp: use define instead of hard-coded value Håkon Bugge
  2018-09-21 10:39 ` [PATCH 1/2] net: if_arp: Fix incorrect indents Håkon Bugge
@ 2018-09-21 10:39 ` Håkon Bugge
  2018-09-26  9:27   ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Håkon Bugge @ 2018-09-21 10:39 UTC (permalink / raw)
  To: David S . Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
  Cc: linux-kernel, netdev

uapi/linux/if_arp.h includes linux/netdevice.h, which uses
IFNAMSIZ. Hence, use it instead of hard-coded value.

Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
---
 include/uapi/linux/if_arp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
index b68b4b3d9172..c3cc5a9e5eaf 100644
--- a/include/uapi/linux/if_arp.h
+++ b/include/uapi/linux/if_arp.h
@@ -118,7 +118,7 @@ struct arpreq {
 	struct sockaddr	arp_ha;		/* hardware address		 */
 	int		arp_flags;	/* flags			 */
 	struct sockaddr arp_netmask;    /* netmask (only for proxy arps) */
-	char		arp_dev[16];
+	char		arp_dev[IFNAMSIZ];
 };
 
 struct arpreq_old {
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] net: if_arp: use define instead of hard-coded value
  2018-09-21 10:39 ` [PATCH 2/2] net: if_arp: use define instead of hard-coded value Håkon Bugge
@ 2018-09-26  9:27   ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-09-26  9:27 UTC (permalink / raw)
  To: Håkon Bugge
  Cc: David S . Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI,
	linux-kernel, netdev

On Fri, 21 Sep 2018 12:39:30 +0200
Håkon Bugge <Haakon.Bugge@oracle.com> wrote:

> uapi/linux/if_arp.h includes linux/netdevice.h, which uses
> IFNAMSIZ. Hence, use it instead of hard-coded value.
> 
> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>

I tested build of iproute2 with updated header and there is no issue.

Tested-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-26  9:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21 10:39 [PATCH 0/2] net: if_arp: use define instead of hard-coded value Håkon Bugge
2018-09-21 10:39 ` [PATCH 1/2] net: if_arp: Fix incorrect indents Håkon Bugge
2018-09-21 10:39 ` [PATCH 2/2] net: if_arp: use define instead of hard-coded value Håkon Bugge
2018-09-26  9:27   ` Stephen Hemminger

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.