A number of VRF patches used 'int' for table id. It should be u32 to be consistent with the rest of the stack. Fixes: 4e3c89920cd3a ("net: Introduce VRF related flags and helpers") 15be405eb2ea9 ("net: Add inet_addr lookup by table") 30bbaa1950055 ("net: Fix up inet_addr_type checks") 021dd3b8a142d ("net: Add routes to the table associated with the device") dc028da54ed35 ("inet: Move VRF table lookup to inlined function") f6d3c19274c74 ("net: FIB tracepoints")
Unified · Split
| @@ -188,7 +188,7 @@ void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk); · 187 unmodified lines | ||
| 188 | 188 | void ip_rt_send_redirect(struct sk_buff *skb); |
| 189 | 189 | |
| 190 | 190 | unsigned int inet_addr_type(struct net *net, __be32 addr); |
| 191 | −unsigned int inet_addr_type_table(struct net *net, __be32 addr, int tb_id); | |
| 191 | +unsigned int inet_addr_type_table(struct net *net, __be32 addr, u32 tb_id); | |
| 192 | 192 | unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, |
| 193 | 193 | __be32 addr); |
| 194 | 194 | unsigned int inet_addr_type_dev_table(struct net *net, |
| @@ -66,9 +66,9 @@ static inline int vrf_master_ifindex(const struct net_device *dev) · 65 unmodified lines | ||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /* called with rcu_read_lock */ |
| 69 | −static inline int vrf_dev_table_rcu(const struct net_device *dev) | |
| 69 | +static inline u32 vrf_dev_table_rcu(const struct net_device *dev) | |
| 70 | 70 | { |
| 71 | − int tb_id = 0; | |
| 71 | + u32 tb_id = 0; | |
| 72 | 72 | |
| 73 | 73 | if (dev) { |
| 74 | 74 | struct net_vrf_dev *vrf_ptr; |
| @@ -80,9 +80,9 @@ static inline int vrf_dev_table_rcu(const struct net_device *dev) · 5 unmodified lines | ||
| 80 | 80 | return tb_id; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | −static inline int vrf_dev_table(const struct net_device *dev) | |
| 83 | +static inline u32 vrf_dev_table(const struct net_device *dev) | |
| 84 | 84 | { |
| 85 | − int tb_id; | |
| 85 | + u32 tb_id; | |
| 86 | 86 | |
| 87 | 87 | rcu_read_lock(); |
| 88 | 88 | tb_id = vrf_dev_table_rcu(dev); |
| @@ -91,10 +91,10 @@ static inline int vrf_dev_table(const struct net_device *dev) · 2 unmodified lines | ||
| 91 | 91 | return tb_id; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | −static inline int vrf_dev_table_ifindex(struct net *net, int ifindex) | |
| 94 | +static inline u32 vrf_dev_table_ifindex(struct net *net, int ifindex) | |
| 95 | 95 | { |
| 96 | 96 | struct net_device *dev; |
| 97 | − int tb_id = 0; | |
| 97 | + u32 tb_id = 0; | |
| 98 | 98 | |
| 99 | 99 | if (!ifindex) |
| 100 | 100 | return 0; |
| @@ -111,9 +111,9 @@ static inline int vrf_dev_table_ifindex(struct net *net, int ifindex) · 10 unmodified lines | ||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /* called with rtnl */ |
| 114 | −static inline int vrf_dev_table_rtnl(const struct net_device *dev) | |
| 114 | +static inline u32 vrf_dev_table_rtnl(const struct net_device *dev) | |
| 115 | 115 | { |
| 116 | − int tb_id = 0; | |
| 116 | + u32 tb_id = 0; | |
| 117 | 117 | |
| 118 | 118 | if (dev) { |
| 119 | 119 | struct net_vrf_dev *vrf_ptr; |
| @@ -149,22 +149,22 @@ static inline int vrf_master_ifindex(const struct net_device *dev) · 29 unmodified lines | ||
| 149 | 149 | return 0; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | −static inline int vrf_dev_table_rcu(const struct net_device *dev) | |
| 152 | +static inline u32 vrf_dev_table_rcu(const struct net_device *dev) | |
| 153 | 153 | { |
| 154 | 154 | return 0; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | −static inline int vrf_dev_table(const struct net_device *dev) | |
| 157 | +static inline u32 vrf_dev_table(const struct net_device *dev) | |
| 158 | 158 | { |
| 159 | 159 | return 0; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | −static inline int vrf_dev_table_ifindex(struct net *net, int ifindex) | |
| 162 | +static inline u32 vrf_dev_table_ifindex(struct net *net, int ifindex) | |
| 163 | 163 | { |
| 164 | 164 | return 0; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | −static inline int vrf_dev_table_rtnl(const struct net_device *dev) | |
| 167 | +static inline u32 vrf_dev_table_rtnl(const struct net_device *dev) | |
| 168 | 168 | { |
| 169 | 169 | return 0; |
| 170 | 170 | } |
| @@ -11,12 +11,12 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | TRACE_EVENT(fib_table_lookup, |
| 13 | 13 | |
| 14 | − TP_PROTO(int tb_id, const struct flowi4 *flp), | |
| 14 | + TP_PROTO(u32 tb_id, const struct flowi4 *flp), | |
| 15 | 15 | |
| 16 | 16 | TP_ARGS(tb_id, flp), |
| 17 | 17 | |
| 18 | 18 | TP_STRUCT__entry( |
| 19 | − __field( int, tb_id ) | |
| 19 | + __field( u32, tb_id ) | |
| 20 | 20 | __field( int, oif ) |
| 21 | 21 | __field( int, iif ) |
| 22 | 22 | __field( __u8, tos ) |
| @@ -43,7 +43,7 @@ TRACE_EVENT(fib_table_lookup, · 20 unmodified lines | ||
| 43 | 43 | *p32 = flp->daddr; |
| 44 | 44 | ), |
| 45 | 45 | |
| 46 | − TP_printk("table %d oif %d iif %d src %pI4 dst %pI4 tos %d scope %d flags %x", | |
| 46 | + TP_printk("table %u oif %d iif %d src %pI4 dst %pI4 tos %d scope %d flags %x", | |
| 47 | 47 | __entry->tb_id, __entry->oif, __entry->iif, |
| 48 | 48 | __entry->src, __entry->dst, __entry->tos, __entry->scope, |
| 49 | 49 | __entry->flags) |
| @@ -428,7 +428,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 427 unmodified lines | ||
| 428 | 428 | struct net *net = sock_net(sk); |
| 429 | 429 | unsigned short snum; |
| 430 | 430 | int chk_addr_ret; |
| 431 | − int tb_id = RT_TABLE_LOCAL; | |
| 431 | + u32 tb_id = RT_TABLE_LOCAL; | |
| 432 | 432 | int err; |
| 433 | 433 | |
| 434 | 434 | /* If the socket has its own bind function then use it. (RAW) */ |
| @@ -213,7 +213,7 @@ void fib_flush_external(struct net *net) · 212 unmodified lines | ||
| 213 | 213 | */ |
| 214 | 214 | static inline unsigned int __inet_dev_addr_type(struct net *net, |
| 215 | 215 | const struct net_device *dev, |
| 216 | − __be32 addr, int tb_id) | |
| 216 | + __be32 addr, u32 tb_id) | |
| 217 | 217 | { |
| 218 | 218 | struct flowi4 fl4 = { .daddr = addr }; |
| 219 | 219 | struct fib_result res; |
| @@ -240,7 +240,7 @@ static inline unsigned int __inet_dev_addr_type(struct net *net, · 20 unmodified lines | ||
| 240 | 240 | return ret; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | −unsigned int inet_addr_type_table(struct net *net, __be32 addr, int tb_id) | |
| 243 | +unsigned int inet_addr_type_table(struct net *net, __be32 addr, u32 tb_id) | |
| 244 | 244 | { |
| 245 | 245 | return __inet_dev_addr_type(net, NULL, addr, tb_id); |
| 246 | 246 | } |
| @@ -255,7 +255,7 @@ EXPORT_SYMBOL(inet_addr_type); · 8 unmodified lines | ||
| 255 | 255 | unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, |
| 256 | 256 | __be32 addr) |
| 257 | 257 | { |
| 258 | − int rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL; | |
| 258 | + u32 rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL; | |
| 259 | 259 | |
| 260 | 260 | return __inet_dev_addr_type(net, dev, addr, rt_table); |
| 261 | 261 | } |
| @@ -268,7 +268,7 @@ unsigned int inet_addr_type_dev_table(struct net *net, · 6 unmodified lines | ||
| 268 | 268 | const struct net_device *dev, |
| 269 | 269 | __be32 addr) |
| 270 | 270 | { |
| 271 | − int rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL; | |
| 271 | + u32 rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL; | |
| 272 | 272 | |
| 273 | 273 | return __inet_dev_addr_type(net, NULL, addr, rt_table); |
| 274 | 274 | } |
| @@ -803,7 +803,7 @@ out: · 528 unmodified lines | ||
| 803 | 803 | static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) |
| 804 | 804 | { |
| 805 | 805 | struct net *net = dev_net(ifa->ifa_dev->dev); |
| 806 | − int tb_id = vrf_dev_table_rtnl(ifa->ifa_dev->dev); | |
| 806 | + u32 tb_id = vrf_dev_table_rtnl(ifa->ifa_dev->dev); | |
| 807 | 807 | struct fib_table *tb; |
| 808 | 808 | struct fib_config cfg = { |
| 809 | 809 | .fc_protocol = RTPROT_KERNEL, |
| @@ -863,7 +863,7 @@ static bool fib_valid_prefsrc(struct fib_config *cfg, __be32 fib_prefsrc) · 862 unmodified lines | ||
| 863 | 863 | { |
| 864 | 864 | if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || |
| 865 | 865 | fib_prefsrc != cfg->fc_dst) { |
| 866 | − int tb_id = cfg->fc_table; | |
| 866 | + u32 tb_id = cfg->fc_table; | |
| 867 | 867 | |
| 868 | 868 | if (tb_id == RT_TABLE_MAIN) |
| 869 | 869 | tb_id = RT_TABLE_LOCAL; |