netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: greearb@candelatech.com
Cc: netdev@vger.kernel.org, kaber@trash.net
Subject: Re: SO_BINDTODEVICE mismatch with man page & comments.
Date: Fri, 14 Sep 2007 15:29:12 -0700 (PDT)	[thread overview]
Message-ID: <20070914.152912.74747426.davem@davemloft.net> (raw)
In-Reply-To: <46EB071B.9070308@candelatech.com>

From: Ben Greear <greearb@candelatech.com>
Date: Fri, 14 Sep 2007 15:11:39 -0700

>  From user-space, does this imply that the 'empty string' we use to
> unbind must be at least 4 bytes long, but with the first byte /0?
>
> If so, I think it might be confusing for the comments to say use ""
> to unbind, since that would not be a long enough chunk of memory.
> 
> Maybe something like "Use a character array of at least 4 bytes in
> length with the first byte set to '/0'."

I realize this, I'll try to come up with some clean way to
deal with this.

I don't want to touch that "if (optlen < sizeof(int))" test
at all because it makes all of the logic incredibly complicated
because you then have to forcefully initialize the 'val' and
'valbool' if you bypass reading the int.

> This brings up another issue as well:  What if the device name is "tr1",
> to bind to it we'd have to pass in "tr1/0" and optlen of 4.  Not that this
> is difficult to do, but it does seem like a weird thing to have to do.

You always to account for the NULL termination, thus you always have
to pass in "strlen(X) + 1" as optlen.

But I see your point, and my answer is the same as the first one.

Instead of nit-picking, can you instead try the patch and let me
know if it makes things work for you?

Thanks.


  reply	other threads:[~2007-09-14 22:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-04 22:45 SO_BINDTODEVICE mismatch with man page & comments Ben Greear
2007-09-12 15:08 ` David Miller
2007-09-14 20:12 ` David Miller
2007-09-14 22:11   ` Ben Greear
2007-09-14 22:29     ` David Miller [this message]
2007-09-14 22:37       ` Ben Greear
2007-09-14 22:43         ` David Miller
2007-09-14 23:09           ` Ben Greear

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=20070914.152912.74747426.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=greearb@candelatech.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.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).