summaryrefslogtreecommitdiff
path: root/net/ipv6/ip6_input.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2017-04-24 22:03:14 -0600
committerJens Axboe <axboe@fb.com>2017-04-24 22:03:14 -0600
commitd9fd363a6cbfae24ffaa00ac6fd3ce8e271acaf1 (patch)
tree9139831824ebe9cf77d1bf836b558ee2061c0483 /net/ipv6/ip6_input.c
parenta44f53faf4674d84cba79f7ee574584e18ab8744 (diff)
parent8f9cedc76fc7d9bc916127f8fe1287a249891d40 (diff)
Merge branch 'master' into for-4.12/post-merge
Diffstat (limited to 'net/ipv6/ip6_input.c')
-rw-r--r--net/ipv6/ip6_input.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index aacfb4bce153..c45b12b4431c 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -122,11 +122,14 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs));
/*
* RFC4291 2.5.3
+ * The loopback address must not be used as the source address in IPv6
+ * packets that are sent outside of a single node. [..]
* A packet received on an interface with a destination address
* of loopback must be dropped.
*/
- if (!(dev->flags & IFF_LOOPBACK) &&
- ipv6_addr_loopback(&hdr->daddr))
+ if ((ipv6_addr_loopback(&hdr->saddr) ||
+ ipv6_addr_loopback(&hdr->daddr)) &&
+ !(dev->flags & IFF_LOOPBACK))
goto err;
/* RFC4291 Errata ID: 3480