diff options
author | Tetsuo Handa <from-linux-kernel@i-love.sakura.ne.jp> | 2006-07-25 20:05:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-07-25 20:05:35 -0400 |
commit | f59fc7f30b710d45aadf715460b3e60dbe9d3418 (patch) | |
tree | 3394b198e6060638bf5ab7d6ee223cf3a27e1a0f /net/ipv6 | |
parent | 722874909271a807b243a797c2958e0a12992964 (diff) |
[IPV4/IPV6]: Setting 0 for unused port field in RAW IP recvmsg().
From: Tetsuo Handa from-linux-kernel@i-love.sakura.ne.jp
The recvmsg() for raw socket seems to return random u16 value
from the kernel stack memory since port field is not initialized.
But I'm not sure this patch is correct.
Does raw socket return any information stored in port field?
[ BSD defines RAW IP recvmsg to return a sin_port value of zero.
This is described in Steven's TCP/IP Illustrated Volume 2 on
page 1055, which is discussing the BSD rip_input() implementation. ]
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/raw.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index fa1ce0ae123e..d57e61ce4a7d 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -411,6 +411,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
411 | /* Copy the address. */ | 411 | /* Copy the address. */ |
412 | if (sin6) { | 412 | if (sin6) { |
413 | sin6->sin6_family = AF_INET6; | 413 | sin6->sin6_family = AF_INET6; |
414 | sin6->sin6_port = 0; | ||
414 | ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr); | 415 | ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr); |
415 | sin6->sin6_flowinfo = 0; | 416 | sin6->sin6_flowinfo = 0; |
416 | sin6->sin6_scope_id = 0; | 417 | sin6->sin6_scope_id = 0; |