32 #include <linux/rtnetlink.h>
39 #define RTO_ONLINK 0x01
41 #define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE))
65 static inline bool rt_is_input_route(
const struct rtable *rt)
70 static inline bool rt_is_output_route(
const struct rtable *rt)
133 return ip_route_output_key(net, &fl4);
136 static inline struct rtable *ip_route_output_ports(
struct net *
net,
struct flowi4 *fl4,
142 flowi4_init_output(fl4, oif, sk ? sk->
sk_mark : 0, tos,
144 sk ? inet_sk_flowi_flags(sk) : 0,
145 daddr, saddr, dport, sport);
147 security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
151 static inline struct rtable *ip_route_output_gre(
struct net *net,
struct flowi4 *fl4,
155 memset(fl4, 0,
sizeof(*fl4));
156 fl4->flowi4_oif = oif;
159 fl4->flowi4_tos = tos;
161 fl4->fl4_gre_key = gre_key;
162 return ip_route_output_key(net, fl4);
199 extern void fib_del_ifaddr(
struct in_ifaddr *,
struct in_ifaddr *);
201 static inline void ip_rt_put(
struct rtable * rt)
207 #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
211 static inline char rt_tos2priority(
u8 tos)
243 struct sock *sk,
bool can_sleep)
247 if (inet_sk(sk)->transparent)
253 protocol, flow_flags, dst, src, dport, sport);
256 static inline struct rtable *ip_route_connect(
struct flowi4 *fl4,
258 int oif,
u8 protocol,
260 struct sock *sk,
bool can_sleep)
262 struct net *net = sock_net(sk);
265 ip_route_connect_init(fl4, dst, src, tos, oif, protocol,
266 sport, dport, sk, can_sleep);
273 flowi4_update_output(fl4, oif, tos, fl4->
daddr, fl4->
saddr);
275 security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
284 if (sport != orig_sport || dport != orig_dport) {
285 fl4->fl4_dport = dport;
286 fl4->fl4_sport = sport;
288 flowi4_update_output(fl4, sk->sk_bound_dev_if,
291 security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
297 static inline int inet_iif(
const struct sk_buff *skb)
299 int iif = skb_rtable(skb)->rt_iif;
308 static inline int ip4_dst_hoplimit(
const struct dst_entry *dst)
313 hoplimit = sysctl_ip_default_ttl;