From: Hal Rosenstock <halr@voltaire.com>
To: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: openib-general@openib.org
Subject: [PATCH] sockaddr_ll change for IPoIB interface
Date: 11 Aug 2005 14:48:37 -0400 [thread overview]
Message-ID: <1123786117.4403.5835.camel@hal.voltaire.com> (raw)
Hi,
This is a repost of a patch which was posted last week which appears to
have been lost in the shuffle.
The patch below is to accomodate IPoIB link layer address in the
sockaddr_ll struct so that user space can send and receive IPoIB link
later packets. Unfortunately, IPoIB has 20 bytes LL addresses rather
than the 8 byte MAC addresses (or under) used by other LLs.
There is a similar change to both:
/usr/include/linux/if_packet.h
/usr/include/netpacket/packet.h
as in:
include/linux/if_packet.h below
to increase sll_addr from 8 to 20 bytes.
Thanks.
-- Hal
sockaddr_ll changes to accomodate IPoIB interfaces.
This is due to the fact that the IPoIB link layer
address is 20 bytes rather than 8 bytes. With the current 8 byte
address, it is not possible to send ARPs and RARPs from userspace as the
broadcast and unicast IPoIB addresses cannot be supplied properly.
There is backward compatibility support for those applications built
with the existing structure (prior to this patch).
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
--- include/linux/if_packet.h.orig 2005-06-29 19:00:53.000000000 -0400
+++ include/linux/if_packet.h 2005-08-05 10:04:06.000000000 -0400
@@ -8,6 +8,7 @@ struct sockaddr_pkt
unsigned short spkt_protocol;
};
+#define SOCKADDR_LL_COMPAT 12
struct sockaddr_ll
{
unsigned short sll_family;
@@ -16,7 +17,7 @@ struct sockaddr_ll
unsigned short sll_hatype;
unsigned char sll_pkttype;
unsigned char sll_halen;
- unsigned char sll_addr[8];
+ unsigned char sll_addr[20];
};
/* Packet types */
--- af_packet.c.orig 2005-06-29 19:00:53.000000000 -0400
+++ af_packet.c 2005-08-05 13:28:49.000000000 -0400
@@ -708,8 +708,12 @@ static int packet_sendmsg(struct kiocb *
addr = NULL;
} else {
err = -EINVAL;
- if (msg->msg_namelen < sizeof(struct sockaddr_ll))
- goto out;
+ if (msg->msg_namelen < sizeof(struct sockaddr_ll)) {
+ /* Support for older sockaddr_ll structs */
+ if ((msg->msg_namelen != sizeof(struct sockaddr_ll) - SOCKADDR_LL_COMPAT) ||
+ (saddr->sll_hatype == ARPHRD_INFINIBAND))
+ goto out;
+ }
ifindex = saddr->sll_ifindex;
proto = saddr->sll_protocol;
addr = saddr->sll_addr;
@@ -937,7 +941,11 @@ static int packet_bind(struct socket *so
*/
if (addr_len < sizeof(struct sockaddr_ll))
- return -EINVAL;
+ /* Support for older sockaddr_ll structs */
+ if ((addr_len != sizeof(struct sockaddr_ll) -
+ SOCKADDR_LL_COMPAT) ||
+ (sll->sll_hatype == ARPHRD_INFINIBAND))
+ return -EINVAL;
if (sll->sll_family != AF_PACKET)
return -EINVAL;
next reply other threads:[~2005-08-11 18:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-11 18:48 Hal Rosenstock [this message]
2005-08-11 19:49 ` [PATCH] sockaddr_ll change for IPoIB interface David S. Miller
2005-09-10 17:25 ` [PATCH] af_packet: Allow for > 8 byte hardware addresses Eric W. Biederman
2005-09-12 21:13 ` David S. Miller
2005-09-12 22:13 ` Eric W. Biederman
2005-09-12 22:45 ` David S. Miller
2005-09-20 17:17 ` Eric W. Biederman
2005-09-21 7:11 ` David S. Miller
2005-09-20 17:18 ` [PATCH] [NET] socket.c: zero socket addresses before use Eric W. Biederman
2005-09-21 7:13 ` David S. Miller
2005-09-21 13:48 ` Eric W. Biederman
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=1123786117.4403.5835.camel@hal.voltaire.com \
--to=halr@voltaire.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=openib-general@openib.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).