Commit 8528819adc613e0b4bc3e5cb4123b4b33d2b03c4

Authored by Patrick McHardy
Committed by David S. Miller
1 parent 112f35c9c1

[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>

Showing 1 changed file with 12 additions and 11 deletions Side-by-side Diff

net/netfilter/nf_conntrack_proto_sctp.c
... ... @@ -300,6 +300,7 @@
300 300 unsigned int hooknum)
301 301 {
302 302 enum sctp_conntrack newconntrack, oldsctpstate;
  303 + enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
303 304 sctp_sctphdr_t _sctph, *sh;
304 305 sctp_chunkhdr_t _sch, *sch;
305 306 u_int32_t offset, count;
... ... @@ -318,7 +319,7 @@
318 319 !test_bit(SCTP_CID_COOKIE_ECHO, map) &&
319 320 !test_bit(SCTP_CID_ABORT, map) &&
320 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 323 pr_debug("Verification tag check failed\n");
323 324 return -1;
324 325 }
325 326  
326 327  
327 328  
328 329  
... ... @@ -336,35 +337,35 @@
336 337 }
337 338 } else if (sch->type == SCTP_CID_ABORT) {
338 339 /* Sec 8.5.1 (B) */
339   - if (sh->vtag != ct->proto.sctp.vtag[CTINFO2DIR(ctinfo)] &&
340   - sh->vtag != ct->proto.sctp.vtag[1 - CTINFO2DIR(ctinfo)]) {
  340 + if (sh->vtag != ct->proto.sctp.vtag[dir] &&
  341 + sh->vtag != ct->proto.sctp.vtag[!dir]) {
341 342 write_unlock_bh(&sctp_lock);
342 343 return -1;
343 344 }
344 345 } else if (sch->type == SCTP_CID_SHUTDOWN_COMPLETE) {
345 346 /* Sec 8.5.1 (C) */
346   - if (sh->vtag != ct->proto.sctp.vtag[CTINFO2DIR(ctinfo)] &&
347   - sh->vtag != ct->proto.sctp.vtag[1 - CTINFO2DIR(ctinfo)] &&
  347 + if (sh->vtag != ct->proto.sctp.vtag[dir] &&
  348 + sh->vtag != ct->proto.sctp.vtag[!dir] &&
348 349 (sch->flags & 1)) {
349 350 write_unlock_bh(&sctp_lock);
350 351 return -1;
351 352 }
352 353 } else if (sch->type == SCTP_CID_COOKIE_ECHO) {
353 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 356 write_unlock_bh(&sctp_lock);
356 357 return -1;
357 358 }
358 359 }
359 360  
360 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 364 /* Invalid */
364 365 if (newconntrack == SCTP_CONNTRACK_MAX) {
365 366 pr_debug("nf_conntrack_sctp: Invalid dir=%i ctype=%u "
366 367 "conntrack=%u\n",
367   - CTINFO2DIR(ctinfo), sch->type, oldsctpstate);
  368 + dir, sch->type, oldsctpstate);
368 369 write_unlock_bh(&sctp_lock);
369 370 return -1;
370 371 }
... ... @@ -381,8 +382,8 @@
381 382 return -1;
382 383 }
383 384 pr_debug("Setting vtag %x for dir %d\n",
384   - ih->init_tag, !CTINFO2DIR(ctinfo));
385   - ct->proto.sctp.vtag[!CTINFO2DIR(ctinfo)] = ih->init_tag;
  385 + ih->init_tag, !dir);
  386 + ct->proto.sctp.vtag[!dir] = ih->init_tag;
386 387 }
387 388  
388 389 ct->proto.sctp.state = newconntrack;
... ... @@ -394,7 +395,7 @@
394 395 nf_ct_refresh_acct(ct, ctinfo, skb, *sctp_timeouts[newconntrack]);
395 396  
396 397 if (oldsctpstate == SCTP_CONNTRACK_COOKIE_ECHOED &&
397   - CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY &&
  398 + dir == IP_CT_DIR_REPLY &&
398 399 newconntrack == SCTP_CONNTRACK_ESTABLISHED) {
399 400 pr_debug("Setting assured bit\n");
400 401 set_bit(IPS_ASSURED_BIT, &ct->status);