aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-05-18 14:57:34 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-19 01:08:16 -0400
commita50feda546ac03415707a9bbcac8d6b20714db21 (patch)
tree3c1f5d64399e713c97545ca39984d4d2efe6ca5d /net
parent32e9072b92a1c556a303d8d0e0d64feb667e601d (diff)
ipv6: bool/const conversions phase2
Mostly bool conversions, some inline removals and const additions. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/addrlabel.c24
-rw-r--r--net/ipv6/ah6.c6
-rw-r--r--net/ipv6/anycast.c12
-rw-r--r--net/ipv6/datagram.c4
-rw-r--r--net/ipv6/exthdrs.c54
-rw-r--r--net/ipv6/exthdrs_core.c2
-rw-r--r--net/ipv6/icmp.c14
-rw-r--r--net/ipv6/ip6_flowlabel.c24
-rw-r--r--net/ipv6/ip6_input.c9
-rw-r--r--net/ipv6/mcast.c66
-rw-r--r--net/ipv6/ndisc.c4
-rw-r--r--net/ipv6/raw.c10
-rw-r--r--net/ipv6/route.c8
13 files changed, 119 insertions, 118 deletions
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index 95aea16b8b6f..eb6a63632d3c 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -129,7 +129,7 @@ static void ip6addrlbl_free_rcu(struct rcu_head *h)
129 ip6addrlbl_free(container_of(h, struct ip6addrlbl_entry, rcu)); 129 ip6addrlbl_free(container_of(h, struct ip6addrlbl_entry, rcu));
130} 130}
131 131
132static inline int ip6addrlbl_hold(struct ip6addrlbl_entry *p) 132static bool ip6addrlbl_hold(struct ip6addrlbl_entry *p)
133{ 133{
134 return atomic_inc_not_zero(&p->refcnt); 134 return atomic_inc_not_zero(&p->refcnt);
135} 135}
@@ -141,20 +141,20 @@ static inline void ip6addrlbl_put(struct ip6addrlbl_entry *p)
141} 141}
142 142
143/* Find label */ 143/* Find label */
144static int __ip6addrlbl_match(struct net *net, 144static bool __ip6addrlbl_match(struct net *net,
145 struct ip6addrlbl_entry *p, 145 const struct ip6addrlbl_entry *p,
146 const struct in6_addr *addr, 146 const struct in6_addr *addr,
147 int addrtype, int ifindex) 147 int addrtype, int ifindex)
148{ 148{
149 if (!net_eq(ip6addrlbl_net(p), net)) 149 if (!net_eq(ip6addrlbl_net(p), net))
150 return 0; 150 return false;
151 if (p->ifindex && p->ifindex != ifindex) 151 if (p->ifindex && p->ifindex != ifindex)
152 return 0; 152 return false;
153 if (p->addrtype && p->addrtype != addrtype) 153 if (p->addrtype && p->addrtype != addrtype)
154 return 0; 154 return false;
155 if (!ipv6_prefix_equal(addr, &p->prefix, p->prefixlen)) 155 if (!ipv6_prefix_equal(addr, &p->prefix, p->prefixlen))
156 return 0; 156 return false;
157 return 1; 157 return true;
158} 158}
159 159
160static struct ip6addrlbl_entry *__ipv6_addr_label(struct net *net, 160static struct ip6addrlbl_entry *__ipv6_addr_label(struct net *net,
@@ -456,8 +456,8 @@ static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh,
456 return err; 456 return err;
457} 457}
458 458
459static inline void ip6addrlbl_putmsg(struct nlmsghdr *nlh, 459static void ip6addrlbl_putmsg(struct nlmsghdr *nlh,
460 int prefixlen, int ifindex, u32 lseq) 460 int prefixlen, int ifindex, u32 lseq)
461{ 461{
462 struct ifaddrlblmsg *ifal = nlmsg_data(nlh); 462 struct ifaddrlblmsg *ifal = nlmsg_data(nlh);
463 ifal->ifal_family = AF_INET6; 463 ifal->ifal_family = AF_INET6;
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 5d32e7a93b26..f1a4a2c28ed3 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -113,7 +113,7 @@ static inline struct scatterlist *ah_req_sg(struct crypto_ahash *ahash,
113 __alignof__(struct scatterlist)); 113 __alignof__(struct scatterlist));
114} 114}
115 115
116static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr) 116static bool zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr)
117{ 117{
118 u8 *opt = (u8 *)opthdr; 118 u8 *opt = (u8 *)opthdr;
119 int len = ipv6_optlen(opthdr); 119 int len = ipv6_optlen(opthdr);
@@ -145,10 +145,10 @@ static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr)
145 len -= optlen; 145 len -= optlen;
146 } 146 }
147 if (len == 0) 147 if (len == 0)
148 return 1; 148 return true;
149 149
150bad: 150bad:
151 return 0; 151 return false;
152} 152}
153 153
154#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 154#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index db00d27ffb16..cdf02be5f191 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -342,7 +342,7 @@ static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr)
342 * check if the interface has this anycast address 342 * check if the interface has this anycast address
343 * called with rcu_read_lock() 343 * called with rcu_read_lock()
344 */ 344 */
345static int ipv6_chk_acast_dev(struct net_device *dev, const struct in6_addr *addr) 345static bool ipv6_chk_acast_dev(struct net_device *dev, const struct in6_addr *addr)
346{ 346{
347 struct inet6_dev *idev; 347 struct inet6_dev *idev;
348 struct ifacaddr6 *aca; 348 struct ifacaddr6 *aca;
@@ -356,16 +356,16 @@ static int ipv6_chk_acast_dev(struct net_device *dev, const struct in6_addr *add
356 read_unlock_bh(&idev->lock); 356 read_unlock_bh(&idev->lock);
357 return aca != NULL; 357 return aca != NULL;
358 } 358 }
359 return 0; 359 return false;
360} 360}
361 361
362/* 362/*
363 * check if given interface (or any, if dev==0) has this anycast address 363 * check if given interface (or any, if dev==0) has this anycast address
364 */ 364 */
365int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, 365bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
366 const struct in6_addr *addr) 366 const struct in6_addr *addr)
367{ 367{
368 int found = 0; 368 bool found = false;
369 369
370 rcu_read_lock(); 370 rcu_read_lock();
371 if (dev) 371 if (dev)
@@ -373,7 +373,7 @@ int ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
373 else 373 else
374 for_each_netdev_rcu(net, dev) 374 for_each_netdev_rcu(net, dev)
375 if (ipv6_chk_acast_dev(dev, addr)) { 375 if (ipv6_chk_acast_dev(dev, addr)) {
376 found = 1; 376 found = true;
377 break; 377 break;
378 } 378 }
379 rcu_read_unlock(); 379 rcu_read_unlock();
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index b8b61ac88bc2..be2b67d631e5 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -34,9 +34,9 @@
34#include <linux/errqueue.h> 34#include <linux/errqueue.h>
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36 36
37static inline int ipv6_mapped_addr_any(const struct in6_addr *a) 37static bool ipv6_mapped_addr_any(const struct in6_addr *a)
38{ 38{
39 return (ipv6_addr_v4mapped(a) && (a->s6_addr32[3] == 0)); 39 return ipv6_addr_v4mapped(a) && (a->s6_addr32[3] == 0);
40} 40}
41 41
42int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) 42int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index a3cded6a1997..50ec95f9aeeb 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -96,14 +96,14 @@ EXPORT_SYMBOL_GPL(ipv6_find_tlv);
96/* 96/*
97 * Parsing tlv encoded headers. 97 * Parsing tlv encoded headers.
98 * 98 *
99 * Parsing function "func" returns 1, if parsing succeed 99 * Parsing function "func" returns true, if parsing succeed
100 * and 0, if it failed. 100 * and false, if it failed.
101 * It MUST NOT touch skb->h. 101 * It MUST NOT touch skb->h.
102 */ 102 */
103 103
104struct tlvtype_proc { 104struct tlvtype_proc {
105 int type; 105 int type;
106 int (*func)(struct sk_buff *skb, int offset); 106 bool (*func)(struct sk_buff *skb, int offset);
107}; 107};
108 108
109/********************* 109/*********************
@@ -112,11 +112,11 @@ struct tlvtype_proc {
112 112
113/* An unknown option is detected, decide what to do */ 113/* An unknown option is detected, decide what to do */
114 114
115static int ip6_tlvopt_unknown(struct sk_buff *skb, int optoff) 115static bool ip6_tlvopt_unknown(struct sk_buff *skb, int optoff)
116{ 116{
117 switch ((skb_network_header(skb)[optoff] & 0xC0) >> 6) { 117 switch ((skb_network_header(skb)[optoff] & 0xC0) >> 6) {
118 case 0: /* ignore */ 118 case 0: /* ignore */
119 return 1; 119 return true;
120 120
121 case 1: /* drop packet */ 121 case 1: /* drop packet */
122 break; 122 break;
@@ -129,18 +129,18 @@ static int ip6_tlvopt_unknown(struct sk_buff *skb, int optoff)
129 break; 129 break;
130 case 2: /* send ICMP PARM PROB regardless and drop packet */ 130 case 2: /* send ICMP PARM PROB regardless and drop packet */
131 icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff); 131 icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
132 return 0; 132 return false;
133 } 133 }
134 134
135 kfree_skb(skb); 135 kfree_skb(skb);
136 return 0; 136 return false;
137} 137}
138 138
139/* Parse tlv encoded option header (hop-by-hop or destination) */ 139/* Parse tlv encoded option header (hop-by-hop or destination) */
140 140
141static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff *skb) 141static bool ip6_parse_tlv(const struct tlvtype_proc *procs, struct sk_buff *skb)
142{ 142{
143 struct tlvtype_proc *curr; 143 const struct tlvtype_proc *curr;
144 const unsigned char *nh = skb_network_header(skb); 144 const unsigned char *nh = skb_network_header(skb);
145 int off = skb_network_header_len(skb); 145 int off = skb_network_header_len(skb);
146 int len = (skb_transport_header(skb)[1] + 1) << 3; 146 int len = (skb_transport_header(skb)[1] + 1) << 3;
@@ -186,14 +186,14 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff *skb)
186 /* type specific length/alignment 186 /* type specific length/alignment
187 checks will be performed in the 187 checks will be performed in the
188 func(). */ 188 func(). */
189 if (curr->func(skb, off) == 0) 189 if (curr->func(skb, off) == false)
190 return 0; 190 return false;
191 break; 191 break;
192 } 192 }
193 } 193 }
194 if (curr->type < 0) { 194 if (curr->type < 0) {
195 if (ip6_tlvopt_unknown(skb, off) == 0) 195 if (ip6_tlvopt_unknown(skb, off) == 0)
196 return 0; 196 return false;
197 } 197 }
198 break; 198 break;
199 } 199 }
@@ -201,10 +201,10 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff *skb)
201 len -= optlen; 201 len -= optlen;
202 } 202 }
203 if (len == 0) 203 if (len == 0)
204 return 1; 204 return true;
205bad: 205bad:
206 kfree_skb(skb); 206 kfree_skb(skb);
207 return 0; 207 return false;
208} 208}
209 209
210/***************************** 210/*****************************
@@ -212,7 +212,7 @@ bad:
212 *****************************/ 212 *****************************/
213 213
214#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 214#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
215static int ipv6_dest_hao(struct sk_buff *skb, int optoff) 215static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)
216{ 216{
217 struct ipv6_destopt_hao *hao; 217 struct ipv6_destopt_hao *hao;
218 struct inet6_skb_parm *opt = IP6CB(skb); 218 struct inet6_skb_parm *opt = IP6CB(skb);
@@ -266,15 +266,15 @@ static int ipv6_dest_hao(struct sk_buff *skb, int optoff)
266 if (skb->tstamp.tv64 == 0) 266 if (skb->tstamp.tv64 == 0)
267 __net_timestamp(skb); 267 __net_timestamp(skb);
268 268
269 return 1; 269 return true;
270 270
271 discard: 271 discard:
272 kfree_skb(skb); 272 kfree_skb(skb);
273 return 0; 273 return false;
274} 274}
275#endif 275#endif
276 276
277static struct tlvtype_proc tlvprocdestopt_lst[] = { 277static const struct tlvtype_proc tlvprocdestopt_lst[] = {
278#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 278#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
279 { 279 {
280 .type = IPV6_TLV_HAO, 280 .type = IPV6_TLV_HAO,
@@ -579,23 +579,23 @@ static inline struct net *ipv6_skb_net(struct sk_buff *skb)
579 579
580/* Router Alert as of RFC 2711 */ 580/* Router Alert as of RFC 2711 */
581 581
582static int ipv6_hop_ra(struct sk_buff *skb, int optoff) 582static bool ipv6_hop_ra(struct sk_buff *skb, int optoff)
583{ 583{
584 const unsigned char *nh = skb_network_header(skb); 584 const unsigned char *nh = skb_network_header(skb);
585 585
586 if (nh[optoff + 1] == 2) { 586 if (nh[optoff + 1] == 2) {
587 IP6CB(skb)->ra = optoff; 587 IP6CB(skb)->ra = optoff;
588 return 1; 588 return true;
589 } 589 }
590 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_ra: wrong RA length %d\n", 590 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_ra: wrong RA length %d\n",
591 nh[optoff + 1]); 591 nh[optoff + 1]);
592 kfree_skb(skb); 592 kfree_skb(skb);
593 return 0; 593 return false;
594} 594}
595 595
596/* Jumbo payload */ 596/* Jumbo payload */
597 597
598static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff) 598static bool ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
599{ 599{
600 const unsigned char *nh = skb_network_header(skb); 600 const unsigned char *nh = skb_network_header(skb);
601 struct net *net = ipv6_skb_net(skb); 601 struct net *net = ipv6_skb_net(skb);
@@ -614,13 +614,13 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
614 IP6_INC_STATS_BH(net, ipv6_skb_idev(skb), 614 IP6_INC_STATS_BH(net, ipv6_skb_idev(skb),
615 IPSTATS_MIB_INHDRERRORS); 615 IPSTATS_MIB_INHDRERRORS);
616 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); 616 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
617 return 0; 617 return false;
618 } 618 }
619 if (ipv6_hdr(skb)->payload_len) { 619 if (ipv6_hdr(skb)->payload_len) {
620 IP6_INC_STATS_BH(net, ipv6_skb_idev(skb), 620 IP6_INC_STATS_BH(net, ipv6_skb_idev(skb),
621 IPSTATS_MIB_INHDRERRORS); 621 IPSTATS_MIB_INHDRERRORS);
622 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff); 622 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
623 return 0; 623 return false;
624 } 624 }
625 625
626 if (pkt_len > skb->len - sizeof(struct ipv6hdr)) { 626 if (pkt_len > skb->len - sizeof(struct ipv6hdr)) {
@@ -632,14 +632,14 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
632 if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) 632 if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr)))
633 goto drop; 633 goto drop;
634 634
635 return 1; 635 return true;
636 636
637drop: 637drop:
638 kfree_skb(skb); 638 kfree_skb(skb);
639 return 0; 639 return false;
640} 640}
641 641
642static struct tlvtype_proc tlvprochopopt_lst[] = { 642static const struct tlvtype_proc tlvprochopopt_lst[] = {
643 { 643 {
644 .type = IPV6_TLV_ROUTERALERT, 644 .type = IPV6_TLV_ROUTERALERT,
645 .func = ipv6_hop_ra, 645 .func = ipv6_hop_ra,
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 7b1a884634d5..f73d59a14131 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -9,7 +9,7 @@
9 * find out if nexthdr is a well-known extension header or a protocol 9 * find out if nexthdr is a well-known extension header or a protocol
10 */ 10 */
11 11
12int ipv6_ext_hdr(u8 nexthdr) 12bool ipv6_ext_hdr(u8 nexthdr)
13{ 13{
14 /* 14 /*
15 * find out if nexthdr is an extension header or a protocol 15 * find out if nexthdr is an extension header or a protocol
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 23c56ce9e86b..091a2971c7b7 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -131,7 +131,7 @@ void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos)
131 * --ANK (980726) 131 * --ANK (980726)
132 */ 132 */
133 133
134static int is_ineligible(struct sk_buff *skb) 134static bool is_ineligible(const struct sk_buff *skb)
135{ 135{
136 int ptr = (u8 *)(ipv6_hdr(skb) + 1) - skb->data; 136 int ptr = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
137 int len = skb->len - ptr; 137 int len = skb->len - ptr;
@@ -139,11 +139,11 @@ static int is_ineligible(struct sk_buff *skb)
139 __be16 frag_off; 139 __be16 frag_off;
140 140
141 if (len < 0) 141 if (len < 0)
142 return 1; 142 return true;
143 143
144 ptr = ipv6_skip_exthdr(skb, ptr, &nexthdr, &frag_off); 144 ptr = ipv6_skip_exthdr(skb, ptr, &nexthdr, &frag_off);
145 if (ptr < 0) 145 if (ptr < 0)
146 return 0; 146 return false;
147 if (nexthdr == IPPROTO_ICMPV6) { 147 if (nexthdr == IPPROTO_ICMPV6) {
148 u8 _type, *tp; 148 u8 _type, *tp;
149 tp = skb_header_pointer(skb, 149 tp = skb_header_pointer(skb,
@@ -151,9 +151,9 @@ static int is_ineligible(struct sk_buff *skb)
151 sizeof(_type), &_type); 151 sizeof(_type), &_type);
152 if (tp == NULL || 152 if (tp == NULL ||
153 !(*tp & ICMPV6_INFOMSG_MASK)) 153 !(*tp & ICMPV6_INFOMSG_MASK))
154 return 1; 154 return true;
155 } 155 }
156 return 0; 156 return false;
157} 157}
158 158
159/* 159/*
@@ -208,14 +208,14 @@ static inline bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
208 * highest-order two bits set to 10 208 * highest-order two bits set to 10
209 */ 209 */
210 210
211static __inline__ int opt_unrec(struct sk_buff *skb, __u32 offset) 211static bool opt_unrec(struct sk_buff *skb, __u32 offset)
212{ 212{
213 u8 _optval, *op; 213 u8 _optval, *op;
214 214
215 offset += skb_network_offset(skb); 215 offset += skb_network_offset(skb);
216 op = skb_header_pointer(skb, offset, sizeof(_optval), &_optval); 216 op = skb_header_pointer(skb, offset, sizeof(_optval), &_optval);
217 if (op == NULL) 217 if (op == NULL)
218 return 1; 218 return true;
219 return (*op & 0xC0) == 0x80; 219 return (*op & 0xC0) == 0x80;
220} 220}
221 221
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index cb43df690210..9772fbd8a3f5 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -433,32 +433,32 @@ static int mem_check(struct sock *sk)
433 return 0; 433 return 0;
434} 434}
435 435
436static int ipv6_hdr_cmp(struct ipv6_opt_hdr *h1, struct ipv6_opt_hdr *h2) 436static bool ipv6_hdr_cmp(struct ipv6_opt_hdr *h1, struct ipv6_opt_hdr *h2)
437{ 437{
438 if (h1 == h2) 438 if (h1 == h2)
439 return 0; 439 return false;
440 if (h1 == NULL || h2 == NULL) 440 if (h1 == NULL || h2 == NULL)
441 return 1; 441 return true;
442 if (h1->hdrlen != h2->hdrlen) 442 if (h1->hdrlen != h2->hdrlen)
443 return 1; 443 return true;
444 return memcmp(h1+1, h2+1, ((h1->hdrlen+1)<<3) - sizeof(*h1)); 444 return memcmp(h1+1, h2+1, ((h1->hdrlen+1)<<3) - sizeof(*h1));
445} 445}
446 446
447static int ipv6_opt_cmp(struct ipv6_txoptions *o1, struct ipv6_txoptions *o2) 447static bool ipv6_opt_cmp(struct ipv6_txoptions *o1, struct ipv6_txoptions *o2)
448{ 448{
449 if (o1 == o2) 449 if (o1 == o2)
450 return 0; 450 return false;
451 if (o1 == NULL || o2 == NULL) 451 if (o1 == NULL || o2 == NULL)
452 return 1; 452 return true;
453 if (o1->opt_nflen != o2->opt_nflen) 453 if (o1->opt_nflen != o2->opt_nflen)
454 return 1; 454 return true;
455 if (ipv6_hdr_cmp(o1->hopopt, o2->hopopt)) 455 if (ipv6_hdr_cmp(o1->hopopt, o2->hopopt))
456 return 1; 456 return true;
457 if (ipv6_hdr_cmp(o1->dst0opt, o2->dst0opt)) 457 if (ipv6_hdr_cmp(o1->dst0opt, o2->dst0opt))
458 return 1; 458 return true;
459 if (ipv6_hdr_cmp((struct ipv6_opt_hdr *)o1->srcrt, (struct ipv6_opt_hdr *)o2->srcrt)) 459 if (ipv6_hdr_cmp((struct ipv6_opt_hdr *)o1->srcrt, (struct ipv6_opt_hdr *)o2->srcrt))
460 return 1; 460 return true;
461 return 0; 461 return false;
462} 462}
463 463
464static inline void fl_link(struct ipv6_pinfo *np, struct ipv6_fl_socklist *sfl, 464static inline void fl_link(struct ipv6_pinfo *np, struct ipv6_fl_socklist *sfl,
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 1ca5d45a12e8..21a15dfe4a9e 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -170,7 +170,8 @@ static int ip6_input_finish(struct sk_buff *skb)
170{ 170{
171 const struct inet6_protocol *ipprot; 171 const struct inet6_protocol *ipprot;
172 unsigned int nhoff; 172 unsigned int nhoff;
173 int nexthdr, raw; 173 int nexthdr;
174 bool raw;
174 u8 hash; 175 u8 hash;
175 struct inet6_dev *idev; 176 struct inet6_dev *idev;
176 struct net *net = dev_net(skb_dst(skb)->dev); 177 struct net *net = dev_net(skb_dst(skb)->dev);
@@ -251,7 +252,7 @@ int ip6_input(struct sk_buff *skb)
251int ip6_mc_input(struct sk_buff *skb) 252int ip6_mc_input(struct sk_buff *skb)
252{ 253{
253 const struct ipv6hdr *hdr; 254 const struct ipv6hdr *hdr;
254 int deliver; 255 bool deliver;
255 256
256 IP6_UPD_PO_STATS_BH(dev_net(skb_dst(skb)->dev), 257 IP6_UPD_PO_STATS_BH(dev_net(skb_dst(skb)->dev),
257 ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_INMCAST, 258 ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_INMCAST,
@@ -287,7 +288,7 @@ int ip6_mc_input(struct sk_buff *skb)
287 * is for MLD (0x0000). 288 * is for MLD (0x0000).
288 */ 289 */
289 if ((ptr[2] | ptr[3]) == 0) { 290 if ((ptr[2] | ptr[3]) == 0) {
290 deliver = 0; 291 deliver = false;
291 292
292 if (!ipv6_ext_hdr(nexthdr)) { 293 if (!ipv6_ext_hdr(nexthdr)) {
293 /* BUG */ 294 /* BUG */
@@ -312,7 +313,7 @@ int ip6_mc_input(struct sk_buff *skb)
312 case ICMPV6_MGM_REPORT: 313 case ICMPV6_MGM_REPORT:
313 case ICMPV6_MGM_REDUCTION: 314 case ICMPV6_MGM_REDUCTION:
314 case ICMPV6_MLD2_REPORT: 315 case ICMPV6_MLD2_REPORT:
315 deliver = 1; 316 deliver = true;
316 break; 317 break;
317 } 318 }
318 goto out; 319 goto out;
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 2a3a22cf7604..6d0f5dc8e3a6 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -606,13 +606,13 @@ done:
606 return err; 606 return err;
607} 607}
608 608
609int inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr, 609bool inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr,
610 const struct in6_addr *src_addr) 610 const struct in6_addr *src_addr)
611{ 611{
612 struct ipv6_pinfo *np = inet6_sk(sk); 612 struct ipv6_pinfo *np = inet6_sk(sk);
613 struct ipv6_mc_socklist *mc; 613 struct ipv6_mc_socklist *mc;
614 struct ip6_sf_socklist *psl; 614 struct ip6_sf_socklist *psl;
615 int rv = 1; 615 bool rv = true;
616 616
617 rcu_read_lock(); 617 rcu_read_lock();
618 for_each_pmc_rcu(np, mc) { 618 for_each_pmc_rcu(np, mc) {
@@ -621,7 +621,7 @@ int inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr,
621 } 621 }
622 if (!mc) { 622 if (!mc) {
623 rcu_read_unlock(); 623 rcu_read_unlock();
624 return 1; 624 return true;
625 } 625 }
626 read_lock(&mc->sflock); 626 read_lock(&mc->sflock);
627 psl = mc->sflist; 627 psl = mc->sflist;
@@ -635,9 +635,9 @@ int inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr,
635 break; 635 break;
636 } 636 }
637 if (mc->sfmode == MCAST_INCLUDE && i >= psl->sl_count) 637 if (mc->sfmode == MCAST_INCLUDE && i >= psl->sl_count)
638 rv = 0; 638 rv = false;
639 if (mc->sfmode == MCAST_EXCLUDE && i < psl->sl_count) 639 if (mc->sfmode == MCAST_EXCLUDE && i < psl->sl_count)
640 rv = 0; 640 rv = false;
641 } 641 }
642 read_unlock(&mc->sflock); 642 read_unlock(&mc->sflock);
643 rcu_read_unlock(); 643 rcu_read_unlock();
@@ -931,15 +931,15 @@ int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr)
931/* 931/*
932 * identify MLD packets for MLD filter exceptions 932 * identify MLD packets for MLD filter exceptions
933 */ 933 */
934int ipv6_is_mld(struct sk_buff *skb, int nexthdr) 934bool ipv6_is_mld(struct sk_buff *skb, int nexthdr)
935{ 935{
936 struct icmp6hdr *pic; 936 struct icmp6hdr *pic;
937 937
938 if (nexthdr != IPPROTO_ICMPV6) 938 if (nexthdr != IPPROTO_ICMPV6)
939 return 0; 939 return false;
940 940
941 if (!pskb_may_pull(skb, sizeof(struct icmp6hdr))) 941 if (!pskb_may_pull(skb, sizeof(struct icmp6hdr)))
942 return 0; 942 return false;
943 943
944 pic = icmp6_hdr(skb); 944 pic = icmp6_hdr(skb);
945 945
@@ -948,22 +948,22 @@ int ipv6_is_mld(struct sk_buff *skb, int nexthdr)
948 case ICMPV6_MGM_REPORT: 948 case ICMPV6_MGM_REPORT:
949 case ICMPV6_MGM_REDUCTION: 949 case ICMPV6_MGM_REDUCTION:
950 case ICMPV6_MLD2_REPORT: 950 case ICMPV6_MLD2_REPORT:
951 return 1; 951 return true;
952 default: 952 default:
953 break; 953 break;
954 } 954 }
955 return 0; 955 return false;
956} 956}
957 957
958/* 958/*
959 * check if the interface/address pair is valid 959 * check if the interface/address pair is valid
960 */ 960 */
961int ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group, 961bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
962 const struct in6_addr *src_addr) 962 const struct in6_addr *src_addr)
963{ 963{
964 struct inet6_dev *idev; 964 struct inet6_dev *idev;
965 struct ifmcaddr6 *mc; 965 struct ifmcaddr6 *mc;
966 int rv = 0; 966 bool rv = false;
967 967
968 rcu_read_lock(); 968 rcu_read_lock();
969 idev = __in6_dev_get(dev); 969 idev = __in6_dev_get(dev);
@@ -990,7 +990,7 @@ int ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
990 rv = mc->mca_sfcount[MCAST_EXCLUDE] !=0; 990 rv = mc->mca_sfcount[MCAST_EXCLUDE] !=0;
991 spin_unlock_bh(&mc->mca_lock); 991 spin_unlock_bh(&mc->mca_lock);
992 } else 992 } else
993 rv = 1; /* don't filter unspecified source */ 993 rv = true; /* don't filter unspecified source */
994 } 994 }
995 read_unlock_bh(&idev->lock); 995 read_unlock_bh(&idev->lock);
996 } 996 }
@@ -1046,8 +1046,8 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime)
1046} 1046}
1047 1047
1048/* mark EXCLUDE-mode sources */ 1048/* mark EXCLUDE-mode sources */
1049static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, 1049static bool mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs,
1050 const struct in6_addr *srcs) 1050 const struct in6_addr *srcs)
1051{ 1051{
1052 struct ip6_sf_list *psf; 1052 struct ip6_sf_list *psf;
1053 int i, scount; 1053 int i, scount;
@@ -1070,12 +1070,12 @@ static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs,
1070 } 1070 }
1071 pmc->mca_flags &= ~MAF_GSQUERY; 1071 pmc->mca_flags &= ~MAF_GSQUERY;
1072 if (scount == nsrcs) /* all sources excluded */ 1072 if (scount == nsrcs) /* all sources excluded */
1073 return 0; 1073 return false;
1074 return 1; 1074 return true;
1075} 1075}
1076 1076
1077static int mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, 1077static bool mld_marksources(struct ifmcaddr6 *pmc, int nsrcs,
1078 const struct in6_addr *srcs) 1078 const struct in6_addr *srcs)
1079{ 1079{
1080 struct ip6_sf_list *psf; 1080 struct ip6_sf_list *psf;
1081 int i, scount; 1081 int i, scount;
@@ -1099,10 +1099,10 @@ static int mld_marksources(struct ifmcaddr6 *pmc, int nsrcs,
1099 } 1099 }
1100 if (!scount) { 1100 if (!scount) {
1101 pmc->mca_flags &= ~MAF_GSQUERY; 1101 pmc->mca_flags &= ~MAF_GSQUERY;
1102 return 0; 1102 return false;
1103 } 1103 }
1104 pmc->mca_flags |= MAF_GSQUERY; 1104 pmc->mca_flags |= MAF_GSQUERY;
1105 return 1; 1105 return true;
1106} 1106}
1107 1107
1108/* called with rcu_read_lock() */ 1108/* called with rcu_read_lock() */
@@ -1276,17 +1276,17 @@ int igmp6_event_report(struct sk_buff *skb)
1276 return 0; 1276 return 0;
1277} 1277}
1278 1278
1279static int is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type, 1279static bool is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type,
1280 int gdeleted, int sdeleted) 1280 int gdeleted, int sdeleted)
1281{ 1281{
1282 switch (type) { 1282 switch (type) {
1283 case MLD2_MODE_IS_INCLUDE: 1283 case MLD2_MODE_IS_INCLUDE:
1284 case MLD2_MODE_IS_EXCLUDE: 1284 case MLD2_MODE_IS_EXCLUDE:
1285 if (gdeleted || sdeleted) 1285 if (gdeleted || sdeleted)
1286 return 0; 1286 return false;
1287 if (!((pmc->mca_flags & MAF_GSQUERY) && !psf->sf_gsresp)) { 1287 if (!((pmc->mca_flags & MAF_GSQUERY) && !psf->sf_gsresp)) {
1288 if (pmc->mca_sfmode == MCAST_INCLUDE) 1288 if (pmc->mca_sfmode == MCAST_INCLUDE)
1289 return 1; 1289 return true;
1290 /* don't include if this source is excluded 1290 /* don't include if this source is excluded
1291 * in all filters 1291 * in all filters
1292 */ 1292 */
@@ -1295,29 +1295,29 @@ static int is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type,
1295 return pmc->mca_sfcount[MCAST_EXCLUDE] == 1295 return pmc->mca_sfcount[MCAST_EXCLUDE] ==
1296 psf->sf_count[MCAST_EXCLUDE]; 1296 psf->sf_count[MCAST_EXCLUDE];
1297 } 1297 }
1298 return 0; 1298 return false;
1299 case MLD2_CHANGE_TO_INCLUDE: 1299 case MLD2_CHANGE_TO_INCLUDE:
1300 if (gdeleted || sdeleted) 1300 if (gdeleted || sdeleted)
1301 return 0; 1301 return false;
1302 return psf->sf_count[MCAST_INCLUDE] != 0; 1302 return psf->sf_count[MCAST_INCLUDE] != 0;
1303 case MLD2_CHANGE_TO_EXCLUDE: 1303 case MLD2_CHANGE_TO_EXCLUDE:
1304 if (gdeleted || sdeleted) 1304 if (gdeleted || sdeleted)
1305 return 0; 1305 return false;
1306 if (pmc->mca_sfcount[MCAST_EXCLUDE] == 0 || 1306 if (pmc->mca_sfcount[MCAST_EXCLUDE] == 0 ||
1307 psf->sf_count[MCAST_INCLUDE]) 1307 psf->sf_count[MCAST_INCLUDE])
1308 return 0; 1308 return false;
1309 return pmc->mca_sfcount[MCAST_EXCLUDE] == 1309 return pmc->mca_sfcount[MCAST_EXCLUDE] ==
1310 psf->sf_count[MCAST_EXCLUDE]; 1310 psf->sf_count[MCAST_EXCLUDE];
1311 case MLD2_ALLOW_NEW_SOURCES: 1311 case MLD2_ALLOW_NEW_SOURCES:
1312 if (gdeleted || !psf->sf_crcount) 1312 if (gdeleted || !psf->sf_crcount)
1313 return 0; 1313 return false;
1314 return (pmc->mca_sfmode == MCAST_INCLUDE) ^ sdeleted; 1314 return (pmc->mca_sfmode == MCAST_INCLUDE) ^ sdeleted;
1315 case MLD2_BLOCK_OLD_SOURCES: 1315 case MLD2_BLOCK_OLD_SOURCES:
1316 if (pmc->mca_sfmode == MCAST_INCLUDE) 1316 if (pmc->mca_sfmode == MCAST_INCLUDE)
1317 return gdeleted || (psf->sf_crcount && sdeleted); 1317 return gdeleted || (psf->sf_crcount && sdeleted);
1318 return psf->sf_crcount && !gdeleted && !sdeleted; 1318 return psf->sf_crcount && !gdeleted && !sdeleted;
1319 } 1319 }
1320 return 0; 1320 return false;
1321} 1321}
1322 1322
1323static int 1323static int
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index c7a27ac906df..54f62d3b8dd6 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -348,7 +348,7 @@ static int ndisc_constructor(struct neighbour *neigh)
348 struct net_device *dev = neigh->dev; 348 struct net_device *dev = neigh->dev;
349 struct inet6_dev *in6_dev; 349 struct inet6_dev *in6_dev;
350 struct neigh_parms *parms; 350 struct neigh_parms *parms;
351 int is_multicast = ipv6_addr_is_multicast(addr); 351 bool is_multicast = ipv6_addr_is_multicast(addr);
352 352
353 in6_dev = in6_dev_get(dev); 353 in6_dev = in6_dev_get(dev);
354 if (in6_dev == NULL) { 354 if (in6_dev == NULL) {
@@ -725,7 +725,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
725 struct inet6_dev *idev = NULL; 725 struct inet6_dev *idev = NULL;
726 struct neighbour *neigh; 726 struct neighbour *neigh;
727 int dad = ipv6_addr_any(saddr); 727 int dad = ipv6_addr_any(saddr);
728 int inc; 728 bool inc;
729 int is_router = -1; 729 int is_router = -1;
730 730
731 if (ipv6_addr_is_multicast(&msg->target)) { 731 if (ipv6_addr_is_multicast(&msg->target)) {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 5bddea778840..93d69836fded 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -72,7 +72,7 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
72 const struct in6_addr *rmt_addr, int dif) 72 const struct in6_addr *rmt_addr, int dif)
73{ 73{
74 struct hlist_node *node; 74 struct hlist_node *node;
75 int is_multicast = ipv6_addr_is_multicast(loc_addr); 75 bool is_multicast = ipv6_addr_is_multicast(loc_addr);
76 76
77 sk_for_each_from(sk, node) 77 sk_for_each_from(sk, node)
78 if (inet_sk(sk)->inet_num == num) { 78 if (inet_sk(sk)->inet_num == num) {
@@ -153,12 +153,12 @@ EXPORT_SYMBOL(rawv6_mh_filter_unregister);
153 * 153 *
154 * Caller owns SKB so we must make clones. 154 * Caller owns SKB so we must make clones.
155 */ 155 */
156static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) 156static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
157{ 157{
158 const struct in6_addr *saddr; 158 const struct in6_addr *saddr;
159 const struct in6_addr *daddr; 159 const struct in6_addr *daddr;
160 struct sock *sk; 160 struct sock *sk;
161 int delivered = 0; 161 bool delivered = false;
162 __u8 hash; 162 __u8 hash;
163 struct net *net; 163 struct net *net;
164 164
@@ -179,7 +179,7 @@ static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
179 while (sk) { 179 while (sk) {
180 int filtered; 180 int filtered;
181 181
182 delivered = 1; 182 delivered = true;
183 switch (nexthdr) { 183 switch (nexthdr) {
184 case IPPROTO_ICMPV6: 184 case IPPROTO_ICMPV6:
185 filtered = icmpv6_filter(sk, skb); 185 filtered = icmpv6_filter(sk, skb);
@@ -225,7 +225,7 @@ out:
225 return delivered; 225 return delivered;
226} 226}
227 227
228int raw6_local_deliver(struct sk_buff *skb, int nexthdr) 228bool raw6_local_deliver(struct sk_buff *skb, int nexthdr)
229{ 229{
230 struct sock *raw_sk; 230 struct sock *raw_sk;
231 231
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 90119a32b89d..999a982ad3fd 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -333,22 +333,22 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
333 } 333 }
334} 334}
335 335
336static __inline__ int rt6_check_expired(const struct rt6_info *rt) 336static bool rt6_check_expired(const struct rt6_info *rt)
337{ 337{
338 struct rt6_info *ort = NULL; 338 struct rt6_info *ort = NULL;
339 339
340 if (rt->rt6i_flags & RTF_EXPIRES) { 340 if (rt->rt6i_flags & RTF_EXPIRES) {
341 if (time_after(jiffies, rt->dst.expires)) 341 if (time_after(jiffies, rt->dst.expires))
342 return 1; 342 return true;
343 } else if (rt->dst.from) { 343 } else if (rt->dst.from) {
344 ort = (struct rt6_info *) rt->dst.from; 344 ort = (struct rt6_info *) rt->dst.from;
345 return (ort->rt6i_flags & RTF_EXPIRES) && 345 return (ort->rt6i_flags & RTF_EXPIRES) &&
346 time_after(jiffies, ort->dst.expires); 346 time_after(jiffies, ort->dst.expires);
347 } 347 }
348 return 0; 348 return false;
349} 349}
350 350
351static inline int rt6_need_strict(const struct in6_addr *daddr) 351static bool rt6_need_strict(const struct in6_addr *daddr)
352{ 352{
353 return ipv6_addr_type(daddr) & 353 return ipv6_addr_type(daddr) &
354 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); 354 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);