78 #include <netinet/ip6.h>
79 #include <netinet/icmp6.h>
80 #include <netinet/sctp.h>
81
82 #include <inet/ip.h>
83 #include <inet/ip_impl.h>
84 #include <inet/ip6.h>
85 #include <inet/ip6_asp.h>
86 #include <inet/tcp.h>
87 #include <inet/tcp_impl.h>
88 #include <inet/ip_multi.h>
89 #include <inet/ip_if.h>
90 #include <inet/ip_ire.h>
91 #include <inet/ip_ftable.h>
92 #include <inet/ip_rts.h>
93 #include <inet/ip_ndp.h>
94 #include <inet/ip_listutils.h>
95 #include <netinet/igmp.h>
96 #include <netinet/ip_mroute.h>
97 #include <inet/ipp_common.h>
98
99 #include <net/pfkeyv2.h>
100 #include <inet/sadb.h>
101 #include <inet/ipsec_impl.h>
102 #include <inet/iptun/iptun_impl.h>
103 #include <inet/ipdrop.h>
104 #include <inet/ip_netinfo.h>
105 #include <inet/ilb_ip.h>
106
107 #include <sys/ethernet.h>
108 #include <net/if_types.h>
109 #include <sys/cpuvar.h>
110
111 #include <ipp/ipp.h>
112 #include <ipp/ipp_impl.h>
113 #include <ipp/ipgpc/ipgpc.h>
114
115 #include <sys/pattr.h>
116 #include <inet/ipclassifier.h>
117 #include <inet/sctp_ip.h>
4550 #if defined(_LP64)
4551 if ((ip_minor_arena_sa = inet_minor_create("ip_minor_arena_sa",
4552 INET_MIN_DEV + 2, MAXMIN32, KM_SLEEP)) == NULL) {
4553 cmn_err(CE_PANIC,
4554 "ip_ddi_init: ip_minor_arena_sa creation failed\n");
4555 }
4556 if ((ip_minor_arena_la = inet_minor_create("ip_minor_arena_la",
4557 MAXMIN32 + 1, MAXMIN64, KM_SLEEP)) == NULL) {
4558 cmn_err(CE_PANIC,
4559 "ip_ddi_init: ip_minor_arena_la creation failed\n");
4560 }
4561 #else
4562 if ((ip_minor_arena_sa = inet_minor_create("ip_minor_arena_sa",
4563 INET_MIN_DEV + 2, MAXMIN, KM_SLEEP)) == NULL) {
4564 cmn_err(CE_PANIC,
4565 "ip_ddi_init: ip_minor_arena_sa creation failed\n");
4566 }
4567 #endif
4568 ip_poll_normal_ticks = MSEC_TO_TICK_ROUNDUP(ip_poll_normal_ms);
4569
4570 ipcl_g_init();
4571 ip_ire_g_init();
4572 ip_net_g_init();
4573
4574 #ifdef DEBUG
4575 tsd_create(&ip_thread_data, ip_thread_exit);
4576 rw_init(&ip_thread_rwlock, NULL, RW_DEFAULT, NULL);
4577 list_create(&ip_thread_list, sizeof (th_hash_t),
4578 offsetof(th_hash_t, thh_link));
4579 #endif
4580 ipsec_policy_g_init();
4581 tcp_ddi_g_init();
4582 sctp_ddi_g_init();
4583 dce_g_init();
4584
4585 /*
4586 * We want to be informed each time a stack is created or
4587 * destroyed in the kernel, so we can maintain the
4588 * set of udp_stack_t's.
4589 */
9621
9622 /*
9623 * For the purposes of the (broken) packet shell use
9624 * of the level we make sure MIB2_TCP/MIB2_UDP can be used
9625 * to make TCP and UDP appear first in the list of mib items.
9626 * TBD: We could expand this and use it in netstat so that
9627 * the kernel doesn't have to produce large tables (connections,
9628 * routes, etc) when netstat only wants the statistics or a particular
9629 * table.
9630 */
9631 if (!(level == MIB2_TCP || level == MIB2_UDP)) {
9632 if ((mpctl = icmp_snmp_get(q, mpctl)) == NULL) {
9633 return (1);
9634 }
9635 }
9636
9637 if (level != MIB2_TCP) {
9638 if ((mpctl = udp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9639 return (1);
9640 }
9641 }
9642
9643 if (level != MIB2_UDP) {
9644 if ((mpctl = tcp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9645 return (1);
9646 }
9647 }
9648
9649 if ((mpctl = ip_snmp_get_mib2_ip_traffic_stats(q, mpctl,
9650 ipst, legacy_req)) == NULL) {
9651 return (1);
9652 }
9653
9654 if ((mpctl = ip_snmp_get_mib2_ip6(q, mpctl, ipst,
9655 legacy_req)) == NULL) {
9656 return (1);
9657 }
9658
9659 if ((mpctl = ip_snmp_get_mib2_icmp(q, mpctl, ipst)) == NULL) {
9660 return (1);
9661 }
9662
9663 if ((mpctl = ip_snmp_get_mib2_icmp6(q, mpctl, ipst)) == NULL) {
9664 return (1);
9665 }
9666
9667 if ((mpctl = ip_snmp_get_mib2_igmp(q, mpctl, ipst)) == NULL) {
9703 }
9704
9705 if ((mpctl = ip_snmp_get_mib2_multi_rtable(q, mpctl, ipst)) == NULL) {
9706 return (1);
9707 }
9708
9709 mpctl = ip_snmp_get_mib2_ip_route_media(q, mpctl, level, ipst);
9710 if (mpctl == NULL)
9711 return (1);
9712
9713 mpctl = ip_snmp_get_mib2_ip6_route_media(q, mpctl, level, ipst);
9714 if (mpctl == NULL)
9715 return (1);
9716
9717 if ((mpctl = sctp_snmp_get_mib2(q, mpctl, sctps)) == NULL) {
9718 return (1);
9719 }
9720 if ((mpctl = ip_snmp_get_mib2_ip_dce(q, mpctl, ipst)) == NULL) {
9721 return (1);
9722 }
9723 freemsg(mpctl);
9724 return (1);
9725 }
9726
9727 /* Get global (legacy) IPv4 statistics */
9728 static mblk_t *
9729 ip_snmp_get_mib2_ip(queue_t *q, mblk_t *mpctl, mib2_ipIfStatsEntry_t *ipmib,
9730 ip_stack_t *ipst, boolean_t legacy_req)
9731 {
9732 mib2_ip_t old_ip_mib;
9733 struct opthdr *optp;
9734 mblk_t *mp2ctl;
9735 mib2_ipAddrEntry_t mae;
9736
9737 /*
9738 * make a copy of the original message
9739 */
9740 mp2ctl = copymsg(mpctl);
9741
9742 /* fixed length IP structure... */
|
78 #include <netinet/ip6.h>
79 #include <netinet/icmp6.h>
80 #include <netinet/sctp.h>
81
82 #include <inet/ip.h>
83 #include <inet/ip_impl.h>
84 #include <inet/ip6.h>
85 #include <inet/ip6_asp.h>
86 #include <inet/tcp.h>
87 #include <inet/tcp_impl.h>
88 #include <inet/ip_multi.h>
89 #include <inet/ip_if.h>
90 #include <inet/ip_ire.h>
91 #include <inet/ip_ftable.h>
92 #include <inet/ip_rts.h>
93 #include <inet/ip_ndp.h>
94 #include <inet/ip_listutils.h>
95 #include <netinet/igmp.h>
96 #include <netinet/ip_mroute.h>
97 #include <inet/ipp_common.h>
98 #include <inet/cc.h>
99
100 #include <net/pfkeyv2.h>
101 #include <inet/sadb.h>
102 #include <inet/ipsec_impl.h>
103 #include <inet/iptun/iptun_impl.h>
104 #include <inet/ipdrop.h>
105 #include <inet/ip_netinfo.h>
106 #include <inet/ilb_ip.h>
107
108 #include <sys/ethernet.h>
109 #include <net/if_types.h>
110 #include <sys/cpuvar.h>
111
112 #include <ipp/ipp.h>
113 #include <ipp/ipp_impl.h>
114 #include <ipp/ipgpc/ipgpc.h>
115
116 #include <sys/pattr.h>
117 #include <inet/ipclassifier.h>
118 #include <inet/sctp_ip.h>
4551 #if defined(_LP64)
4552 if ((ip_minor_arena_sa = inet_minor_create("ip_minor_arena_sa",
4553 INET_MIN_DEV + 2, MAXMIN32, KM_SLEEP)) == NULL) {
4554 cmn_err(CE_PANIC,
4555 "ip_ddi_init: ip_minor_arena_sa creation failed\n");
4556 }
4557 if ((ip_minor_arena_la = inet_minor_create("ip_minor_arena_la",
4558 MAXMIN32 + 1, MAXMIN64, KM_SLEEP)) == NULL) {
4559 cmn_err(CE_PANIC,
4560 "ip_ddi_init: ip_minor_arena_la creation failed\n");
4561 }
4562 #else
4563 if ((ip_minor_arena_sa = inet_minor_create("ip_minor_arena_sa",
4564 INET_MIN_DEV + 2, MAXMIN, KM_SLEEP)) == NULL) {
4565 cmn_err(CE_PANIC,
4566 "ip_ddi_init: ip_minor_arena_sa creation failed\n");
4567 }
4568 #endif
4569 ip_poll_normal_ticks = MSEC_TO_TICK_ROUNDUP(ip_poll_normal_ms);
4570
4571 cc_init();
4572
4573 ipcl_g_init();
4574 ip_ire_g_init();
4575 ip_net_g_init();
4576
4577 #ifdef DEBUG
4578 tsd_create(&ip_thread_data, ip_thread_exit);
4579 rw_init(&ip_thread_rwlock, NULL, RW_DEFAULT, NULL);
4580 list_create(&ip_thread_list, sizeof (th_hash_t),
4581 offsetof(th_hash_t, thh_link));
4582 #endif
4583 ipsec_policy_g_init();
4584 tcp_ddi_g_init();
4585 sctp_ddi_g_init();
4586 dce_g_init();
4587
4588 /*
4589 * We want to be informed each time a stack is created or
4590 * destroyed in the kernel, so we can maintain the
4591 * set of udp_stack_t's.
4592 */
9624
9625 /*
9626 * For the purposes of the (broken) packet shell use
9627 * of the level we make sure MIB2_TCP/MIB2_UDP can be used
9628 * to make TCP and UDP appear first in the list of mib items.
9629 * TBD: We could expand this and use it in netstat so that
9630 * the kernel doesn't have to produce large tables (connections,
9631 * routes, etc) when netstat only wants the statistics or a particular
9632 * table.
9633 */
9634 if (!(level == MIB2_TCP || level == MIB2_UDP)) {
9635 if ((mpctl = icmp_snmp_get(q, mpctl)) == NULL) {
9636 return (1);
9637 }
9638 }
9639
9640 if (level != MIB2_TCP) {
9641 if ((mpctl = udp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9642 return (1);
9643 }
9644 if (level == MIB2_UDP) {
9645 goto done;
9646 }
9647 }
9648
9649 if (level != MIB2_UDP) {
9650 if ((mpctl = tcp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9651 return (1);
9652 }
9653 if (level == MIB2_TCP) {
9654 goto done;
9655 }
9656 }
9657
9658 if ((mpctl = ip_snmp_get_mib2_ip_traffic_stats(q, mpctl,
9659 ipst, legacy_req)) == NULL) {
9660 return (1);
9661 }
9662
9663 if ((mpctl = ip_snmp_get_mib2_ip6(q, mpctl, ipst,
9664 legacy_req)) == NULL) {
9665 return (1);
9666 }
9667
9668 if ((mpctl = ip_snmp_get_mib2_icmp(q, mpctl, ipst)) == NULL) {
9669 return (1);
9670 }
9671
9672 if ((mpctl = ip_snmp_get_mib2_icmp6(q, mpctl, ipst)) == NULL) {
9673 return (1);
9674 }
9675
9676 if ((mpctl = ip_snmp_get_mib2_igmp(q, mpctl, ipst)) == NULL) {
9712 }
9713
9714 if ((mpctl = ip_snmp_get_mib2_multi_rtable(q, mpctl, ipst)) == NULL) {
9715 return (1);
9716 }
9717
9718 mpctl = ip_snmp_get_mib2_ip_route_media(q, mpctl, level, ipst);
9719 if (mpctl == NULL)
9720 return (1);
9721
9722 mpctl = ip_snmp_get_mib2_ip6_route_media(q, mpctl, level, ipst);
9723 if (mpctl == NULL)
9724 return (1);
9725
9726 if ((mpctl = sctp_snmp_get_mib2(q, mpctl, sctps)) == NULL) {
9727 return (1);
9728 }
9729 if ((mpctl = ip_snmp_get_mib2_ip_dce(q, mpctl, ipst)) == NULL) {
9730 return (1);
9731 }
9732 done:
9733 freemsg(mpctl);
9734 return (1);
9735 }
9736
9737 /* Get global (legacy) IPv4 statistics */
9738 static mblk_t *
9739 ip_snmp_get_mib2_ip(queue_t *q, mblk_t *mpctl, mib2_ipIfStatsEntry_t *ipmib,
9740 ip_stack_t *ipst, boolean_t legacy_req)
9741 {
9742 mib2_ip_t old_ip_mib;
9743 struct opthdr *optp;
9744 mblk_t *mp2ctl;
9745 mib2_ipAddrEntry_t mae;
9746
9747 /*
9748 * make a copy of the original message
9749 */
9750 mp2ctl = copymsg(mpctl);
9751
9752 /* fixed length IP structure... */
|