Commit 9e12bb22 authored by Al Viro's avatar Al Viro Committed by David S. Miller

[IPV4]: ip_route_input() annotations

ip_route_input() takes net-endian source and destination address.
* Annotated as such.
* arguments of its invocations annotated where needed.
* local helpers getting the same values passed to by it (ip_route_input_mc(),
ip_route_input_slow(), ip_handle_martian_source(), ip_mkroute_input(),
ip_mkroute_input_def(), __mkroute_input()) annotated
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 046d0331
...@@ -116,7 +116,7 @@ extern void rt_cache_flush(int how); ...@@ -116,7 +116,7 @@ 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 **, const struct flowi *flp);
extern int ip_route_output_key(struct rtable **, 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_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 unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
extern void ip_rt_send_redirect(struct sk_buff *skb); extern void ip_rt_send_redirect(struct sk_buff *skb);
......
...@@ -710,7 +710,7 @@ static int arp_process(struct sk_buff *skb) ...@@ -710,7 +710,7 @@ static int arp_process(struct sk_buff *skb)
unsigned char *arp_ptr; unsigned char *arp_ptr;
struct rtable *rt; struct rtable *rt;
unsigned char *sha, *tha; unsigned char *sha, *tha;
u32 sip, tip; __be32 sip, tip;
u16 dev_type = dev->type; u16 dev_type = dev->type;
int addr_type; int addr_type;
struct neighbour *n; struct neighbour *n;
......
...@@ -607,7 +607,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) ...@@ -607,7 +607,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
{ {
struct ip_options *opt = &(IPCB(skb)->opt); struct ip_options *opt = &(IPCB(skb)->opt);
int srrspace, srrptr; int srrspace, srrptr;
u32 nexthop; __be32 nexthop;
struct iphdr *iph = skb->nh.iph; struct iphdr *iph = skb->nh.iph;
unsigned char * optptr = skb->nh.raw + opt->srr; unsigned char * optptr = skb->nh.raw + opt->srr;
struct rtable *rt = (struct rtable*)skb->dst; struct rtable *rt = (struct rtable*)skb->dst;
......
...@@ -1596,7 +1596,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) ...@@ -1596,7 +1596,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag)
rt->rt_type = res->type; rt->rt_type = res->type;
} }
static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr, static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev, int our) u8 tos, struct net_device *dev, int our)
{ {
unsigned hash; unsigned hash;
...@@ -1681,8 +1681,8 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr, ...@@ -1681,8 +1681,8 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr,
static void ip_handle_martian_source(struct net_device *dev, static void ip_handle_martian_source(struct net_device *dev,
struct in_device *in_dev, struct in_device *in_dev,
struct sk_buff *skb, struct sk_buff *skb,
u32 daddr, __be32 daddr,
u32 saddr) __be32 saddr)
{ {
RT_CACHE_STAT_INC(in_martian_src); RT_CACHE_STAT_INC(in_martian_src);
#ifdef CONFIG_IP_ROUTE_VERBOSE #ifdef CONFIG_IP_ROUTE_VERBOSE
...@@ -1712,7 +1712,7 @@ static void ip_handle_martian_source(struct net_device *dev, ...@@ -1712,7 +1712,7 @@ static void ip_handle_martian_source(struct net_device *dev,
static inline int __mkroute_input(struct sk_buff *skb, static inline int __mkroute_input(struct sk_buff *skb,
struct fib_result* res, struct fib_result* res,
struct in_device *in_dev, struct in_device *in_dev,
u32 daddr, u32 saddr, u32 tos, __be32 daddr, __be32 saddr, u32 tos,
struct rtable **result) struct rtable **result)
{ {
...@@ -1813,7 +1813,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb, ...@@ -1813,7 +1813,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb,
struct fib_result* res, struct fib_result* res,
const struct flowi *fl, const struct flowi *fl,
struct in_device *in_dev, struct in_device *in_dev,
u32 daddr, u32 saddr, u32 tos) __be32 daddr, __be32 saddr, u32 tos)
{ {
struct rtable* rth = NULL; struct rtable* rth = NULL;
int err; int err;
...@@ -1838,7 +1838,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, ...@@ -1838,7 +1838,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb,
struct fib_result* res, struct fib_result* res,
const struct flowi *fl, const struct flowi *fl,
struct in_device *in_dev, struct in_device *in_dev,
u32 daddr, u32 saddr, u32 tos) __be32 daddr, __be32 saddr, u32 tos)
{ {
#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
struct rtable* rth = NULL, *rtres; struct rtable* rth = NULL, *rtres;
...@@ -1901,7 +1901,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, ...@@ -1901,7 +1901,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb,
* 2. IP spoofing attempts are filtered with 100% of guarantee. * 2. IP spoofing attempts are filtered with 100% of guarantee.
*/ */
static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev) u8 tos, struct net_device *dev)
{ {
struct fib_result res; struct fib_result res;
...@@ -1920,7 +1920,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, ...@@ -1920,7 +1920,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
u32 itag = 0; u32 itag = 0;
struct rtable * rth; struct rtable * rth;
unsigned hash; unsigned hash;
u32 spec_dst; __be32 spec_dst;
int err = -EINVAL; int err = -EINVAL;
int free_res = 0; int free_res = 0;
...@@ -2087,7 +2087,7 @@ out: return err; ...@@ -2087,7 +2087,7 @@ out: return err;
goto e_inval; goto e_inval;
} }
int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr, int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev) u8 tos, struct net_device *dev)
{ {
struct rtable * rth; struct rtable * rth;
...@@ -2740,7 +2740,9 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) ...@@ -2740,7 +2740,9 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
struct rtmsg *rtm; struct rtmsg *rtm;
struct nlattr *tb[RTA_MAX+1]; struct nlattr *tb[RTA_MAX+1];
struct rtable *rt = NULL; struct rtable *rt = NULL;
u32 dst, src, iif; __be32 dst = 0;
__be32 src = 0;
u32 iif;
int err; int err;
struct sk_buff *skb; struct sk_buff *skb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment