X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fnet%2Froute.h;h=2ae3c9093d9e018d7d6480cb0ffb7a848ae154b7;hb=refs%2Fheads%2Fvserver;hp=189c100b200208a547cbea1df2ea5804353de837;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/include/net/route.h b/include/net/route.h index 189c100b2..2ae3c9093 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -7,7 +7,7 @@ * * Version: @(#)route.h 1.0.4 05/27/93 * - * Authors: Ross Biro, + * Authors: Ross Biro * Fred N. van Kempen, * Fixes: * Alan Cox : Reformatted. Added ip_rt_local() @@ -24,17 +24,19 @@ #ifndef _ROUTE_H #define _ROUTE_H -#include #include #include #include +#include #include #include #include #include #include -#include +#include +#include #include +#include #ifndef __KERNEL__ #warning This file is not supposed to be used outside of kernel. @@ -46,8 +48,9 @@ /* RTO_CONN is not used (being alias for 0), but preserved not to break * some modules referring to it. */ -#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sk->sk_localroute) +#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) +struct fib_nh; struct inet_peer; struct rtable { @@ -60,20 +63,21 @@ struct rtable struct in_device *idev; unsigned rt_flags; - unsigned rt_type; + __u16 rt_type; + __u16 rt_multipath_alg; - __u32 rt_dst; /* Path destination */ - __u32 rt_src; /* Path source */ + __be32 rt_dst; /* Path destination */ + __be32 rt_src; /* Path source */ int rt_iif; /* Info on neighbour */ - __u32 rt_gateway; + __be32 rt_gateway; /* Cache lookup keys */ struct flowi fl; /* Miscellaneous cached information */ - __u32 rt_spec_dst; /* RFC1122 specific destination */ + __be32 rt_spec_dst; /* RFC1122 specific destination */ struct inet_peer *peer; /* long-living peer info */ }; @@ -105,31 +109,30 @@ struct rt_cache_stat unsigned int out_hlist_search; }; -extern struct rt_cache_stat *rt_cache_stat; -#define RT_CACHE_STAT_INC(field) \ - (per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++) - extern struct ip_rt_acct *ip_rt_acct; struct in_device; extern int ip_rt_init(void); -extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, - u32 src, u8 tos, struct net_device *dev); +extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, + __be32 src, struct net_device *dev); extern void ip_rt_advice(struct rtable **rp, int advice); extern void rt_cache_flush(int how); extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); extern int ip_route_output_key(struct rtable **, struct flowi *flp); extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); -extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin); +extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); extern void ip_rt_send_redirect(struct sk_buff *skb); -extern unsigned inet_addr_type(u32 addr); +extern unsigned inet_addr_type(__be32 addr); extern void ip_rt_multicast_event(struct in_device *); extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); extern void ip_rt_get_source(u8 *src, struct rtable *rt); extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); +struct in_ifaddr; +extern void fib_add_ifaddr(struct in_ifaddr *); + static inline void ip_rt_put(struct rtable * rt) { if (rt) @@ -145,7 +148,7 @@ static inline char rt_tos2priority(u8 tos) return ip_tos2prio[IPTOS_TOS(tos)>>1]; } -#define IPI_LOOPBACK 0x0100007f +#define IPI_LOOPBACK htonl(INADDR_LOOPBACK) static inline int ip_find_src(struct nx_info *nxi, struct rtable **rp, struct flowi *fl) { @@ -198,9 +201,9 @@ static inline int ip_find_src(struct nx_info *nxi, struct rtable **rp, struct fl return 0; } -static inline int ip_route_connect(struct rtable **rp, u32 dst, - u32 src, u32 tos, int oif, u8 protocol, - u16 sport, u16 dport, struct sock *sk) +static inline int ip_route_connect(struct rtable **rp, __be32 dst, + __be32 src, u32 tos, int oif, u8 protocol, + __be16 sport, __be16 dport, struct sock *sk) { struct flowi fl = { .oif = oif, .nl_u = { .ip4_u = { .daddr = dst, @@ -225,8 +228,12 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, err = ip_find_src(nx_info, rp, &fl); if (err) return err; - if (fl.fl4_dst == IPI_LOOPBACK && !vx_check(0, VX_ADMIN)) + if (fl.fl4_dst == IPI_LOOPBACK && !nx_check(0, VS_ADMIN)) fl.fl4_dst = nx_info->ipv4[0]; +#ifdef CONFIG_VSERVER_REMAP_SADDR + if (fl.fl4_src == IPI_LOOPBACK && !nx_check(0, VS_ADMIN)) + fl.fl4_src = nx_info->ipv4[0]; +#endif } if (!fl.fl4_dst || !fl.fl4_src) { err = __ip_route_output_key(rp, &fl); @@ -237,11 +244,12 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, ip_rt_put(*rp); *rp = NULL; } + security_sk_classify_flow(sk, &fl); return ip_route_output_flow(rp, &fl, sk, 0); } -static inline int ip_route_newports(struct rtable **rp, u16 sport, u16 dport, - struct sock *sk) +static inline int ip_route_newports(struct rtable **rp, u8 protocol, + __be16 sport, __be16 dport, struct sock *sk) { if (sport != (*rp)->fl.fl_ip_sport || dport != (*rp)->fl.fl_ip_dport) { @@ -250,8 +258,10 @@ static inline int ip_route_newports(struct rtable **rp, u16 sport, u16 dport, memcpy(&fl, &(*rp)->fl, sizeof(fl)); fl.fl_ip_sport = sport; fl.fl_ip_dport = dport; + fl.proto = protocol; ip_rt_put(*rp); *rp = NULL; + security_sk_classify_flow(sk, &fl); return ip_route_output_flow(rp, &fl, sk, 0); } return 0; @@ -268,4 +278,6 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt) return rt->peer; } +extern ctl_table ipv4_route_table[]; + #endif /* _ROUTE_H */