Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eric Dumazet and committed by
David S. Miller
a50feda5 32e9072b

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