Commit:     f13ec93fba60d339dc1663eb47b2fb801225d2d2
Parent:     d09f51b6997f3f443c5741bc696651e479576715
Author:     Dmitry Butskoy <[EMAIL PROTECTED]>
AuthorDate: Sat Jul 14 23:53:08 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Sat Jul 14 23:53:08 2007 -0700

    [IPV6]: MSG_ERRQUEUE messages do not pass to connected raw sockets
    From: Dmitry Butskoy <[EMAIL PROTECTED]>
    Taken from
    Problem Description:
    It is related to the possibility to obtain MSG_ERRQUEUE messages from the 
    and raw sockets, both connected and unconnected.
    There is a little typo in net/ipv6/icmp.c code, which prevents such messages
    to be delivered to the errqueue of the correspond raw socket, when the 
    is CONNECTED.  The typo is due to swap of local/remote addresses.
    Consider __raw_v6_lookup() function from net/ipv6/raw.c. When a raw socket 
    looked up usual way, it is something like:
    sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr, IP6CB(skb)->iif);
    where "daddr" is a destination address of the incoming packet (IOW our local
    address), "saddr" is a source address of the incoming packet (the remote 
    But when the raw socket is looked up for some icmp error report, in
    net/ipv6/icmp.c:icmpv6_notify() , daddr/saddr are obtained from the echoed
    fragment of the "bad" packet, i.e.  "daddr" is the original destination
    address of that packet, "saddr" is our local address.  Hence, for
    icmpv6_notify() must use "saddr, daddr" in its arguments, not "daddr, saddr"
    Steps to reproduce:
    Create some raw socket, connect it to an address, and cause some error
    situation: f.e. set ttl=1 where the remote address is more than 1 hop to 
    Set IPV6_RECVERR .
    Then send something and wait for the error (f.e. poll() with 
    You should receive "time exceeded" icmp message (because of "ttl=1"), but 
    socket do not receive it.
    If you do not connect your raw socket, you will receive MSG_ERRQUEUE
    successfully.  (The reason is that for unconnected socket there are no 
    checks for local/remote addresses).
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
 net/ipv6/icmp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 4765a29..6a6714d 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -604,7 +604,7 @@ static void icmpv6_notify(struct sk_buff *skb, int type, 
int code, __be32 info)
        if ((sk = sk_head(&raw_v6_htable[hash])) != NULL) {
-               while((sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr,
+               while ((sk = __raw_v6_lookup(sk, nexthdr, saddr, daddr,
                                            IP6CB(skb)->iif))) {
                        rawv6_err(sk, skb, NULL, type, code, inner_offset, 
                        sk = sk_next(sk);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to