Print this page
dccp: starting module template

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ip/ip.c
          +++ new/usr/src/uts/common/inet/ip/ip.c
↓ open down ↓ 103 lines elided ↑ open up ↑
 104  104  
 105  105  #include <sys/ethernet.h>
 106  106  #include <net/if_types.h>
 107  107  #include <sys/cpuvar.h>
 108  108  
 109  109  #include <ipp/ipp.h>
 110  110  #include <ipp/ipp_impl.h>
 111  111  #include <ipp/ipgpc/ipgpc.h>
 112  112  
 113  113  #include <sys/pattr.h>
      114 +#include <inet/dccp.h>
      115 +#include <inet/dccp_impl.h>
      116 +#include <inet/dccp_ip.h>
 114  117  #include <inet/ipclassifier.h>
 115  118  #include <inet/sctp_ip.h>
 116  119  #include <inet/sctp/sctp_impl.h>
 117  120  #include <inet/udp_impl.h>
 118  121  #include <inet/rawip_impl.h>
 119  122  #include <inet/rts_impl.h>
 120  123  
 121  124  #include <sys/tsol/label.h>
 122  125  #include <sys/tsol/tnet.h>
 123  126  
↓ open down ↓ 1690 lines elided ↑ open up ↑
1814 1817          }
1815 1818          case IPPROTO_SCTP:
1816 1819                  /*
1817 1820                   * Verify we have at least ICMP_MIN_TP_HDR_LEN bytes of
1818 1821                   * transport header.
1819 1822                   */
1820 1823                  if ((uchar_t *)ipha + hdr_length + ICMP_MIN_TP_HDR_LEN >
1821 1824                      mp->b_wptr)
1822 1825                          goto truncated;
1823 1826                  break;
     1827 +        case IPPROTO_DCCP: {
     1828 +                dccpha_t        *dccpha;
     1829 +
     1830 +                /*
     1831 +                 * Verify we have at least ICMP_MIN_TP_HDR_LEN bytes of
     1832 +                 * transport header.
     1833 +                 */
     1834 +                if ((uchar_t *)ipha + hdr_length + ICMP_MIN_TP_HDR_LEN >
     1835 +                    mp->b_wptr)
     1836 +                        goto truncated;
     1837 +
     1838 +                cmn_err(CE_NOTE, "icmp_inbound_verify_v4");
     1839 +
     1840 +                dccpha = (dccpha_t *)((uchar_t *)ipha + hdr_length);
     1841 +                /* XXX:DCCP */
     1842 +/*
     1843 +                connp = ipcl_dccp_lookup_reversed_ipv4(ipha, dccpha,
     1844 +                    DCCPS_LISTEN, ipst);
     1845 +                if (connp == NULL) {
     1846 +                        goto discard_pkt;
     1847 +                }
     1848 +
     1849 +                if ((connp->conn_verifyicmp != NULL) &&
     1850 +                    !connp->conn_verifyicmp(connp, dccpha, icmph, NULL, ira)) {
     1851 +                        CONN_DEC_REF(connp);
     1852 +                        goto discard_pkt;
     1853 +                }
     1854 +
     1855 +                CONN_DEC_REF(connp);
     1856 +*/
     1857 +                break;
     1858 +        }
1824 1859          case IPPROTO_ESP:
1825 1860          case IPPROTO_AH:
1826 1861                  break;
1827 1862          case IPPROTO_ENCAP:
1828 1863                  if ((uchar_t *)ipha + hdr_length + sizeof (ipha_t) >
1829 1864                      mp->b_wptr)
1830 1865                          goto truncated;
1831 1866                  break;
1832 1867          default:
1833 1868                  break;
↓ open down ↓ 328 lines elided ↑ open up ↑
2162 2197                  up = (uint16_t *)((uchar_t *)ipha + hdr_length);
2163 2198                  /* Find a SCTP client stream for this packet. */
2164 2199                  ((uint16_t *)&ports)[0] = up[1];
2165 2200                  ((uint16_t *)&ports)[1] = up[0];
2166 2201  
2167 2202                  ira->ira_flags |= IRAF_ICMP_ERROR;
2168 2203                  ip_fanout_sctp(mp, &ripha, NULL, ports, ira);
2169 2204                  ira->ira_flags &= ~IRAF_ICMP_ERROR;
2170 2205                  return;
2171 2206  
     2207 +        case IPPROTO_DCCP:
     2208 +                cmn_err(CE_NOTE, "icmp_inbound_error_fanout_v4");
     2209 +                return;
     2210 +
2172 2211          case IPPROTO_ESP:
2173 2212          case IPPROTO_AH:
2174 2213                  if (!ipsec_loaded(ipss)) {
2175 2214                          ip_proto_not_sup(mp, ira);
2176 2215                          return;
2177 2216                  }
2178 2217  
2179 2218                  if (ipha->ipha_protocol == IPPROTO_ESP)
2180 2219                          mp = ipsecesp_icmp_error(mp, ira);
2181 2220                  else
↓ open down ↓ 2122 lines elided ↑ open up ↑
4304 4343          /* This needs to be called before destroying any transports. */
4305 4344          mutex_enter(&cpu_lock);
4306 4345          unregister_cpu_setup_func(ip_tp_cpu_update, NULL);
4307 4346          mutex_exit(&cpu_lock);
4308 4347  
4309 4348          tnet_fini();
4310 4349  
4311 4350          icmp_ddi_g_destroy();
4312 4351          rts_ddi_g_destroy();
4313 4352          udp_ddi_g_destroy();
     4353 +        dccp_ddi_g_destroy();
4314 4354          sctp_ddi_g_destroy();
4315 4355          tcp_ddi_g_destroy();
4316 4356          ilb_ddi_g_destroy();
4317 4357          dce_g_destroy();
4318 4358          ipsec_policy_g_destroy();
4319 4359          ipcl_g_destroy();
4320 4360          ip_net_g_destroy();
4321 4361          ip_ire_g_fini();
4322 4362          inet_minor_destroy(ip_minor_arena_sa);
4323 4363  #if defined(_LP64)
↓ open down ↓ 216 lines elided ↑ open up ↑
4540 4580  
4541 4581  #ifdef DEBUG
4542 4582          tsd_create(&ip_thread_data, ip_thread_exit);
4543 4583          rw_init(&ip_thread_rwlock, NULL, RW_DEFAULT, NULL);
4544 4584          list_create(&ip_thread_list, sizeof (th_hash_t),
4545 4585              offsetof(th_hash_t, thh_link));
4546 4586  #endif
4547 4587          ipsec_policy_g_init();
4548 4588          tcp_ddi_g_init();
4549 4589          sctp_ddi_g_init();
     4590 +        dccp_ddi_g_init();
4550 4591          dce_g_init();
4551 4592  
4552 4593          /*
4553 4594           * We want to be informed each time a stack is created or
4554 4595           * destroyed in the kernel, so we can maintain the
4555 4596           * set of udp_stack_t's.
4556 4597           */
4557 4598          netstack_register(NS_IP, ip_stack_init, ip_stack_shutdown,
4558 4599              ip_stack_fini);
4559 4600  
↓ open down ↓ 5117 lines elided ↑ open up ↑
9677 9718          if (mpctl == NULL)
9678 9719                  return (1);
9679 9720  
9680 9721          mpctl = ip_snmp_get_mib2_ip6_route_media(q, mpctl, level, ipst);
9681 9722          if (mpctl == NULL)
9682 9723                  return (1);
9683 9724  
9684 9725          if ((mpctl = sctp_snmp_get_mib2(q, mpctl, sctps)) == NULL) {
9685 9726                  return (1);
9686 9727          }
     9728 +
9687 9729          if ((mpctl = ip_snmp_get_mib2_ip_dce(q, mpctl, ipst)) == NULL) {
9688 9730                  return (1);
9689 9731          }
     9732 +
     9733 +        if ((mpctl = dccp_snmp_get(q, mpctl, legacy_req)) == NULL) {
     9734 +                return (1);
     9735 +        }
     9736 +
9690 9737          freemsg(mpctl);
9691 9738          return (1);
9692 9739  }
9693 9740  
9694 9741  /* Get global (legacy) IPv4 statistics */
9695 9742  static mblk_t *
9696 9743  ip_snmp_get_mib2_ip(queue_t *q, mblk_t *mpctl, mib2_ipIfStatsEntry_t *ipmib,
9697 9744      ip_stack_t *ipst, boolean_t legacy_req)
9698 9745  {
9699 9746          mib2_ip_t               old_ip_mib;
↓ open down ↓ 5530 lines elided ↑ open up ↑
15230 15277          ASSERT(MUTEX_HELD(&cpu_lock));
15231 15278  
15232 15279          switch (what) {
15233 15280          case CPU_CONFIG:
15234 15281          case CPU_ON:
15235 15282          case CPU_INIT:
15236 15283          case CPU_CPUPART_IN:
15237 15284                  cpu_seqid = cpu[id]->cpu_seqid;
15238 15285                  netstack_next_init(&nh);
15239 15286                  while ((ns = netstack_next(&nh)) != NULL) {
     15287 +                        dccp_stack_cpu_add(ns->netstack_dccp, cpu_seqid);
15240 15288                          tcp_stack_cpu_add(ns->netstack_tcp, cpu_seqid);
15241 15289                          sctp_stack_cpu_add(ns->netstack_sctp, cpu_seqid);
15242 15290                          udp_stack_cpu_add(ns->netstack_udp, cpu_seqid);
15243 15291                          netstack_rele(ns);
15244 15292                  }
15245 15293                  netstack_next_fini(&nh);
15246 15294                  break;
15247 15295          case CPU_UNCONFIG:
15248 15296          case CPU_OFF:
15249 15297          case CPU_CPUPART_OUT:
15250 15298                  /*
15251 15299                   * Nothing to do.  We don't remove the per CPU stats from
15252 15300                   * the IP stack even when the CPU goes offline.
15253 15301                   */
15254 15302                  break;
15255 15303          default:
15256 15304                  break;
15257 15305          }
15258 15306          return (0);
15259 15307  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX