History

net: Make table id type u32

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")

David Ahern committed 11 years ago

Commit 9b8ff511 parent 63b6c136 files · +23 −23Browse files

Unified · Split

6 files
  1. include/net/route.h +1 −1
  2. include/net/vrf.h +12 −12
  3. include/trace/events/fib.h +3 −3
  4. net/ipv4/af_inet.c +1 −1
  5. net/ipv4/fib_frontend.c +5 −5
  6. net/ipv4/fib_semantics.c +1 −1
include/net/route.h+1−1
@@ -188,7 +188,7 @@ void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk); · 187 unmodified lines
188188 void ip_rt_send_redirect(struct sk_buff *skb);
189189
190190 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);
192192 unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
193193 __be32 addr);
194194 unsigned int inet_addr_type_dev_table(struct net *net,
include/net/vrf.h+12−12
@@ -66,9 +66,9 @@ static inline int vrf_master_ifindex(const struct net_device *dev) · 65 unmodified lines
6666 }
6767
6868 /* 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)
7070 {
71− int tb_id = 0;
71+ u32 tb_id = 0;
7272
7373 if (dev) {
7474 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
8080 return tb_id;
8181 }
8282
83−static inline int vrf_dev_table(const struct net_device *dev)
83+static inline u32 vrf_dev_table(const struct net_device *dev)
8484 {
85− int tb_id;
85+ u32 tb_id;
8686
8787 rcu_read_lock();
8888 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
9191 return tb_id;
9292 }
9393
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)
9595 {
9696 struct net_device *dev;
97− int tb_id = 0;
97+ u32 tb_id = 0;
9898
9999 if (!ifindex)
100100 return 0;
@@ -111,9 +111,9 @@ static inline int vrf_dev_table_ifindex(struct net *net, int ifindex) · 10 unmodified lines
111111 }
112112
113113 /* 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)
115115 {
116− int tb_id = 0;
116+ u32 tb_id = 0;
117117
118118 if (dev) {
119119 struct net_vrf_dev *vrf_ptr;
@@ -149,22 +149,22 @@ static inline int vrf_master_ifindex(const struct net_device *dev) · 29 unmodified lines
149149 return 0;
150150 }
151151
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)
153153 {
154154 return 0;
155155 }
156156
157−static inline int vrf_dev_table(const struct net_device *dev)
157+static inline u32 vrf_dev_table(const struct net_device *dev)
158158 {
159159 return 0;
160160 }
161161
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)
163163 {
164164 return 0;
165165 }
166166
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)
168168 {
169169 return 0;
170170 }
include/trace/events/fib.h+3−3
@@ -11,12 +11,12 @@ · 10 unmodified lines
1111
1212 TRACE_EVENT(fib_table_lookup,
1313
14− TP_PROTO(int tb_id, const struct flowi4 *flp),
14+ TP_PROTO(u32 tb_id, const struct flowi4 *flp),
1515
1616 TP_ARGS(tb_id, flp),
1717
1818 TP_STRUCT__entry(
19− __field( int, tb_id )
19+ __field( u32, tb_id )
2020 __field( int, oif )
2121 __field( int, iif )
2222 __field( __u8, tos )
@@ -43,7 +43,7 @@ TRACE_EVENT(fib_table_lookup, · 20 unmodified lines
4343 *p32 = flp->daddr;
4444 ),
4545
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",
4747 __entry->tb_id, __entry->oif, __entry->iif,
4848 __entry->src, __entry->dst, __entry->tos, __entry->scope,
4949 __entry->flags)
net/ipv4/af_inet.c+1−1
@@ -428,7 +428,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 427 unmodified lines
428428 struct net *net = sock_net(sk);
429429 unsigned short snum;
430430 int chk_addr_ret;
431− int tb_id = RT_TABLE_LOCAL;
431+ u32 tb_id = RT_TABLE_LOCAL;
432432 int err;
433433
434434 /* If the socket has its own bind function then use it. (RAW) */
net/ipv4/fib_frontend.c+5−5
@@ -213,7 +213,7 @@ void fib_flush_external(struct net *net) · 212 unmodified lines
213213 */
214214 static inline unsigned int __inet_dev_addr_type(struct net *net,
215215 const struct net_device *dev,
216− __be32 addr, int tb_id)
216+ __be32 addr, u32 tb_id)
217217 {
218218 struct flowi4 fl4 = { .daddr = addr };
219219 struct fib_result res;
@@ -240,7 +240,7 @@ static inline unsigned int __inet_dev_addr_type(struct net *net, · 20 unmodified lines
240240 return ret;
241241 }
242242
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)
244244 {
245245 return __inet_dev_addr_type(net, NULL, addr, tb_id);
246246 }
@@ -255,7 +255,7 @@ EXPORT_SYMBOL(inet_addr_type); · 8 unmodified lines
255255 unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
256256 __be32 addr)
257257 {
258− int rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL;
258+ u32 rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL;
259259
260260 return __inet_dev_addr_type(net, dev, addr, rt_table);
261261 }
@@ -268,7 +268,7 @@ unsigned int inet_addr_type_dev_table(struct net *net, · 6 unmodified lines
268268 const struct net_device *dev,
269269 __be32 addr)
270270 {
271− int rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL;
271+ u32 rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL;
272272
273273 return __inet_dev_addr_type(net, NULL, addr, rt_table);
274274 }
@@ -803,7 +803,7 @@ out: · 528 unmodified lines
803803 static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa)
804804 {
805805 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);
807807 struct fib_table *tb;
808808 struct fib_config cfg = {
809809 .fc_protocol = RTPROT_KERNEL,
net/ipv4/fib_semantics.c+1−1
@@ -863,7 +863,7 @@ static bool fib_valid_prefsrc(struct fib_config *cfg, __be32 fib_prefsrc) · 862 unmodified lines
863863 {
864864 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
865865 fib_prefsrc != cfg->fc_dst) {
866− int tb_id = cfg->fc_table;
866+ u32 tb_id = cfg->fc_table;
867867
868868 if (tb_id == RT_TABLE_MAIN)
869869 tb_id = RT_TABLE_LOCAL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t