Commit 81f7bf6c authored by Al Viro's avatar Al Viro Committed by David S. Miller

[IPV4]: net/ipv4/fib annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 114c7844
...@@ -230,7 +230,7 @@ struct rtentry; ...@@ -230,7 +230,7 @@ struct rtentry;
/* Exported by fib_semantics.c */ /* Exported by fib_semantics.c */
extern int ip_fib_check_default(__be32 gw, struct net_device *dev); extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
extern int fib_sync_down(u32 local, struct net_device *dev, int force); extern int fib_sync_down(__be32 local, struct net_device *dev, int force);
extern int fib_sync_up(struct net_device *dev); extern int fib_sync_up(struct net_device *dev);
extern __be32 __fib_res_prefsrc(struct fib_result *res); extern __be32 __fib_res_prefsrc(struct fib_result *res);
......
...@@ -253,7 +253,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, ...@@ -253,7 +253,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
#ifndef CONFIG_IP_NOSIOCRT #ifndef CONFIG_IP_NOSIOCRT
static inline u32 sk_extract_addr(struct sockaddr *addr) static inline __be32 sk_extract_addr(struct sockaddr *addr)
{ {
return ((struct sockaddr_in *) addr)->sin_addr.s_addr; return ((struct sockaddr_in *) addr)->sin_addr.s_addr;
} }
...@@ -292,7 +292,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, ...@@ -292,7 +292,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt,
plen = 32; plen = 32;
addr = sk_extract_addr(&rt->rt_dst); addr = sk_extract_addr(&rt->rt_dst);
if (!(rt->rt_flags & RTF_HOST)) { if (!(rt->rt_flags & RTF_HOST)) {
u32 mask = sk_extract_addr(&rt->rt_genmask); __be32 mask = sk_extract_addr(&rt->rt_genmask);
if (rt->rt_genmask.sa_family != AF_INET) { if (rt->rt_genmask.sa_family != AF_INET) {
if (mask || rt->rt_genmask.sa_family) if (mask || rt->rt_genmask.sa_family)
...@@ -627,8 +627,7 @@ int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -627,8 +627,7 @@ int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
only when netlink is already locked. only when netlink is already locked.
*/ */
static void fib_magic(int cmd, int type, u32 dst, int dst_len, static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa)
struct in_ifaddr *ifa)
{ {
struct fib_table *tb; struct fib_table *tb;
struct fib_config cfg = { struct fib_config cfg = {
......
...@@ -26,10 +26,10 @@ extern void fib_release_info(struct fib_info *); ...@@ -26,10 +26,10 @@ extern void fib_release_info(struct fib_info *);
extern struct fib_info *fib_create_info(struct fib_config *cfg); extern struct fib_info *fib_create_info(struct fib_config *cfg);
extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi); extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi);
extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
u32 tb_id, u8 type, u8 scope, u32 dst, u32 tb_id, u8 type, u8 scope, __be32 dst,
int dst_len, u8 tos, struct fib_info *fi, int dst_len, u8 tos, struct fib_info *fi,
unsigned int); unsigned int);
extern void rtmsg_fib(int event, u32 key, struct fib_alias *fa, extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
int dst_len, u32 tb_id, struct nl_info *info); int dst_len, u32 tb_id, struct nl_info *info);
extern struct fib_alias *fib_find_alias(struct list_head *fah, extern struct fib_alias *fib_find_alias(struct list_head *fah,
u8 tos, u32 prio); u8 tos, u32 prio);
......
...@@ -40,10 +40,10 @@ struct fib4_rule ...@@ -40,10 +40,10 @@ struct fib4_rule
u8 dst_len; u8 dst_len;
u8 src_len; u8 src_len;
u8 tos; u8 tos;
u32 src; __be32 src;
u32 srcmask; __be32 srcmask;
u32 dst; __be32 dst;
u32 dstmask; __be32 dstmask;
#ifdef CONFIG_IP_ROUTE_FWMARK #ifdef CONFIG_IP_ROUTE_FWMARK
u32 fwmark; u32 fwmark;
u32 fwmask; u32 fwmask;
...@@ -150,8 +150,8 @@ void fib_select_default(const struct flowi *flp, struct fib_result *res) ...@@ -150,8 +150,8 @@ void fib_select_default(const struct flowi *flp, struct fib_result *res)
static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
{ {
struct fib4_rule *r = (struct fib4_rule *) rule; struct fib4_rule *r = (struct fib4_rule *) rule;
u32 daddr = fl->fl4_dst; __be32 daddr = fl->fl4_dst;
u32 saddr = fl->fl4_src; __be32 saddr = fl->fl4_src;
if (((saddr ^ r->src) & r->srcmask) || if (((saddr ^ r->src) & r->srcmask) ||
((daddr ^ r->dst) & r->dstmask)) ((daddr ^ r->dst) & r->dstmask))
......
...@@ -203,7 +203,7 @@ static inline unsigned int fib_info_hashfn(const struct fib_info *fi) ...@@ -203,7 +203,7 @@ static inline unsigned int fib_info_hashfn(const struct fib_info *fi)
unsigned int val = fi->fib_nhs; unsigned int val = fi->fib_nhs;
val ^= fi->fib_protocol; val ^= fi->fib_protocol;
val ^= fi->fib_prefsrc; val ^= (__force u32)fi->fib_prefsrc;
val ^= fi->fib_priority; val ^= fi->fib_priority;
return (val ^ (val >> 7) ^ (val >> 12)) & mask; return (val ^ (val >> 7) ^ (val >> 12)) & mask;
...@@ -273,7 +273,7 @@ int ip_fib_check_default(__be32 gw, struct net_device *dev) ...@@ -273,7 +273,7 @@ int ip_fib_check_default(__be32 gw, struct net_device *dev)
return -1; return -1;
} }
void rtmsg_fib(int event, u32 key, struct fib_alias *fa, void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
int dst_len, u32 tb_id, struct nl_info *info) int dst_len, u32 tb_id, struct nl_info *info)
{ {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -568,11 +568,11 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, ...@@ -568,11 +568,11 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
return 0; return 0;
} }
static inline unsigned int fib_laddr_hashfn(u32 val) static inline unsigned int fib_laddr_hashfn(__be32 val)
{ {
unsigned int mask = (fib_hash_size - 1); unsigned int mask = (fib_hash_size - 1);
return (val ^ (val >> 7) ^ (val >> 14)) & mask; return ((__force u32)val ^ ((__force u32)val >> 7) ^ ((__force u32)val >> 14)) & mask;
} }
static struct hlist_head *fib_hash_alloc(int bytes) static struct hlist_head *fib_hash_alloc(int bytes)
...@@ -928,7 +928,7 @@ __be32 __fib_res_prefsrc(struct fib_result *res) ...@@ -928,7 +928,7 @@ __be32 __fib_res_prefsrc(struct fib_result *res)
} }
int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
u32 tb_id, u8 type, u8 scope, u32 dst, int dst_len, u8 tos, u32 tb_id, u8 type, u8 scope, __be32 dst, int dst_len, u8 tos,
struct fib_info *fi, unsigned int flags) struct fib_info *fi, unsigned int flags)
{ {
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
...@@ -1017,7 +1017,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, ...@@ -1017,7 +1017,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
- device went down -> we must shutdown all nexthops going via it. - device went down -> we must shutdown all nexthops going via it.
*/ */
int fib_sync_down(u32 local, struct net_device *dev, int force) int fib_sync_down(__be32 local, struct net_device *dev, int force)
{ {
int ret = 0; int ret = 0;
int scope = RT_SCOPE_NOWHERE; int scope = RT_SCOPE_NOWHERE;
......
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