netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart De Schuymer <bdschuym@pandora.be>
To: "David S. Miller" <davem@redhat.com>
Cc: laforge@netfilter.org, hno@marasystems.com,
	acme@conectiva.com.br, netfilter-devel@lists.netfilter.org,
	netdev@oss.sgi.com
Subject: Re: ipt_physdev.c alignment problems on parisc64
Date: Sat, 20 Sep 2003 13:32:12 +0200	[thread overview]
Message-ID: <200309201332.13167.bdschuym@pandora.be> (raw)
In-Reply-To: <20030918194802.6726d53c.davem@redhat.com>

On Friday 19 September 2003 04:48, David S. Miller wrote:
> Don't use an alignment attribute, just put the member of
> the struct at the very beginning and use "unsigned int"
> at a time op+comparisons.
>
> How about that?

Fine with me.

cheers,
Bart


--- linux-2.6.0-test5/include/linux/netfilter_ipv4/ipt_physdev.h.old	2003-09-20 13:28:26.000000000 +0200
+++ linux-2.6.0-test5/include/linux/netfilter_ipv4/ipt_physdev.h	2003-09-20 13:29:06.000000000 +0200
@@ -13,12 +13,12 @@
 #define IPT_PHYSDEV_OP_MASK		(0x20 - 1)
 
 struct ipt_physdev_info {
-	u_int8_t invert;
-	u_int8_t bitmask;
 	char physindev[IFNAMSIZ];
 	char in_mask[IFNAMSIZ];
 	char physoutdev[IFNAMSIZ];
 	char out_mask[IFNAMSIZ];
+	u_int8_t invert;
+	u_int8_t bitmask;
 };
 
 #endif /*_IPT_PHYSDEV_H*/
--- linux-2.6.0-test5/net/ipv4/netfilter/ipt_physdev.c.old	2003-09-20 13:28:44.000000000 +0200
+++ linux-2.6.0-test5/net/ipv4/netfilter/ipt_physdev.c	2003-09-20 13:29:06.000000000 +0200
@@ -23,7 +23,7 @@ match(const struct sk_buff *skb,
 	int i;
 	static const char nulldevname[IFNAMSIZ];
 	const struct ipt_physdev_info *info = matchinfo;
-	unsigned long ret;
+	unsigned int ret;
 	const char *indev, *outdev;
 	struct nf_bridge_info *nf_bridge;
 
@@ -65,10 +65,10 @@ match(const struct sk_buff *skb,
 	if (!(info->bitmask & IPT_PHYSDEV_OP_IN))
 		goto match_outdev;
 	indev = nf_bridge->physindev ? nf_bridge->physindev->name : nulldevname;
-	for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
-		ret |= (((const unsigned long *)indev)[i]
-			^ ((const unsigned long *)info->physindev)[i])
-			& ((const unsigned long *)info->in_mask)[i];
+	for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned int); i++) {
+		ret |= (((const unsigned int *)indev)[i]
+			^ ((const unsigned int *)info->physindev)[i])
+			& ((const unsigned int *)info->in_mask)[i];
 	}
 
 	if ((ret == 0) ^ !(info->invert & IPT_PHYSDEV_OP_IN))
@@ -79,10 +79,10 @@ match_outdev:
 		return MATCH;
 	outdev = nf_bridge->physoutdev ?
 		 nf_bridge->physoutdev->name : nulldevname;
-	for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
-		ret |= (((const unsigned long *)outdev)[i]
-			^ ((const unsigned long *)info->physoutdev)[i])
-			& ((const unsigned long *)info->out_mask)[i];
+	for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned int); i++) {
+		ret |= (((const unsigned int *)outdev)[i]
+			^ ((const unsigned int *)info->physoutdev)[i])
+			& ((const unsigned int *)info->out_mask)[i];
 	}
 
 	return (ret != 0) ^ !(info->invert & IPT_PHYSDEV_OP_OUT);

  reply	other threads:[~2003-09-20 11:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-02 14:30 ipt_physdev.c alignment problems on parisc64 Arnaldo Carvalho de Melo
2003-09-02 19:16 ` Bart De Schuymer
2003-09-02 20:03   ` Arnaldo Carvalho de Melo
2003-09-04  3:04   ` David S. Miller
2003-09-05 15:31     ` Harald Welte
2003-09-09  2:14       ` David S. Miller
2003-09-13 19:59         ` Bart De Schuymer
2003-09-14  2:25           ` David S. Miller
2003-09-15 22:59           ` David S. Miller
2003-09-16  6:05             ` Bart De Schuymer
2003-09-16  6:02               ` David S. Miller
2003-09-16  9:18                 ` Henrik Nordstrom
2003-09-16 14:09                   ` Harald Welte
2003-09-17  1:16                     ` David S. Miller
2003-09-17 21:17                       ` Bart De Schuymer
2003-09-19  2:48                         ` David S. Miller
2003-09-20 11:32                           ` Bart De Schuymer [this message]
2003-09-20 16:05                             ` Arnaldo Carvalho de Melo
2003-09-22  0:53                             ` David S. Miller
2003-09-16 14:06             ` Harald Welte
2003-09-16 15:15               ` Tom Marshall
2003-09-16 15:57                 ` Bart De Schuymer
2003-09-17  1:23                   ` David S. Miller
2003-09-17  6:42                     ` Bart De Schuymer
2003-09-17  6:56                       ` David S. Miller
2003-09-12  1:40       ` jamal
2003-09-12  8:56         ` Harald Welte
2003-09-12 10:56           ` Oskar Andreasson
2003-09-12 12:56             ` jamal
2003-09-12 13:55               ` Oskar Andreasson
2003-09-12 12:54           ` jamal
2003-09-20  5:50             ` Harald Welte
2003-09-21 13:57               ` ppp ifindex WAS(Re: " jamal

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=200309201332.13167.bdschuym@pandora.be \
    --to=bdschuym@pandora.be \
    --cc=acme@conectiva.com.br \
    --cc=davem@redhat.com \
    --cc=hno@marasystems.com \
    --cc=laforge@netfilter.org \
    --cc=netdev@oss.sgi.com \
    --cc=netfilter-devel@lists.netfilter.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).