]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/net/route.h
ipv4: tcp: dont cache unconfirmed intput dst
[karo-tx-linux.git] / include / net / route.h
index 433fc6c1d4044b8022e08b81b3914259d5ba0f9c..6361f9335774c38123e08fa4f781000e72fa27b4 100644 (file)
@@ -67,10 +67,44 @@ struct rtable {
        /* Miscellaneous cached information */
        __be32                  rt_spec_dst; /* RFC1122 specific destination */
        u32                     rt_peer_genid;
-       struct inet_peer        *peer; /* long-living peer info */
+       unsigned long           _peer; /* long-living peer info */
        struct fib_info         *fi; /* for client ref to shared metrics */
 };
 
+static inline struct inet_peer *rt_peer_ptr(struct rtable *rt)
+{
+       return inetpeer_ptr(rt->_peer);
+}
+
+static inline bool rt_has_peer(struct rtable *rt)
+{
+       return inetpeer_ptr_is_peer(rt->_peer);
+}
+
+static inline void __rt_set_peer(struct rtable *rt, struct inet_peer *peer)
+{
+       __inetpeer_ptr_set_peer(&rt->_peer, peer);
+}
+
+static inline bool rt_set_peer(struct rtable *rt, struct inet_peer *peer)
+{
+       return inetpeer_ptr_set_peer(&rt->_peer, peer);
+}
+
+static inline void rt_init_peer(struct rtable *rt, struct inet_peer_base *base)
+{
+       inetpeer_init_ptr(&rt->_peer, base);
+}
+
+static inline void rt_transfer_peer(struct rtable *rt, struct rtable *ort)
+{
+       rt->_peer = ort->_peer;
+       if (rt_has_peer(ort)) {
+               struct inet_peer *peer = rt_peer_ptr(ort);
+               atomic_inc(&peer->refcnt);
+       }
+}
+
 static inline bool rt_is_input_route(const struct rtable *rt)
 {
        return rt->rt_route_iif != 0;
@@ -130,9 +164,9 @@ static inline struct rtable *ip_route_output(struct net *net, __be32 daddr,
 {
        struct flowi4 fl4 = {
                .flowi4_oif = oif,
+               .flowi4_tos = tos,
                .daddr = daddr,
                .saddr = saddr,
-               .flowi4_tos = tos,
        };
        return ip_route_output_key(net, &fl4);
 }
@@ -167,23 +201,24 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
 }
 
 extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
-                                u8 tos, struct net_device *devin, bool noref);
+                                u8 tos, struct net_device *devin, bool noref, bool nocache);
 
 static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
                                 u8 tos, struct net_device *devin)
 {
-       return ip_route_input_common(skb, dst, src, tos, devin, false);
+       return ip_route_input_common(skb, dst, src, tos, devin, false, false);
 }
 
 static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
-                                      u8 tos, struct net_device *devin)
+                                      u8 tos, struct net_device *devin, bool nocache)
 {
-       return ip_route_input_common(skb, dst, src, tos, devin, true);
+       return ip_route_input_common(skb, dst, src, tos, devin, true, nocache);
 }
 
-extern unsigned short  ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
-                                         unsigned short new_mtu, struct net_device *dev);
-extern void            ip_rt_send_redirect(struct sk_buff *skb);
+extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
+                            int oif, u32 mark, u8 protocol, int flow_flags);
+extern void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu);
+extern void ip_rt_send_redirect(struct sk_buff *skb);
 
 extern unsigned int            inet_addr_type(struct net *net, __be32 addr);
 extern unsigned int            inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr);
@@ -298,11 +333,11 @@ extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create);
 
 static inline struct inet_peer *__rt_get_peer(struct rtable *rt, __be32 daddr, int create)
 {
-       if (rt->peer)
-               return rt->peer;
+       if (rt_has_peer(rt))
+               return rt_peer_ptr(rt);
 
        rt_bind_peer(rt, daddr, create);
-       return rt->peer;
+       return (rt_has_peer(rt) ? rt_peer_ptr(rt) : NULL);
 }
 
 static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr)