aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-07-17 06:29:28 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-17 06:29:28 -0400
commit6700c2709c08d74ae2c3c29b84a30da012dbc7f1 (patch)
tree1d44f300ec3cf5f9845fba7a25491e33d666426f /net/ipv4
parent02f3d4ce9e81434a365f4643020b0402f6fe3332 (diff)
net: Pass optional SKB and SK arguments to dst_ops->{update_pmtu,redirect}()
This will be used so that we can compose a full flow key. Even though we have a route in this context, we need more. In the future the routes will be without destination address, source address, etc. keying. One ipv4 route will cover entire subnets, etc. In this environment we have to have a way to possess persistent storage for redirects and PMTU information. This persistent storage will exist in the FIB tables, and that's why we'll need to be able to rebuild a full lookup flow key here. Using that flow key will do a fib_lookup() and create/update the persistent entry. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_connection_sock.c2
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ipip.c2
-rw-r--r--net/ipv4/route.c21
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/xfrm4_policy.c10
6 files changed, 23 insertions, 16 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 200d21809379..3ea465286a39 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -840,7 +840,7 @@ struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu)
840 if (!dst) 840 if (!dst)
841 goto out; 841 goto out;
842 } 842 }
843 dst->ops->update_pmtu(dst, mtu); 843 dst->ops->update_pmtu(dst, sk, NULL, mtu);
844 844
845 dst = __sk_dst_check(sk, 0); 845 dst = __sk_dst_check(sk, 0);
846 if (!dst) 846 if (!dst)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 0c3123566d76..42c44b1403c9 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -833,7 +833,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
833 mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; 833 mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;
834 834
835 if (skb_dst(skb)) 835 if (skb_dst(skb))
836 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu); 836 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);
837 837
838 if (skb->protocol == htons(ETH_P_IP)) { 838 if (skb->protocol == htons(ETH_P_IP)) {
839 df |= (old_iph->frag_off&htons(IP_DF)); 839 df |= (old_iph->frag_off&htons(IP_DF));
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index c2d0e6d8baaf..2c2c35bace76 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -519,7 +519,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
519 } 519 }
520 520
521 if (skb_dst(skb)) 521 if (skb_dst(skb))
522 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu); 522 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);
523 523
524 if ((old_iph->frag_off & htons(IP_DF)) && 524 if ((old_iph->frag_off & htons(IP_DF)) &&
525 mtu < ntohs(old_iph->tot_len)) { 525 mtu < ntohs(old_iph->tot_len)) {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index aad21819316d..b35d3bfc66cd 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -148,8 +148,10 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst);
148static void ipv4_dst_destroy(struct dst_entry *dst); 148static void ipv4_dst_destroy(struct dst_entry *dst);
149static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); 149static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
150static void ipv4_link_failure(struct sk_buff *skb); 150static void ipv4_link_failure(struct sk_buff *skb);
151static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu); 151static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
152static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb); 152 struct sk_buff *skb, u32 mtu);
153static void ip_do_redirect(struct dst_entry *dst, struct sock *sk,
154 struct sk_buff *skb);
153static int rt_garbage_collect(struct dst_ops *ops); 155static int rt_garbage_collect(struct dst_ops *ops);
154 156
155static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 157static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
@@ -1273,7 +1275,7 @@ static void rt_del(unsigned int hash, struct rtable *rt)
1273 spin_unlock_bh(rt_hash_lock_addr(hash)); 1275 spin_unlock_bh(rt_hash_lock_addr(hash));
1274} 1276}
1275 1277
1276static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb) 1278static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb)
1277{ 1279{
1278 __be32 new_gw = icmp_hdr(skb)->un.gateway; 1280 __be32 new_gw = icmp_hdr(skb)->un.gateway;
1279 __be32 old_gw = ip_hdr(skb)->saddr; 1281 __be32 old_gw = ip_hdr(skb)->saddr;
@@ -1506,7 +1508,8 @@ out: kfree_skb(skb);
1506 return 0; 1508 return 0;
1507} 1509}
1508 1510
1509static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) 1511static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
1512 struct sk_buff *skb, u32 mtu)
1510{ 1513{
1511 struct rtable *rt = (struct rtable *) dst; 1514 struct rtable *rt = (struct rtable *) dst;
1512 1515
@@ -1531,7 +1534,7 @@ void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
1531 iph->daddr, iph->saddr, 0, 0); 1534 iph->daddr, iph->saddr, 0, 0);
1532 rt = __ip_route_output_key(net, &fl4); 1535 rt = __ip_route_output_key(net, &fl4);
1533 if (!IS_ERR(rt)) { 1536 if (!IS_ERR(rt)) {
1534 ip_rt_update_pmtu(&rt->dst, mtu); 1537 ip_rt_update_pmtu(&rt->dst, NULL, skb, mtu);
1535 ip_rt_put(rt); 1538 ip_rt_put(rt);
1536 } 1539 }
1537} 1540}
@@ -1559,7 +1562,7 @@ void ipv4_redirect(struct sk_buff *skb, struct net *net,
1559 protocol, flow_flags, iph->daddr, iph->saddr, 0, 0); 1562 protocol, flow_flags, iph->daddr, iph->saddr, 0, 0);
1560 rt = __ip_route_output_key(net, &fl4); 1563 rt = __ip_route_output_key(net, &fl4);
1561 if (!IS_ERR(rt)) { 1564 if (!IS_ERR(rt)) {
1562 ip_do_redirect(&rt->dst, skb); 1565 ip_do_redirect(&rt->dst, NULL, skb);
1563 ip_rt_put(rt); 1566 ip_rt_put(rt);
1564 } 1567 }
1565} 1568}
@@ -2587,11 +2590,13 @@ static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst)
2587 return mtu ? : dst->dev->mtu; 2590 return mtu ? : dst->dev->mtu;
2588} 2591}
2589 2592
2590static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 2593static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
2594 struct sk_buff *skb, u32 mtu)
2591{ 2595{
2592} 2596}
2593 2597
2594static void ipv4_rt_blackhole_redirect(struct dst_entry *dst, struct sk_buff *skb) 2598static void ipv4_rt_blackhole_redirect(struct dst_entry *dst, struct sock *sk,
2599 struct sk_buff *skb)
2595{ 2600{
2596} 2601}
2597 2602
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b8e7e0595407..d9caf5c07aae 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -319,7 +319,7 @@ static void do_redirect(struct sk_buff *skb, struct sock *sk)
319 struct dst_entry *dst = __sk_dst_check(sk, 0); 319 struct dst_entry *dst = __sk_dst_check(sk, 0);
320 320
321 if (dst) 321 if (dst)
322 dst->ops->redirect(dst, skb); 322 dst->ops->redirect(dst, sk, skb);
323} 323}
324 324
325/* 325/*
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 737131cef375..fcf7678bc009 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -194,20 +194,22 @@ static inline int xfrm4_garbage_collect(struct dst_ops *ops)
194 return (dst_entries_get_slow(ops) > ops->gc_thresh * 2); 194 return (dst_entries_get_slow(ops) > ops->gc_thresh * 2);
195} 195}
196 196
197static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu) 197static void xfrm4_update_pmtu(struct dst_entry *dst, struct sock *sk,
198 struct sk_buff *skb, u32 mtu)
198{ 199{
199 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; 200 struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
200 struct dst_entry *path = xdst->route; 201 struct dst_entry *path = xdst->route;
201 202
202 path->ops->update_pmtu(path, mtu); 203 path->ops->update_pmtu(path, sk, skb, mtu);
203} 204}
204 205
205static void xfrm4_redirect(struct dst_entry *dst, struct sk_buff *skb) 206static void xfrm4_redirect(struct dst_entry *dst, struct sock *sk,
207 struct sk_buff *skb)
206{ 208{
207 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; 209 struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
208 struct dst_entry *path = xdst->route; 210 struct dst_entry *path = xdst->route;
209 211
210 path->ops->redirect(path, skb); 212 path->ops->redirect(path, sk, skb);
211} 213}
212 214
213static void xfrm4_dst_destroy(struct dst_entry *dst) 215static void xfrm4_dst_destroy(struct dst_entry *dst)