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

[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l4proto

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>

authored by

Jan Engelhardt and committed by
Patrick McHardy
09f263cd 8ce8439a

+125 -132
+6 -7
include/net/netfilter/nf_conntrack_l4proto.h
··· 25 25 26 26 /* Try to fill in the third arg: dataoff is offset past network protocol 27 27 hdr. Return true if possible. */ 28 - int (*pkt_to_tuple)(const struct sk_buff *skb, 29 - unsigned int dataoff, 30 - struct nf_conntrack_tuple *tuple); 28 + bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int dataoff, 29 + struct nf_conntrack_tuple *tuple); 31 30 32 31 /* Invert the per-proto part of the tuple: ie. turn xmit into reply. 33 32 * Some packets can't be inverted: return 0 in that case. 34 33 */ 35 - int (*invert_tuple)(struct nf_conntrack_tuple *inverse, 36 - const struct nf_conntrack_tuple *orig); 34 + bool (*invert_tuple)(struct nf_conntrack_tuple *inverse, 35 + const struct nf_conntrack_tuple *orig); 37 36 38 37 /* Returns verdict for packet, or -1 for invalid. */ 39 38 int (*packet)(struct nf_conn *ct, ··· 44 45 45 46 /* Called when a new connection for this protocol found; 46 47 * returns TRUE if it's OK. If so, packet() called next. */ 47 - int (*new)(struct nf_conn *ct, const struct sk_buff *skb, 48 - unsigned int dataoff); 48 + bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, 49 + unsigned int dataoff); 49 50 50 51 /* Called when a conntrack entry is destroyed */ 51 52 void (*destroy)(struct nf_conn *ct);
+12 -13
net/ipv4/netfilter/nf_conntrack_proto_icmp.c
··· 22 22 23 23 static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; 24 24 25 - static int icmp_pkt_to_tuple(const struct sk_buff *skb, 26 - unsigned int dataoff, 27 - struct nf_conntrack_tuple *tuple) 25 + static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, 26 + struct nf_conntrack_tuple *tuple) 28 27 { 29 28 const struct icmphdr *hp; 30 29 struct icmphdr _hdr; 31 30 32 31 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 33 32 if (hp == NULL) 34 - return 0; 33 + return false; 35 34 36 35 tuple->dst.u.icmp.type = hp->type; 37 36 tuple->src.u.icmp.id = hp->un.echo.id; 38 37 tuple->dst.u.icmp.code = hp->code; 39 38 40 - return 1; 39 + return true; 41 40 } 42 41 43 42 /* Add 1; spaces filled with 0. */ ··· 51 52 [ICMP_ADDRESSREPLY] = ICMP_ADDRESS + 1 52 53 }; 53 54 54 - static int icmp_invert_tuple(struct nf_conntrack_tuple *tuple, 55 - const struct nf_conntrack_tuple *orig) 55 + static bool icmp_invert_tuple(struct nf_conntrack_tuple *tuple, 56 + const struct nf_conntrack_tuple *orig) 56 57 { 57 58 if (orig->dst.u.icmp.type >= sizeof(invmap) 58 59 || !invmap[orig->dst.u.icmp.type]) 59 - return 0; 60 + return false; 60 61 61 62 tuple->src.u.icmp.id = orig->src.u.icmp.id; 62 63 tuple->dst.u.icmp.type = invmap[orig->dst.u.icmp.type] - 1; 63 64 tuple->dst.u.icmp.code = orig->dst.u.icmp.code; 64 - return 1; 65 + return true; 65 66 } 66 67 67 68 /* Print out the per-protocol part of the tuple. */ ··· 100 101 } 101 102 102 103 /* Called when a new connection for this protocol found. */ 103 - static int icmp_new(struct nf_conn *ct, 104 - const struct sk_buff *skb, unsigned int dataoff) 104 + static bool icmp_new(struct nf_conn *ct, const struct sk_buff *skb, 105 + unsigned int dataoff) 105 106 { 106 107 static const u_int8_t valid_new[] = { 107 108 [ICMP_ECHO] = 1, ··· 116 117 pr_debug("icmp: can't create new conn with type %u\n", 117 118 ct->tuplehash[0].tuple.dst.u.icmp.type); 118 119 NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple); 119 - return 0; 120 + return false; 120 121 } 121 122 atomic_set(&ct->proto.icmp.count, 0); 122 - return 1; 123 + return true; 123 124 } 124 125 125 126 /* Returns conntrack if it dealt with ICMP, and filled in skb fields */
+13 -14
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
··· 28 28 29 29 static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; 30 30 31 - static int icmpv6_pkt_to_tuple(const struct sk_buff *skb, 32 - unsigned int dataoff, 33 - struct nf_conntrack_tuple *tuple) 31 + static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, 32 + unsigned int dataoff, 33 + struct nf_conntrack_tuple *tuple) 34 34 { 35 35 const struct icmp6hdr *hp; 36 36 struct icmp6hdr _hdr; 37 37 38 38 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 39 39 if (hp == NULL) 40 - return 0; 40 + return false; 41 41 tuple->dst.u.icmp.type = hp->icmp6_type; 42 42 tuple->src.u.icmp.id = hp->icmp6_identifier; 43 43 tuple->dst.u.icmp.code = hp->icmp6_code; 44 44 45 - return 1; 45 + return true; 46 46 } 47 47 48 48 /* Add 1; spaces filled with 0. */ ··· 53 53 [ICMPV6_NI_REPLY - 128] = ICMPV6_NI_REPLY +1 54 54 }; 55 55 56 - static int icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple, 57 - const struct nf_conntrack_tuple *orig) 56 + static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple, 57 + const struct nf_conntrack_tuple *orig) 58 58 { 59 59 int type = orig->dst.u.icmp.type - 128; 60 60 if (type < 0 || type >= sizeof(invmap) || !invmap[type]) 61 - return 0; 61 + return false; 62 62 63 63 tuple->src.u.icmp.id = orig->src.u.icmp.id; 64 64 tuple->dst.u.icmp.type = invmap[type] - 1; 65 65 tuple->dst.u.icmp.code = orig->dst.u.icmp.code; 66 - return 1; 66 + return true; 67 67 } 68 68 69 69 /* Print out the per-protocol part of the tuple. */ ··· 102 102 } 103 103 104 104 /* Called when a new connection for this protocol found. */ 105 - static int icmpv6_new(struct nf_conn *ct, 106 - const struct sk_buff *skb, 107 - unsigned int dataoff) 105 + static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb, 106 + unsigned int dataoff) 108 107 { 109 108 static const u_int8_t valid_new[] = { 110 109 [ICMPV6_ECHO_REQUEST - 128] = 1, ··· 116 117 pr_debug("icmpv6: can't create new conn with type %u\n", 117 118 type + 128); 118 119 NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple); 119 - return 0; 120 + return false; 120 121 } 121 122 atomic_set(&ct->proto.icmp.count, 0); 122 - return 1; 123 + return true; 123 124 } 124 125 125 126 static int
+11 -11
net/netfilter/nf_conntrack_proto_dccp.c
··· 393 393 }, 394 394 }; 395 395 396 - static int dccp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, 397 - struct nf_conntrack_tuple *tuple) 396 + static bool dccp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, 397 + struct nf_conntrack_tuple *tuple) 398 398 { 399 399 struct dccp_hdr _hdr, *dh; 400 400 401 401 dh = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 402 402 if (dh == NULL) 403 - return 0; 403 + return false; 404 404 405 405 tuple->src.u.dccp.port = dh->dccph_sport; 406 406 tuple->dst.u.dccp.port = dh->dccph_dport; 407 - return 1; 407 + return true; 408 408 } 409 409 410 - static int dccp_invert_tuple(struct nf_conntrack_tuple *inv, 411 - const struct nf_conntrack_tuple *tuple) 410 + static bool dccp_invert_tuple(struct nf_conntrack_tuple *inv, 411 + const struct nf_conntrack_tuple *tuple) 412 412 { 413 413 inv->src.u.dccp.port = tuple->dst.u.dccp.port; 414 414 inv->dst.u.dccp.port = tuple->src.u.dccp.port; 415 - return 1; 415 + return true; 416 416 } 417 417 418 - static int dccp_new(struct nf_conn *ct, const struct sk_buff *skb, 419 - unsigned int dataoff) 418 + static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb, 419 + unsigned int dataoff) 420 420 { 421 421 struct dccp_hdr _dh, *dh; 422 422 const char *msg; ··· 442 442 ct->proto.dccp.role[IP_CT_DIR_ORIGINAL] = CT_DCCP_ROLE_CLIENT; 443 443 ct->proto.dccp.role[IP_CT_DIR_REPLY] = CT_DCCP_ROLE_SERVER; 444 444 ct->proto.dccp.state = CT_DCCP_NONE; 445 - return 1; 445 + return true; 446 446 447 447 out_invalid: 448 448 if (LOG_INVALID(IPPROTO_DCCP)) 449 449 nf_log_packet(nf_ct_l3num(ct), 0, skb, NULL, NULL, NULL, msg); 450 - return 0; 450 + return false; 451 451 } 452 452 453 453 static u64 dccp_ack_seq(const struct dccp_hdr *dh)
+10 -10
net/netfilter/nf_conntrack_proto_generic.c
··· 14 14 15 15 static unsigned int nf_ct_generic_timeout __read_mostly = 600*HZ; 16 16 17 - static int generic_pkt_to_tuple(const struct sk_buff *skb, 18 - unsigned int dataoff, 19 - struct nf_conntrack_tuple *tuple) 17 + static bool generic_pkt_to_tuple(const struct sk_buff *skb, 18 + unsigned int dataoff, 19 + struct nf_conntrack_tuple *tuple) 20 20 { 21 21 tuple->src.u.all = 0; 22 22 tuple->dst.u.all = 0; 23 23 24 - return 1; 24 + return true; 25 25 } 26 26 27 - static int generic_invert_tuple(struct nf_conntrack_tuple *tuple, 28 - const struct nf_conntrack_tuple *orig) 27 + static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, 28 + const struct nf_conntrack_tuple *orig) 29 29 { 30 30 tuple->src.u.all = 0; 31 31 tuple->dst.u.all = 0; 32 32 33 - return 1; 33 + return true; 34 34 } 35 35 36 36 /* Print out the per-protocol part of the tuple. */ ··· 53 53 } 54 54 55 55 /* Called when a new connection for this protocol found. */ 56 - static int new(struct nf_conn *ct, const struct sk_buff *skb, 57 - unsigned int dataoff) 56 + static bool new(struct nf_conn *ct, const struct sk_buff *skb, 57 + unsigned int dataoff) 58 58 { 59 - return 1; 59 + return true; 60 60 } 61 61 62 62 #ifdef CONFIG_SYSCTL
+12 -13
net/netfilter/nf_conntrack_proto_gre.c
··· 148 148 /* PUBLIC CONNTRACK PROTO HELPER FUNCTIONS */ 149 149 150 150 /* invert gre part of tuple */ 151 - static int gre_invert_tuple(struct nf_conntrack_tuple *tuple, 152 - const struct nf_conntrack_tuple *orig) 151 + static bool gre_invert_tuple(struct nf_conntrack_tuple *tuple, 152 + const struct nf_conntrack_tuple *orig) 153 153 { 154 154 tuple->dst.u.gre.key = orig->src.u.gre.key; 155 155 tuple->src.u.gre.key = orig->dst.u.gre.key; 156 - return 1; 156 + return true; 157 157 } 158 158 159 159 /* gre hdr info to tuple */ 160 - static int gre_pkt_to_tuple(const struct sk_buff *skb, 161 - unsigned int dataoff, 162 - struct nf_conntrack_tuple *tuple) 160 + static bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, 161 + struct nf_conntrack_tuple *tuple) 163 162 { 164 163 const struct gre_hdr_pptp *pgrehdr; 165 164 struct gre_hdr_pptp _pgrehdr; ··· 172 173 /* try to behave like "nf_conntrack_proto_generic" */ 173 174 tuple->src.u.all = 0; 174 175 tuple->dst.u.all = 0; 175 - return 1; 176 + return true; 176 177 } 177 178 178 179 /* PPTP header is variable length, only need up to the call_id field */ 179 180 pgrehdr = skb_header_pointer(skb, dataoff, 8, &_pgrehdr); 180 181 if (!pgrehdr) 181 - return 1; 182 + return true; 182 183 183 184 if (ntohs(grehdr->protocol) != GRE_PROTOCOL_PPTP) { 184 185 pr_debug("GRE_VERSION_PPTP but unknown proto\n"); 185 - return 0; 186 + return false; 186 187 } 187 188 188 189 tuple->dst.u.gre.key = pgrehdr->call_id; 189 190 srckey = gre_keymap_lookup(tuple); 190 191 tuple->src.u.gre.key = srckey; 191 192 192 - return 1; 193 + return true; 193 194 } 194 195 195 196 /* print gre part of tuple */ ··· 234 235 } 235 236 236 237 /* Called when a new connection for this protocol found. */ 237 - static int gre_new(struct nf_conn *ct, const struct sk_buff *skb, 238 - unsigned int dataoff) 238 + static bool gre_new(struct nf_conn *ct, const struct sk_buff *skb, 239 + unsigned int dataoff) 239 240 { 240 241 pr_debug(": "); 241 242 NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); ··· 245 246 ct->proto.gre.stream_timeout = GRE_STREAM_TIMEOUT; 246 247 ct->proto.gre.timeout = GRE_TIMEOUT; 247 248 248 - return 1; 249 + return true; 249 250 } 250 251 251 252 /* Called when a conntrack entry has already been removed from the hashes
+16 -17
net/netfilter/nf_conntrack_proto_sctp.c
··· 130 130 } 131 131 }; 132 132 133 - static int sctp_pkt_to_tuple(const struct sk_buff *skb, 134 - unsigned int dataoff, 135 - struct nf_conntrack_tuple *tuple) 133 + static bool sctp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, 134 + struct nf_conntrack_tuple *tuple) 136 135 { 137 136 sctp_sctphdr_t _hdr, *hp; 138 137 139 138 /* Actually only need first 8 bytes. */ 140 139 hp = skb_header_pointer(skb, dataoff, 8, &_hdr); 141 140 if (hp == NULL) 142 - return 0; 141 + return false; 143 142 144 143 tuple->src.u.sctp.port = hp->source; 145 144 tuple->dst.u.sctp.port = hp->dest; 146 - return 1; 145 + return true; 147 146 } 148 147 149 - static int sctp_invert_tuple(struct nf_conntrack_tuple *tuple, 150 - const struct nf_conntrack_tuple *orig) 148 + static bool sctp_invert_tuple(struct nf_conntrack_tuple *tuple, 149 + const struct nf_conntrack_tuple *orig) 151 150 { 152 151 tuple->src.u.sctp.port = orig->dst.u.sctp.port; 153 152 tuple->dst.u.sctp.port = orig->src.u.sctp.port; 154 - return 1; 153 + return true; 155 154 } 156 155 157 156 /* Print out the per-protocol part of the tuple. */ ··· 389 390 } 390 391 391 392 /* Called when a new connection for this protocol found. */ 392 - static int sctp_new(struct nf_conn *ct, const struct sk_buff *skb, 393 - unsigned int dataoff) 393 + static bool sctp_new(struct nf_conn *ct, const struct sk_buff *skb, 394 + unsigned int dataoff) 394 395 { 395 396 enum sctp_conntrack new_state; 396 397 sctp_sctphdr_t _sctph, *sh; ··· 400 401 401 402 sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph); 402 403 if (sh == NULL) 403 - return 0; 404 + return false; 404 405 405 406 if (do_basic_checks(ct, skb, dataoff, map) != 0) 406 - return 0; 407 + return false; 407 408 408 409 /* If an OOTB packet has any of these chunks discard (Sec 8.4) */ 409 410 if (test_bit(SCTP_CID_ABORT, map) || 410 411 test_bit(SCTP_CID_SHUTDOWN_COMPLETE, map) || 411 412 test_bit(SCTP_CID_COOKIE_ACK, map)) 412 - return 0; 413 + return false; 413 414 414 415 new_state = SCTP_CONNTRACK_MAX; 415 416 for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) { ··· 421 422 if (new_state == SCTP_CONNTRACK_NONE || 422 423 new_state == SCTP_CONNTRACK_MAX) { 423 424 pr_debug("nf_conntrack_sctp: invalid new deleting.\n"); 424 - return 0; 425 + return false; 425 426 } 426 427 427 428 /* Copy the vtag into the state info */ ··· 432 433 ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), 433 434 sizeof(_inithdr), &_inithdr); 434 435 if (ih == NULL) 435 - return 0; 436 + return false; 436 437 437 438 pr_debug("Setting vtag %x for new conn\n", 438 439 ih->init_tag); ··· 441 442 ih->init_tag; 442 443 } else { 443 444 /* Sec 8.5.1 (A) */ 444 - return 0; 445 + return false; 445 446 } 446 447 } 447 448 /* If it is a shutdown ack OOTB packet, we expect a return ··· 455 456 ct->proto.sctp.state = new_state; 456 457 } 457 458 458 - return 1; 459 + return true; 459 460 } 460 461 461 462 #ifdef CONFIG_SYSCTL
+25 -27
net/netfilter/nf_conntrack_proto_tcp.c
··· 257 257 } 258 258 }; 259 259 260 - static int tcp_pkt_to_tuple(const struct sk_buff *skb, 261 - unsigned int dataoff, 262 - struct nf_conntrack_tuple *tuple) 260 + static bool tcp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, 261 + struct nf_conntrack_tuple *tuple) 263 262 { 264 263 const struct tcphdr *hp; 265 264 struct tcphdr _hdr; ··· 266 267 /* Actually only need first 8 bytes. */ 267 268 hp = skb_header_pointer(skb, dataoff, 8, &_hdr); 268 269 if (hp == NULL) 269 - return 0; 270 + return false; 270 271 271 272 tuple->src.u.tcp.port = hp->source; 272 273 tuple->dst.u.tcp.port = hp->dest; 273 274 274 - return 1; 275 + return true; 275 276 } 276 277 277 - static int tcp_invert_tuple(struct nf_conntrack_tuple *tuple, 278 - const struct nf_conntrack_tuple *orig) 278 + static bool tcp_invert_tuple(struct nf_conntrack_tuple *tuple, 279 + const struct nf_conntrack_tuple *orig) 279 280 { 280 281 tuple->src.u.tcp.port = orig->dst.u.tcp.port; 281 282 tuple->dst.u.tcp.port = orig->src.u.tcp.port; 282 - return 1; 283 + return true; 283 284 } 284 285 285 286 /* Print out the per-protocol part of the tuple. */ ··· 477 478 } 478 479 } 479 480 480 - static int tcp_in_window(const struct nf_conn *ct, 481 - struct ip_ct_tcp *state, 482 - enum ip_conntrack_dir dir, 483 - unsigned int index, 484 - const struct sk_buff *skb, 485 - unsigned int dataoff, 486 - const struct tcphdr *tcph, 487 - int pf) 481 + static bool tcp_in_window(const struct nf_conn *ct, 482 + struct ip_ct_tcp *state, 483 + enum ip_conntrack_dir dir, 484 + unsigned int index, 485 + const struct sk_buff *skb, 486 + unsigned int dataoff, 487 + const struct tcphdr *tcph, 488 + int pf) 488 489 { 489 490 struct ip_ct_tcp_state *sender = &state->seen[dir]; 490 491 struct ip_ct_tcp_state *receiver = &state->seen[!dir]; 491 492 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; 492 493 __u32 seq, ack, sack, end, win, swin; 493 - int res; 494 + bool res; 494 495 495 496 /* 496 497 * Get the required data from the packet. ··· 656 657 state->retrans = 0; 657 658 } 658 659 } 659 - res = 1; 660 + res = true; 660 661 } else { 661 - res = 0; 662 + res = false; 662 663 if (sender->flags & IP_CT_TCP_FLAG_BE_LIBERAL || 663 664 nf_ct_tcp_be_liberal) 664 - res = 1; 665 + res = true; 665 666 if (!res && LOG_INVALID(IPPROTO_TCP)) 666 667 nf_log_packet(pf, 0, skb, NULL, NULL, NULL, 667 668 "nf_ct_tcp: %s ", ··· 675 676 : "SEQ is over the upper bound (over the window of the receiver)"); 676 677 } 677 678 678 - pr_debug("tcp_in_window: res=%i sender end=%u maxend=%u maxwin=%u " 679 + pr_debug("tcp_in_window: res=%u sender end=%u maxend=%u maxwin=%u " 679 680 "receiver end=%u maxend=%u maxwin=%u\n", 680 681 res, sender->td_end, sender->td_maxend, sender->td_maxwin, 681 682 receiver->td_end, receiver->td_maxend, receiver->td_maxwin); ··· 981 982 } 982 983 983 984 /* Called when a new connection for this protocol found. */ 984 - static int tcp_new(struct nf_conn *ct, 985 - const struct sk_buff *skb, 986 - unsigned int dataoff) 985 + static bool tcp_new(struct nf_conn *ct, const struct sk_buff *skb, 986 + unsigned int dataoff) 987 987 { 988 988 enum tcp_conntrack new_state; 989 989 const struct tcphdr *th; ··· 1001 1003 /* Invalid: delete conntrack */ 1002 1004 if (new_state >= TCP_CONNTRACK_MAX) { 1003 1005 pr_debug("nf_ct_tcp: invalid new deleting.\n"); 1004 - return 0; 1006 + return false; 1005 1007 } 1006 1008 1007 1009 if (new_state == TCP_CONNTRACK_SYN_SENT) { ··· 1019 1021 ct->proto.tcp.seen[1].flags = 0; 1020 1022 } else if (nf_ct_tcp_loose == 0) { 1021 1023 /* Don't try to pick up connections. */ 1022 - return 0; 1024 + return false; 1023 1025 } else { 1024 1026 /* 1025 1027 * We are in the middle of a connection, ··· 1059 1061 sender->td_scale, 1060 1062 receiver->td_end, receiver->td_maxend, receiver->td_maxwin, 1061 1063 receiver->td_scale); 1062 - return 1; 1064 + return true; 1063 1065 } 1064 1066 1065 1067 #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
+9 -9
net/netfilter/nf_conntrack_proto_udp.c
··· 26 26 static unsigned int nf_ct_udp_timeout __read_mostly = 30*HZ; 27 27 static unsigned int nf_ct_udp_timeout_stream __read_mostly = 180*HZ; 28 28 29 - static int udp_pkt_to_tuple(const struct sk_buff *skb, 29 + static bool udp_pkt_to_tuple(const struct sk_buff *skb, 30 30 unsigned int dataoff, 31 31 struct nf_conntrack_tuple *tuple) 32 32 { ··· 36 36 /* Actually only need first 8 bytes. */ 37 37 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 38 38 if (hp == NULL) 39 - return 0; 39 + return false; 40 40 41 41 tuple->src.u.udp.port = hp->source; 42 42 tuple->dst.u.udp.port = hp->dest; 43 43 44 - return 1; 44 + return true; 45 45 } 46 46 47 - static int udp_invert_tuple(struct nf_conntrack_tuple *tuple, 48 - const struct nf_conntrack_tuple *orig) 47 + static bool udp_invert_tuple(struct nf_conntrack_tuple *tuple, 48 + const struct nf_conntrack_tuple *orig) 49 49 { 50 50 tuple->src.u.udp.port = orig->dst.u.udp.port; 51 51 tuple->dst.u.udp.port = orig->src.u.udp.port; 52 - return 1; 52 + return true; 53 53 } 54 54 55 55 /* Print out the per-protocol part of the tuple. */ ··· 83 83 } 84 84 85 85 /* Called when a new connection for this protocol found. */ 86 - static int udp_new(struct nf_conn *ct, const struct sk_buff *skb, 87 - unsigned int dataoff) 86 + static bool udp_new(struct nf_conn *ct, const struct sk_buff *skb, 87 + unsigned int dataoff) 88 88 { 89 - return 1; 89 + return true; 90 90 } 91 91 92 92 static int udp_error(struct sk_buff *skb, unsigned int dataoff,
+11 -11
net/netfilter/nf_conntrack_proto_udplite.c
··· 27 27 static unsigned int nf_ct_udplite_timeout __read_mostly = 30*HZ; 28 28 static unsigned int nf_ct_udplite_timeout_stream __read_mostly = 180*HZ; 29 29 30 - static int udplite_pkt_to_tuple(const struct sk_buff *skb, 31 - unsigned int dataoff, 32 - struct nf_conntrack_tuple *tuple) 30 + static bool udplite_pkt_to_tuple(const struct sk_buff *skb, 31 + unsigned int dataoff, 32 + struct nf_conntrack_tuple *tuple) 33 33 { 34 34 const struct udphdr *hp; 35 35 struct udphdr _hdr; 36 36 37 37 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 38 38 if (hp == NULL) 39 - return 0; 39 + return false; 40 40 41 41 tuple->src.u.udp.port = hp->source; 42 42 tuple->dst.u.udp.port = hp->dest; 43 - return 1; 43 + return true; 44 44 } 45 45 46 - static int udplite_invert_tuple(struct nf_conntrack_tuple *tuple, 47 - const struct nf_conntrack_tuple *orig) 46 + static bool udplite_invert_tuple(struct nf_conntrack_tuple *tuple, 47 + const struct nf_conntrack_tuple *orig) 48 48 { 49 49 tuple->src.u.udp.port = orig->dst.u.udp.port; 50 50 tuple->dst.u.udp.port = orig->src.u.udp.port; 51 - return 1; 51 + return true; 52 52 } 53 53 54 54 /* Print out the per-protocol part of the tuple. */ ··· 83 83 } 84 84 85 85 /* Called when a new connection for this protocol found. */ 86 - static int udplite_new(struct nf_conn *ct, const struct sk_buff *skb, 87 - unsigned int dataoff) 86 + static bool udplite_new(struct nf_conn *ct, const struct sk_buff *skb, 87 + unsigned int dataoff) 88 88 { 89 - return 1; 89 + return true; 90 90 } 91 91 92 92 static int udplite_error(struct sk_buff *skb, unsigned int dataoff,