Print this page
Only exploit ipf state keeping for CFW logging.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ipf/ip_state.c
          +++ new/usr/src/uts/common/inet/ipf/ip_state.c
↓ open down ↓ 1516 lines elided ↑ open up ↑
1517 1517          } else {
1518 1518                  MUTEX_EXIT(&is->is_lock);
1519 1519          }
1520 1520  #ifdef  IPFILTER_SYNC
1521 1521          if ((is->is_flags & IS_STATESYNC) && ((is->is_flags & SI_CLONE) == 0))
1522 1522                  is->is_sync = ipfsync_new(SMC_STATE, fin, is);
1523 1523  #endif
1524 1524          if (ifs->ifs_ipstate_logging)
1525 1525                  ipstate_log(is, ISL_NEW, ifs);
1526 1526  
     1527 +        if (IFS_CFWLOG(ifs))
     1528 +                ipf_log_cfwlog(is, ISL_NEW, ifs);
     1529 +
1527 1530          RWLOCK_EXIT(&ifs->ifs_ipf_state);
1528 1531          fin->fin_rev = IP6_NEQ(&is->is_dst, &fin->fin_daddr);
1529 1532          fin->fin_flx |= FI_STATE;
1530 1533          if (fin->fin_flx & FI_FRAG)
1531 1534                  (void) fr_newfrag(fin, pass ^ FR_KEEPSTATE);
1532 1535  
1533 1536          return is;
1534 1537  }
1535 1538  
1536 1539  
↓ open down ↓ 770 lines elided ↑ open up ↑
2307 2310                                  is->is_dend = ntohl(tcp->th_ack);
2308 2311                          } else {
2309 2312                                  is->is_dport = sp;
2310 2313                                  is->is_dend = ntohl(tcp->th_seq);
2311 2314                          }
2312 2315                          is->is_maxdend = is->is_dend + 1;
2313 2316                  }
2314 2317                  is->is_flags &= ~(SI_W_SPORT|SI_W_DPORT);
2315 2318                  if ((flags & SI_CLONED) && ifs->ifs_ipstate_logging)
2316 2319                          ipstate_log(is, ISL_CLONE, ifs);
     2320 +                if ((flags & SI_CLONED) && IFS_CFWLOG(ifs))
     2321 +                        ipf_log_cfwlog(is, ISL_CLONE, ifs);
2317 2322          }
2318 2323  
2319 2324          ret = -1;
2320 2325  
2321 2326          if (is->is_flx[out][rev] == 0) {
2322 2327                  is->is_flx[out][rev] = flx;
2323 2328                  /*
2324 2329                   * If we are dealing with the first packet coming in reverse
2325 2330                   * direction (sent by peer), then we have to set options into
2326 2331                   * state.
↓ open down ↓ 1063 lines elided ↑ open up ↑
3390 3395                  *is->is_pnext = is->is_next;
3391 3396                  if (is->is_next != NULL) {
3392 3397                          is->is_next->is_pnext = is->is_pnext;
3393 3398                          is->is_next = NULL;
3394 3399                  }
3395 3400                  is->is_pnext = NULL;
3396 3401          }
3397 3402   
3398 3403          if (ifs->ifs_ipstate_logging != 0 && why != 0)
3399 3404                  ipstate_log(is, why, ifs);
3400      -
     3405 +#if 0
     3406 +        /*
     3407 +         * For now, ipf_log_cfwlog() copes with all "why" values.
     3408 +         * strictly speaking, though, they all map to one event, which for
     3409 +         * now is not supported.
     3410 +         */
     3411 +        if (why != 0 && IFS_CFWLOG(ifs))
     3412 +                ipf_log_cfwlog(is, why, ifs);
     3413 +#endif
3401 3414          if (is->is_rule != NULL) {
3402 3415                  is->is_rule->fr_statecnt--;
3403 3416                  (void)fr_derefrule(&is->is_rule, ifs);
3404 3417          }
3405 3418  
3406 3419          MUTEX_DESTROY(&is->is_lock);
3407 3420          KFREE(is);
3408 3421          ifs->ifs_ips_num--;
3409 3422  
3410 3423          return (0);
↓ open down ↓ 513 lines elided ↑ open up ↑
3924 3937                   */
3925 3938                  DTRACE_PROBE1(state_done, int, nstate);
3926 3939  
3927 3940                  if ((tqe->tqe_flags & TQE_RULEBASED) == 0)
3928 3941                          fr_movequeue(tqe, tqe->tqe_ifq, tqtab + nstate, ifs);
3929 3942          }
3930 3943  
3931 3944          return rval;
3932 3945  }
3933 3946  
3934      -
3935 3947  /* ------------------------------------------------------------------------ */
3936 3948  /* Function:    ipstate_log                                                 */
3937 3949  /* Returns:     Nil                                                         */
3938 3950  /* Parameters:  is(I)   - pointer to state structure                        */
3939 3951  /*              type(I) - type of log entry to create                       */
3940 3952  /*                                                                          */
3941 3953  /* Creates a state table log entry using the state structure and type info. */
3942 3954  /* passed in.  Log packet/byte counts, source/destination address and other */
3943 3955  /* protocol specific information.                                           */
3944 3956  /* ------------------------------------------------------------------------ */
↓ open down ↓ 502 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX