]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - net/ipv4/raw.c
net: use dst_confirm_neigh for UDP, RAW, ICMP, L2TP
[mirror_ubuntu-zesty-kernel.git] / net / ipv4 / raw.c
index 4e49e5cb001ccd6824104af273bcbc40fc864ef7..43b0297ed980ce939f6a63170fddd8fd9c5d692f 100644 (file)
@@ -358,6 +358,9 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
                               rt->dst.dev->mtu);
                return -EMSGSIZE;
        }
+       if (length < sizeof(struct iphdr))
+               return -EINVAL;
+
        if (flags&MSG_PROBE)
                goto out;
 
@@ -383,6 +386,9 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
 
        sock_tx_timestamp(sk, sockc->tsflags, &skb_shinfo(skb)->tx_flags);
 
+       if (flags & MSG_CONFIRM)
+               skb_set_dst_pending_confirm(skb, 1);
+
        skb->transport_header = skb->network_header;
        err = -EFAULT;
        if (memcpy_from_msg(iph, msg, length))
@@ -666,7 +672,8 @@ out:
        return len;
 
 do_confirm:
-       dst_confirm(&rt->dst);
+       if (msg->msg_flags & MSG_PROBE)
+               dst_confirm_neigh(&rt->dst, &fl4.daddr);
        if (!(msg->msg_flags & MSG_PROBE) || len)
                goto back_from_confirm;
        err = 0;