netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: James Morris <jmorris@redhat.com>
Cc: netdev@oss.sgi.com
Subject: Re: [RFC] moving the test for sockaddr->sa_family up
Date: Sun, 16 Nov 2003 17:07:58 -0200	[thread overview]
Message-ID: <20031116190757.GA18416@conectiva.com.br> (raw)
In-Reply-To: <Xine.LNX.4.44.0311160855020.31201-100000@thoron.boston.redhat.com>

Em Sun, Nov 16, 2003 at 08:56:04AM -0500, James Morris escreveu:
> On Sat, 15 Nov 2003, Arnaldo Carvalho de Melo wrote:
> 
> > Does anybody see any problem with this simplification? Not for 2.6.0, of
> > course...
> 
> No, looks like a good idea.  Might be able to push address length 
> verification up there too.

Not really, look at the ax25 code... :-\ They have to support two address types,
if we want to keep this flexibility we can't check it at the upper layer,
does anybody here knows if we want or if we can ditch that thing in ax25? this:

net/ax25/af_ax25.c

static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{
        struct sock *sk = sock->sk;
        struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr;
        ax25_dev *ax25_dev = NULL;
        ax25_address *call;
        ax25_cb *ax25;
        int err = 0;

        if (addr_len != sizeof(struct sockaddr_ax25) &&
            addr_len != sizeof(struct full_sockaddr_ax25)) {
                /* support for old structure may go away some time */
                if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
                    (addr_len > sizeof(struct full_sockaddr_ax25))) {
                        return -EINVAL;
        }

                printk(KERN_WARNING "ax25_bind(): %s uses old (6 digipeater) socket structure.\n",
                        current->comm);
        }


I haven't checked for how many major kernel versions this thing is there, but
I'd love to trow this away if possible.

Ah, I tried to see if we could move the family test in the ->connect case as
well, only to enlighten myself with a trick in PF_UNIX, namely:

static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
                              int alen, int flags)
<SNIP>
        if (addr->sa_family != AF_UNSPEC) {
<SNIP>
	        } else {
                /*
                 *      1003.1g breaking connected state with AF_UNSPEC
                 */
                other = NULL;
                unix_state_wlock(sk);
        }

Oh well, the thing uses sa_family to a magic value to signal breaking connected
state, the wonders never cease :(

- Arnaldo

  reply	other threads:[~2003-11-16 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-15 21:20 [RFC] moving the test for sockaddr->sa_family up Arnaldo Carvalho de Melo
2003-11-16 13:56 ` James Morris
2003-11-16 19:07   ` Arnaldo Carvalho de Melo [this message]
2003-11-17 20:44     ` David S. Miller

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=20031116190757.GA18416@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=jmorris@redhat.com \
    --cc=netdev@oss.sgi.com \
    /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).