netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.9] address family not supported for sendmsg()
@ 2004-10-22  4:27 Suresh Krishnan
  2004-10-22  5:58 ` David S. Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Suresh Krishnan @ 2004-10-22  4:27 UTC (permalink / raw)
  To: davem, netdev

When sendmsg() encounters an unsupported address family
it must return EAFNOSUPPORT. It currently returns EINVAL,
which must be returned only when the sum of the iov_len 
values overflows a ssize_t.

Signed-off-by: Suresh Krishnan <suresh.krishnan@ericsson.ca>
---

diff -Nur linux-2.6.9/net/ipv4/raw.c linux-2.6.9-patched/net/ipv4/raw.c
--- linux-2.6.9/net/ipv4/raw.c  2004-10-18 17:54:31.000000000 -0400
+++ linux-2.6.9-patched/net/ipv4/raw.c  2004-10-21 16:38:15.000000000 -0400
@@ -407,7 +407,7 @@
                                printk(KERN_INFO "%s forgot to set AF_INET in "
                                                 "raw sendmsg. Fix it!\n",
                                                 current->comm);
-                       err = -EINVAL;
+                       err = -EAFNOSUPPORT;
                        if (usin->sin_family)
                                goto out;
                }
diff -Nur linux-2.6.9/net/ipv4/udp.c linux-2.6.9-patched/net/ipv4/udp.c
--- linux-2.6.9/net/ipv4/udp.c  2004-10-18 17:53:22.000000000 -0400
+++ linux-2.6.9-patched/net/ipv4/udp.c  2004-10-21 16:37:40.000000000 -0400
@@ -531,7 +531,7 @@
                        return -EINVAL;
                if (usin->sin_family != AF_INET) {
                        if (usin->sin_family != AF_UNSPEC)
-                               return -EINVAL;
+                               return -EAFNOSUPPORT;
                }

                daddr = usin->sin_addr.s_addr;
diff -Nur linux-2.6.9/net/ipv6/raw.c linux-2.6.9-patched/net/ipv6/raw.c
--- linux-2.6.9/net/ipv6/raw.c  2004-10-18 17:53:51.000000000 -0400
+++ linux-2.6.9-patched/net/ipv6/raw.c  2004-10-21 16:38:00.000000000 -0400
@@ -639,7 +639,7 @@
                        return -EINVAL;

                if (sin6->sin6_family && sin6->sin6_family != AF_INET6)
-                       return(-EINVAL);
+                       return(-EAFNOSUPPORT);

                /* port is the proto value [0..255] carried in nexthdr */
                proto = ntohs(sin6->sin6_port);
diff -Nur linux-2.6.9/net/ipv6/udp.c linux-2.6.9-patched/net/ipv6/udp.c
--- linux-2.6.9/net/ipv6/udp.c  2004-10-18 17:54:55.000000000 -0400
+++ linux-2.6.9-patched/net/ipv6/udp.c  2004-10-21 16:37:52.000000000 -0400
@@ -699,7 +699,7 @@
                if (likely(up->pending)) {
                        if (unlikely(up->pending != AF_INET6)) {
                                release_sock(sk);
-                               return -EINVAL;
+                               return -EAFNOSUPPORT;
                        }
                        dst = NULL;
                        goto do_append_data;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.9] address family not supported for sendmsg()
  2004-10-22  4:27 [PATCH 2.6.9] address family not supported for sendmsg() Suresh Krishnan
@ 2004-10-22  5:58 ` David S. Miller
  2004-10-22  6:30   ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2004-10-22  5:58 UTC (permalink / raw)
  To: Suresh Krishnan; +Cc: netdev

On Fri, 22 Oct 2004 00:27:14 -0400 (EDT)
Suresh Krishnan <suresh.krishnan@ericsson.ca> wrote:

> --- linux-2.6.9/net/ipv6/udp.c  2004-10-18 17:54:55.000000000 -0400
> +++ linux-2.6.9-patched/net/ipv6/udp.c  2004-10-21 16:37:52.000000000 -0400
> @@ -699,7 +699,7 @@
>                 if (likely(up->pending)) {
>                         if (unlikely(up->pending != AF_INET6)) {
>                                 release_sock(sk);
> -                               return -EINVAL;
> +                               return -EAFNOSUPPORT;

I think this case should remain -EINVAL.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.9] address family not supported for sendmsg()
  2004-10-22  5:58 ` David S. Miller
@ 2004-10-22  6:30   ` YOSHIFUJI Hideaki / 吉藤英明
  2004-10-22  6:31     ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 6+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-10-22  6:30 UTC (permalink / raw)
  To: davem; +Cc: suresh.krishnan, netdev, yoshfuji

In article <20041021225820.72d278c7.davem@davemloft.net> (at Thu, 21 Oct 2004 22:58:20 -0700), "David S. Miller" <davem@davemloft.net> says:

> On Fri, 22 Oct 2004 00:27:14 -0400 (EDT)
> Suresh Krishnan <suresh.krishnan@ericsson.ca> wrote:
> 
> > --- linux-2.6.9/net/ipv6/udp.c  2004-10-18 17:54:55.000000000 -0400
> > +++ linux-2.6.9-patched/net/ipv6/udp.c  2004-10-21 16:37:52.000000000 -0400
> > @@ -699,7 +699,7 @@
> >                 if (likely(up->pending)) {
> >                         if (unlikely(up->pending != AF_INET6)) {
> >                                 release_sock(sk);
> > -                               return -EINVAL;
> > +                               return -EAFNOSUPPORT;
> 
> I think this case should remain -EINVAL.

EAFNOSUPPORT may be okay.

If we try to push data for ipv6 socket
while data is pending for ipv4 destination,
the family of destination (ipv6) is not allowed for that socket.
This may be convered by EAFNOSUPPORT.

--yoshfuji

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.9] address family not supported for sendmsg()
  2004-10-22  6:30   ` YOSHIFUJI Hideaki / 吉藤英明
@ 2004-10-22  6:31     ` YOSHIFUJI Hideaki / 吉藤英明
  2004-10-23  0:07       ` Suresh Krishnan
  0 siblings, 1 reply; 6+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-10-22  6:31 UTC (permalink / raw)
  To: davem; +Cc: suresh.krishnan, netdev, yoshfuji

In article <20041022.153056.57690221.yoshfuji@linux-ipv6.org> (at Fri, 22 Oct 2004 15:30:56 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:

> This may be convered by EAFNOSUPPORT.
              covered

--yoshfuji

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.9] address family not supported for sendmsg()
  2004-10-22  6:31     ` YOSHIFUJI Hideaki / 吉藤英明
@ 2004-10-23  0:07       ` Suresh Krishnan
  2004-10-23  5:29         ` David S. Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Suresh Krishnan @ 2004-10-23  0:07 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明
  Cc: davem, suresh.krishnan, netdev

Hi Dave/Yoshifuji,
  I agree that the case you pointed out is tricky. I am fine with either 
EAFNOSUPPORT or EINVAL. But the POSIX and SUSv3 man pages specify EINVAL 
as a error only when the sum of iov_len values overflows ssize_t.

Thanks
Suresh

On Fri, 22 Oct 2004, YOSHIFUJI Hideaki / [iso-2022-jp] ^[$B5HF#1QL@^[(B wrote:

>In article <20041022.153056.57690221.yoshfuji@linux-ipv6.org> (at Fri, 22 Oct 2004 15:30:56 +0900 (JST)), YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(J <yoshfuji@linux-ipv6.org> says:
>
>> This may be convered by EAFNOSUPPORT.
>              covered
>
>--yoshfuji
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.9] address family not supported for sendmsg()
  2004-10-23  0:07       ` Suresh Krishnan
@ 2004-10-23  5:29         ` David S. Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2004-10-23  5:29 UTC (permalink / raw)
  To: Suresh Krishnan; +Cc: yoshfuji, netdev

On Fri, 22 Oct 2004 20:07:01 -0400 (EDT)
Suresh Krishnan <suresh.krishnan@ericsson.ca> wrote:

> Hi Dave/Yoshifuji,
>   I agree that the case you pointed out is tricky. I am fine with either 
> EAFNOSUPPORT or EINVAL. But the POSIX and SUSv3 man pages specify EINVAL 
> as a error only when the sum of iov_len values overflows ssize_t.

I now think EAFNOSUPPORT is fine.

Please resend your patch to me under private cover so I
can apply it Suresh, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-10-23  5:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-22  4:27 [PATCH 2.6.9] address family not supported for sendmsg() Suresh Krishnan
2004-10-22  5:58 ` David S. Miller
2004-10-22  6:30   ` YOSHIFUJI Hideaki / 吉藤英明
2004-10-22  6:31     ` YOSHIFUJI Hideaki / 吉藤英明
2004-10-23  0:07       ` Suresh Krishnan
2004-10-23  5:29         ` David S. Miller

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).