aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/route.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/route.h')
-rw-r--r--include/net/route.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/net/route.h b/include/net/route.h
index 9257f5f17337..f140f4130fea 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -132,6 +132,54 @@ static inline struct rtable *ip_route_output_key(struct net *net, struct flowi *
132 return ip_route_output_flow(net, flp, NULL); 132 return ip_route_output_flow(net, flp, NULL);
133} 133}
134 134
135static inline struct rtable *ip_route_output(struct net *net, __be32 daddr,
136 __be32 saddr, u8 tos, int oif)
137{
138 struct flowi fl = {
139 .oif = oif,
140 .fl4_dst = daddr,
141 .fl4_src = saddr,
142 .fl4_tos = tos,
143 };
144 return ip_route_output_key(net, &fl);
145}
146
147static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk,
148 __be32 daddr, __be32 saddr,
149 __be16 dport, __be16 sport,
150 __u8 proto, __u8 tos, int oif)
151{
152 struct flowi fl = {
153 .oif = oif,
154 .flags = sk ? inet_sk_flowi_flags(sk) : 0,
155 .mark = sk ? sk->sk_mark : 0,
156 .fl4_dst = daddr,
157 .fl4_src = saddr,
158 .fl4_tos = tos,
159 .proto = proto,
160 .fl_ip_dport = dport,
161 .fl_ip_sport = sport,
162 };
163 if (sk)
164 security_sk_classify_flow(sk, &fl);
165 return ip_route_output_flow(net, &fl, sk);
166}
167
168static inline struct rtable *ip_route_output_gre(struct net *net,
169 __be32 daddr, __be32 saddr,
170 __be32 gre_key, __u8 tos, int oif)
171{
172 struct flowi fl = {
173 .oif = oif,
174 .fl4_dst = daddr,
175 .fl4_src = saddr,
176 .fl4_tos = tos,
177 .proto = IPPROTO_GRE,
178 .fl_gre_key = gre_key,
179 };
180 return ip_route_output_key(net, &fl);
181}
182
135extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, 183extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
136 u8 tos, struct net_device *devin, bool noref); 184 u8 tos, struct net_device *devin, bool noref);
137 185