9618
9619 /*
9620 * For the purposes of the (broken) packet shell use
9621 * of the level we make sure MIB2_TCP/MIB2_UDP can be used
9622 * to make TCP and UDP appear first in the list of mib items.
9623 * TBD: We could expand this and use it in netstat so that
9624 * the kernel doesn't have to produce large tables (connections,
9625 * routes, etc) when netstat only wants the statistics or a particular
9626 * table.
9627 */
9628 if (!(level == MIB2_TCP || level == MIB2_UDP)) {
9629 if ((mpctl = icmp_snmp_get(q, mpctl)) == NULL) {
9630 return (1);
9631 }
9632 }
9633
9634 if (level != MIB2_TCP) {
9635 if ((mpctl = udp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9636 return (1);
9637 }
9638 }
9639
9640 if (level != MIB2_UDP) {
9641 if ((mpctl = tcp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9642 return (1);
9643 }
9644 }
9645
9646 if ((mpctl = ip_snmp_get_mib2_ip_traffic_stats(q, mpctl,
9647 ipst, legacy_req)) == NULL) {
9648 return (1);
9649 }
9650
9651 if ((mpctl = ip_snmp_get_mib2_ip6(q, mpctl, ipst,
9652 legacy_req)) == NULL) {
9653 return (1);
9654 }
9655
9656 if ((mpctl = ip_snmp_get_mib2_icmp(q, mpctl, ipst)) == NULL) {
9657 return (1);
9658 }
9659
9660 if ((mpctl = ip_snmp_get_mib2_icmp6(q, mpctl, ipst)) == NULL) {
9661 return (1);
9662 }
9663
9664 if ((mpctl = ip_snmp_get_mib2_igmp(q, mpctl, ipst)) == NULL) {
9700 }
9701
9702 if ((mpctl = ip_snmp_get_mib2_multi_rtable(q, mpctl, ipst)) == NULL) {
9703 return (1);
9704 }
9705
9706 mpctl = ip_snmp_get_mib2_ip_route_media(q, mpctl, level, ipst);
9707 if (mpctl == NULL)
9708 return (1);
9709
9710 mpctl = ip_snmp_get_mib2_ip6_route_media(q, mpctl, level, ipst);
9711 if (mpctl == NULL)
9712 return (1);
9713
9714 if ((mpctl = sctp_snmp_get_mib2(q, mpctl, sctps)) == NULL) {
9715 return (1);
9716 }
9717 if ((mpctl = ip_snmp_get_mib2_ip_dce(q, mpctl, ipst)) == NULL) {
9718 return (1);
9719 }
9720 freemsg(mpctl);
9721 return (1);
9722 }
9723
9724 /* Get global (legacy) IPv4 statistics */
9725 static mblk_t *
9726 ip_snmp_get_mib2_ip(queue_t *q, mblk_t *mpctl, mib2_ipIfStatsEntry_t *ipmib,
9727 ip_stack_t *ipst, boolean_t legacy_req)
9728 {
9729 mib2_ip_t old_ip_mib;
9730 struct opthdr *optp;
9731 mblk_t *mp2ctl;
9732 mib2_ipAddrEntry_t mae;
9733
9734 /*
9735 * make a copy of the original message
9736 */
9737 mp2ctl = copymsg(mpctl);
9738
9739 /* fixed length IP structure... */
|
9618
9619 /*
9620 * For the purposes of the (broken) packet shell use
9621 * of the level we make sure MIB2_TCP/MIB2_UDP can be used
9622 * to make TCP and UDP appear first in the list of mib items.
9623 * TBD: We could expand this and use it in netstat so that
9624 * the kernel doesn't have to produce large tables (connections,
9625 * routes, etc) when netstat only wants the statistics or a particular
9626 * table.
9627 */
9628 if (!(level == MIB2_TCP || level == MIB2_UDP)) {
9629 if ((mpctl = icmp_snmp_get(q, mpctl)) == NULL) {
9630 return (1);
9631 }
9632 }
9633
9634 if (level != MIB2_TCP) {
9635 if ((mpctl = udp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9636 return (1);
9637 }
9638 if (level == MIB2_UDP) {
9639 goto done;
9640 }
9641 }
9642
9643 if (level != MIB2_UDP) {
9644 if ((mpctl = tcp_snmp_get(q, mpctl, legacy_req)) == NULL) {
9645 return (1);
9646 }
9647 if (level == MIB2_TCP) {
9648 goto done;
9649 }
9650 }
9651
9652 if ((mpctl = ip_snmp_get_mib2_ip_traffic_stats(q, mpctl,
9653 ipst, legacy_req)) == NULL) {
9654 return (1);
9655 }
9656
9657 if ((mpctl = ip_snmp_get_mib2_ip6(q, mpctl, ipst,
9658 legacy_req)) == NULL) {
9659 return (1);
9660 }
9661
9662 if ((mpctl = ip_snmp_get_mib2_icmp(q, mpctl, ipst)) == NULL) {
9663 return (1);
9664 }
9665
9666 if ((mpctl = ip_snmp_get_mib2_icmp6(q, mpctl, ipst)) == NULL) {
9667 return (1);
9668 }
9669
9670 if ((mpctl = ip_snmp_get_mib2_igmp(q, mpctl, ipst)) == NULL) {
9706 }
9707
9708 if ((mpctl = ip_snmp_get_mib2_multi_rtable(q, mpctl, ipst)) == NULL) {
9709 return (1);
9710 }
9711
9712 mpctl = ip_snmp_get_mib2_ip_route_media(q, mpctl, level, ipst);
9713 if (mpctl == NULL)
9714 return (1);
9715
9716 mpctl = ip_snmp_get_mib2_ip6_route_media(q, mpctl, level, ipst);
9717 if (mpctl == NULL)
9718 return (1);
9719
9720 if ((mpctl = sctp_snmp_get_mib2(q, mpctl, sctps)) == NULL) {
9721 return (1);
9722 }
9723 if ((mpctl = ip_snmp_get_mib2_ip_dce(q, mpctl, ipst)) == NULL) {
9724 return (1);
9725 }
9726 done:
9727 freemsg(mpctl);
9728 return (1);
9729 }
9730
9731 /* Get global (legacy) IPv4 statistics */
9732 static mblk_t *
9733 ip_snmp_get_mib2_ip(queue_t *q, mblk_t *mpctl, mib2_ipIfStatsEntry_t *ipmib,
9734 ip_stack_t *ipst, boolean_t legacy_req)
9735 {
9736 mib2_ip_t old_ip_mib;
9737 struct opthdr *optp;
9738 mblk_t *mp2ctl;
9739 mib2_ipAddrEntry_t mae;
9740
9741 /*
9742 * make a copy of the original message
9743 */
9744 mp2ctl = copymsg(mpctl);
9745
9746 /* fixed length IP structure... */
|