Print this page
dccp: ips_ipcl_dccp_fanout

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ip/ip_input.c
          +++ new/usr/src/uts/common/inet/ip/ip_input.c
↓ open down ↓ 108 lines elided ↑ open up ↑
 109  109  
 110  110  #include <ipp/ipp.h>
 111  111  #include <ipp/ipp_impl.h>
 112  112  #include <ipp/ipgpc/ipgpc.h>
 113  113  
 114  114  #include <sys/pattr.h>
 115  115  #include <inet/ipclassifier.h>
 116  116  #include <inet/sctp_ip.h>
 117  117  #include <inet/sctp/sctp_impl.h>
 118  118  #include <inet/udp_impl.h>
      119 +#include <inet/dccp_impl.h>
 119  120  #include <sys/sunddi.h>
 120  121  
 121  122  #include <sys/tsol/label.h>
 122  123  #include <sys/tsol/tnet.h>
 123  124  
 124  125  #include <sys/clock_impl.h>     /* For LBOLT_FASTPATH{,64} */
 125  126  
 126  127  #ifdef  DEBUG
 127  128  extern boolean_t skip_sctp_cksum;
 128  129  #endif
↓ open down ↓ 2253 lines elided ↑ open up ↑
2382 2383                  break;
2383 2384          case IPPROTO_SCTP:
2384 2385                  min_ulp_header_length = SCTP_COMMON_HDR_LENGTH;
2385 2386                  break;
2386 2387          case IPPROTO_UDP:
2387 2388                  min_ulp_header_length = UDPH_SIZE;
2388 2389                  break;
2389 2390          case IPPROTO_ICMP:
2390 2391                  min_ulp_header_length = ICMPH_SIZE;
2391 2392                  break;
     2393 +        case IPPROTO_DCCP:
     2394 +                min_ulp_header_length = DCCP_MIN_HEADER_LENGTH;
     2395 +                break;
2392 2396          default:
2393 2397                  min_ulp_header_length = 0;
2394 2398                  break;
2395 2399          }
2396 2400          /* Make sure we have the min ULP header length */
2397 2401          len = mp->b_wptr - rptr;
2398 2402          if (len < ip_hdr_length + min_ulp_header_length) {
2399 2403                  if (ira->ira_pktlen < ip_hdr_length + min_ulp_header_length) {
2400 2404                          BUMP_MIB(ill->ill_ip_mib, ipIfStatsInTruncatedPkts);
2401 2405                          ip_drop_input("ipIfStatsInTruncatedPkts", mp, ill);
↓ open down ↓ 305 lines elided ↑ open up ↑
2707 2711                  }
2708 2712                  /* Found a client; up it goes */
2709 2713                  IP_STAT(ipst, ip_udp_fannorm);
2710 2714                  BUMP_MIB(ill->ill_ip_mib, ipIfStatsHCInDelivers);
2711 2715                  ira->ira_ill = ira->ira_rill = NULL;
2712 2716                  (connp->conn_recv)(connp, mp, NULL, ira);
2713 2717                  CONN_DEC_REF(connp);
2714 2718                  ira->ira_ill = ill;
2715 2719                  ira->ira_rill = rill;
2716 2720                  return;
     2721 +        case IPPROTO_DCCP:
     2722 +                /* For DCCP, discard broadcast and multicast packets */
     2723 +                if (iraflags & IRAF_MULTIBROADCAST) {
     2724 +                        goto discard;
     2725 +                }
     2726 +
     2727 +                /* First mblk contains IP+DCCP headers per above check */
     2728 +                ASSERT(len >= ip_hdr_length + DCCP_MIN_HEADER_LENGTH);
     2729 +
     2730 +                /* Squeue hint */
     2731 +                if (ira->ira_sqp == NULL) {
     2732 +                        ira->ira_sqp = ip_squeue_get(ira->ira_ring);
     2733 +                }
     2734 +
     2735 +                connp = ipcl_classify_v4(mp, IPPROTO_DCCP, ip_hdr_length,
     2736 +                    ira, ipst);
     2737 +                if (connp == NULL) {
     2738 +                        cmn_err(CE_NOTE, "ip_input.c: ip_fanout_v4 connp not found");
     2739 +                        /* Send the reset packet */
     2740 +                        BUMP_MIB(ill->ill_ip_mib, ipIfStatsHCInDelivers);
     2741 +                        dccp_xmit_listeners_reset(mp, ira, ipst, NULL);
     2742 +                        return;
     2743 +                }
     2744 +
     2745 +                if (connp->conn_incoming_ifindex != 0 &&
     2746 +                    connp->conn_incoming_ifindex != ira->ira_ruifindex) {
     2747 +                        cmn_err(CE_NOTE, "ip_input.c: ip_fanout_v4 ifindex problem");
     2748 +                        /* Send the reset packet */
     2749 +                        BUMP_MIB(ill->ill_ip_mib, ipIfStatsHCInDelivers);
     2750 +                        dccp_xmit_listeners_reset(mp, ira, ipst, NULL);
     2751 +                        return;
     2752 +                }
     2753 +
     2754 +                if (CONN_INBOUND_POLICY_PRESENT(connp, ipss) ||
     2755 +                    (iraflags & IRAF_IPSEC_SECURE)) {
     2756 +                        mp = ipsec_check_inbound_policy(mp, connp,
     2757 +                            ipha, NULL, ira);
     2758 +                        if (mp == NULL) {
     2759 +                                BUMP_MIB(ill->ill_ip_mib, ipIfStatsInDiscards);
     2760 +                                /* Note that mp is NULL */
     2761 +                                ip_drop_input("ipIfStatsInDiscards", mp, ill);
     2762 +                                CONN_DEC_REF(connp);
     2763 +                                return;
     2764 +                        }
     2765 +                }
     2766 +
     2767 +                /* Found a client; up it goes */
     2768 +                BUMP_MIB(ill->ill_ip_mib, ipIfStatsHCInDelivers);
     2769 +                ira->ira_ill = ira->ira_rill = NULL;
     2770 +
     2771 +                /* XXX SOCK_RAW for DCCP? */
     2772 +
     2773 +                if (iraflags & IRAF_TARGET_SQP) {
     2774 +                        cmn_err(CE_NOTE, "IRAF_TARGET_SQP");
     2775 +                } else {
     2776 +                        SQUEUE_ENTER_ONE(connp->conn_sqp, mp, connp->conn_recv,
     2777 +                            connp, ira, ip_squeue_flag, SQTAG_IP_DCCP_INPUT);
     2778 +                }
     2779 +
     2780 +                ira->ira_ill = ill;
     2781 +                ira->ira_rill = rill;
     2782 +                return;
     2783 +
2717 2784          default:
2718 2785                  break;
2719 2786          }
2720 2787  
2721 2788          /*
2722 2789           * Clear hardware checksumming flag as it is currently only
2723 2790           * used by TCP and UDP.
2724 2791           */
2725 2792          DB_CKSUMFLAGS(mp) = 0;
2726 2793  
↓ open down ↓ 410 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX