Subject: Re: [PATCH 0/5] [RFC] AF_RXRPC socket family implementation

From: David Howells <[email-masked]>
Date: Thu, 22 Feb 2007 13:02:27 +0000

YOSHIFUJI Hideaki <[email-masked]> wrote:

> This sockaddr_rxrpc{} should NOT include sockaddr_in{} directly.
> Please use sockaddr_storage{} (or sockaddr{}, maybe), and make it
> sure to align on 64-bit word.

How about this then:

struct sockaddr_rxrpc {
	sa_family_t	srx_family;	/* address family */
	u16		srx_service;	/* service desired */
	u16		transport_type;	/* type of transport socket (SOCK_DGRAM) */
	u16		transport_len;	/* length of transport address */
	struct sockaddr	srx_sa[0];	/* address of transport endpoint */
};

Then whoever wants to use it must follow it immediately with an address of the
appropriate type.  The length given to connect or bind would then be the
combined length of the two addresses.

Someone could then set one up on the stack by this sort of thing:

	int zebra(int fd)
	{
		struct {
			struct sockaddr_rxrpc srx;
			struct sockaddr_in sin;
		} sa;

		...
		if (connect(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
			...
		...
	}

David