aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-15 02:46:37 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:35 -0500
commit8528819adc613e0b4bc3e5cb4123b4b33d2b03c4 (patch)
tree0f906744b0d5aa83bef300c7128b863728669e1f /net
parent112f35c9c164e06e038d506dd3eb15e76829ef8a (diff)
[NETFILTER]: nf_conntrack_sctp: reduce line length further
Eliminate a few lines over 80 characters by using a local variable to hold the conntrack direction instead of using CTINFO2DIR everywhere. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_conntrack_proto_sctp.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index 84e37e92b764..fdabef56bf17 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -300,6 +300,7 @@ static int sctp_packet(struct nf_conn *ct,
300 unsigned int hooknum) 300 unsigned int hooknum)
301{ 301{
302 enum sctp_conntrack newconntrack, oldsctpstate; 302 enum sctp_conntrack newconntrack, oldsctpstate;
303 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
303 sctp_sctphdr_t _sctph, *sh; 304 sctp_sctphdr_t _sctph, *sh;
304 sctp_chunkhdr_t _sch, *sch; 305 sctp_chunkhdr_t _sch, *sch;
305 u_int32_t offset, count; 306 u_int32_t offset, count;
@@ -318,7 +319,7 @@ static int sctp_packet(struct nf_conn *ct,
318 !test_bit(SCTP_CID_COOKIE_ECHO, map) && 319 !test_bit(SCTP_CID_COOKIE_ECHO, map) &&
319 !test_bit(SCTP_CID_ABORT, map) && 320 !test_bit(SCTP_CID_ABORT, map) &&
320 !test_bit(SCTP_CID_SHUTDOWN_ACK, map) && 321 !test_bit(SCTP_CID_SHUTDOWN_ACK, map) &&
321 sh->vtag != ct->proto.sctp.vtag[CTINFO2DIR(ctinfo)]) { 322 sh->vtag != ct->proto.sctp.vtag[dir]) {
322 pr_debug("Verification tag check failed\n"); 323 pr_debug("Verification tag check failed\n");
323 return -1; 324 return -1;
324 } 325 }
@@ -336,35 +337,35 @@ static int sctp_packet(struct nf_conn *ct,
336 } 337 }
337 } else if (sch->type == SCTP_CID_ABORT) { 338 } else if (sch->type == SCTP_CID_ABORT) {
338 /* Sec 8.5.1 (B) */ 339 /* Sec 8.5.1 (B) */
339 if (sh->vtag != ct->proto.sctp.vtag[CTINFO2DIR(ctinfo)] && 340 if (sh->vtag != ct->proto.sctp.vtag[dir] &&
340 sh->vtag != ct->proto.sctp.vtag[1 - CTINFO2DIR(ctinfo)]) { 341 sh->vtag != ct->proto.sctp.vtag[!dir]) {
341 write_unlock_bh(&sctp_lock); 342 write_unlock_bh(&sctp_lock);
342 return -1; 343 return -1;
343 } 344 }
344 } else if (sch->type == SCTP_CID_SHUTDOWN_COMPLETE) { 345 } else if (sch->type == SCTP_CID_SHUTDOWN_COMPLETE) {
345 /* Sec 8.5.1 (C) */ 346 /* Sec 8.5.1 (C) */
346 if (sh->vtag != ct->proto.sctp.vtag[CTINFO2DIR(ctinfo)] && 347 if (sh->vtag != ct->proto.sctp.vtag[dir] &&
347 sh->vtag != ct->proto.sctp.vtag[1 - CTINFO2DIR(ctinfo)] && 348 sh->vtag != ct->proto.sctp.vtag[!dir] &&
348 (sch->flags & 1)) { 349 (sch->flags & 1)) {
349 write_unlock_bh(&sctp_lock); 350 write_unlock_bh(&sctp_lock);
350 return -1; 351 return -1;
351 } 352 }
352 } else if (sch->type == SCTP_CID_COOKIE_ECHO) { 353 } else if (sch->type == SCTP_CID_COOKIE_ECHO) {
353 /* Sec 8.5.1 (D) */ 354 /* Sec 8.5.1 (D) */
354 if (sh->vtag != ct->proto.sctp.vtag[CTINFO2DIR(ctinfo)]) { 355 if (sh->vtag != ct->proto.sctp.vtag[dir]) {
355 write_unlock_bh(&sctp_lock); 356 write_unlock_bh(&sctp_lock);
356 return -1; 357 return -1;
357 } 358 }
358 } 359 }
359 360
360 oldsctpstate = ct->proto.sctp.state; 361 oldsctpstate = ct->proto.sctp.state;
361 newconntrack = new_state(CTINFO2DIR(ctinfo), oldsctpstate, sch->type); 362 newconntrack = new_state(dir, oldsctpstate, sch->type);
362 363
363 /* Invalid */ 364 /* Invalid */
364 if (newconntrack == SCTP_CONNTRACK_MAX) { 365 if (newconntrack == SCTP_CONNTRACK_MAX) {
365 pr_debug("nf_conntrack_sctp: Invalid dir=%i ctype=%u " 366 pr_debug("nf_conntrack_sctp: Invalid dir=%i ctype=%u "
366 "conntrack=%u\n", 367 "conntrack=%u\n",
367 CTINFO2DIR(ctinfo), sch->type, oldsctpstate); 368 dir, sch->type, oldsctpstate);
368 write_unlock_bh(&sctp_lock); 369 write_unlock_bh(&sctp_lock);
369 return -1; 370 return -1;
370 } 371 }
@@ -381,8 +382,8 @@ static int sctp_packet(struct nf_conn *ct,
381 return -1; 382 return -1;
382 } 383 }
383 pr_debug("Setting vtag %x for dir %d\n", 384 pr_debug("Setting vtag %x for dir %d\n",
384 ih->init_tag, !CTINFO2DIR(ctinfo)); 385 ih->init_tag, !dir);
385 ct->proto.sctp.vtag[!CTINFO2DIR(ctinfo)] = ih->init_tag; 386 ct->proto.sctp.vtag[!dir] = ih->init_tag;
386 } 387 }
387 388
388 ct->proto.sctp.state = newconntrack; 389 ct->proto.sctp.state = newconntrack;
@@ -394,7 +395,7 @@ static int sctp_packet(struct nf_conn *ct,
394 nf_ct_refresh_acct(ct, ctinfo, skb, *sctp_timeouts[newconntrack]); 395 nf_ct_refresh_acct(ct, ctinfo, skb, *sctp_timeouts[newconntrack]);
395 396
396 if (oldsctpstate == SCTP_CONNTRACK_COOKIE_ECHOED && 397 if (oldsctpstate == SCTP_CONNTRACK_COOKIE_ECHOED &&
397 CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY && 398 dir == IP_CT_DIR_REPLY &&
398 newconntrack == SCTP_CONNTRACK_ESTABLISHED) { 399 newconntrack == SCTP_CONNTRACK_ESTABLISHED) {
399 pr_debug("Setting assured bit\n"); 400 pr_debug("Setting assured bit\n");
400 set_bit(IPS_ASSURED_BIT, &ct->status); 401 set_bit(IPS_ASSURED_BIT, &ct->status);