Print this page
%B


  87 #include <inet/ip_impl.h>
  88 #include <inet/sctp_ip.h>
  89 #include <inet/ip_netinfo.h>
  90 #include <inet/ilb_ip.h>
  91 
  92 #include <netinet/igmp.h>
  93 #include <inet/ip_listutils.h>
  94 #include <inet/ipclassifier.h>
  95 #include <sys/mac_client.h>
  96 #include <sys/dld.h>
  97 #include <sys/mac_flow.h>
  98 
  99 #include <sys/systeminfo.h>
 100 #include <sys/bootconf.h>
 101 
 102 #include <sys/tsol/tndb.h>
 103 #include <sys/tsol/tnet.h>
 104 
 105 #include <inet/rawip_impl.h> /* needed for icmp_stack_t */
 106 #include <inet/udp_impl.h> /* needed for udp_stack_t */

 107 
 108 /* The character which tells where the ill_name ends */
 109 #define IPIF_SEPARATOR_CHAR     ':'
 110 
 111 /* IP ioctl function table entry */
 112 typedef struct ipft_s {
 113         int     ipft_cmd;
 114         pfi_t   ipft_pfi;
 115         int     ipft_min_size;
 116         int     ipft_flags;
 117 } ipft_t;
 118 #define IPFT_F_NO_REPLY         0x1     /* IP ioctl does not expect any reply */
 119 #define IPFT_F_SELF_REPLY       0x2     /* ioctl callee does the ioctl reply */
 120 
 121 static int      nd_ill_forward_get(queue_t *, mblk_t *, caddr_t, cred_t *);
 122 static int      nd_ill_forward_set(queue_t *q, mblk_t *mp,
 123                     char *value, caddr_t cp, cred_t *ioc_cr);
 124 
 125 static boolean_t ill_is_quiescent(ill_t *);
 126 static boolean_t ip_addr_ok_v4(ipaddr_t addr, ipaddr_t subnet_mask);


8840         }
8841 
8842         return (B_TRUE);
8843 }
8844 
8845 /*
8846  * process the SIOC{SET|GET}PROP ioctl's
8847  */
8848 /* ARGSUSED */
8849 static void
8850 ip_sioctl_getsetprop(queue_t *q, mblk_t *mp)
8851 {
8852         struct iocblk   *iocp = (struct iocblk *)mp->b_rptr;
8853         mblk_t          *mp1 = mp->b_cont;
8854         mod_ioc_prop_t  *pioc;
8855         mod_prop_info_t *ptbl = NULL, *pinfo = NULL;
8856         ip_stack_t      *ipst;
8857         icmp_stack_t    *is;
8858         tcp_stack_t     *tcps;
8859         sctp_stack_t    *sctps;

8860         udp_stack_t     *us;
8861         netstack_t      *stack;
8862         void            *cbarg;
8863         cred_t          *cr;
8864         boolean_t       set;
8865         int             err;
8866 
8867         ASSERT(q->q_next == NULL);
8868         ASSERT(CONN_Q(q));
8869 
8870         if (!getset_ioctl_checks(mp)) {
8871                 miocnak(q, mp, 0, EINVAL);
8872                 return;
8873         }
8874         ipst = CONNQ_TO_IPST(q);
8875         stack = ipst->ips_netstack;
8876         pioc = (mod_ioc_prop_t *)mp1->b_rptr;
8877 
8878         switch (pioc->mpr_proto) {
8879         case MOD_PROTO_IP:


8885         case MOD_PROTO_RAWIP:
8886                 is = stack->netstack_icmp;
8887                 ptbl = is->is_propinfo_tbl;
8888                 cbarg = is;
8889                 break;
8890         case MOD_PROTO_TCP:
8891                 tcps = stack->netstack_tcp;
8892                 ptbl = tcps->tcps_propinfo_tbl;
8893                 cbarg = tcps;
8894                 break;
8895         case MOD_PROTO_UDP:
8896                 us = stack->netstack_udp;
8897                 ptbl = us->us_propinfo_tbl;
8898                 cbarg = us;
8899                 break;
8900         case MOD_PROTO_SCTP:
8901                 sctps = stack->netstack_sctp;
8902                 ptbl = sctps->sctps_propinfo_tbl;
8903                 cbarg = sctps;
8904                 break;




8905         default:
8906                 miocnak(q, mp, 0, EINVAL);
8907                 return;
8908         }
8909 
8910         /* search for given property in respective protocol propinfo table */
8911         for (pinfo = ptbl; pinfo->mpi_name != NULL; pinfo++) {
8912                 if (strcmp(pinfo->mpi_name, pioc->mpr_name) == 0 &&
8913                     pinfo->mpi_proto == pioc->mpr_proto)
8914                         break;
8915         }
8916         if (pinfo->mpi_name == NULL) {
8917                 miocnak(q, mp, 0, ENOENT);
8918                 return;
8919         }
8920 
8921         set = (iocp->ioc_cmd == SIOCSETPROP) ? B_TRUE : B_FALSE;
8922         if (set && pinfo->mpi_setf != NULL) {
8923                 cr = msg_getcred(mp, NULL);
8924                 if (cr == NULL)




  87 #include <inet/ip_impl.h>
  88 #include <inet/sctp_ip.h>
  89 #include <inet/ip_netinfo.h>
  90 #include <inet/ilb_ip.h>
  91 
  92 #include <netinet/igmp.h>
  93 #include <inet/ip_listutils.h>
  94 #include <inet/ipclassifier.h>
  95 #include <sys/mac_client.h>
  96 #include <sys/dld.h>
  97 #include <sys/mac_flow.h>
  98 
  99 #include <sys/systeminfo.h>
 100 #include <sys/bootconf.h>
 101 
 102 #include <sys/tsol/tndb.h>
 103 #include <sys/tsol/tnet.h>
 104 
 105 #include <inet/rawip_impl.h> /* needed for icmp_stack_t */
 106 #include <inet/udp_impl.h> /* needed for udp_stack_t */
 107 #include <inet/dccp/dccp_stack.h> /* needed for dccp_stack_t */
 108 
 109 /* The character which tells where the ill_name ends */
 110 #define IPIF_SEPARATOR_CHAR     ':'
 111 
 112 /* IP ioctl function table entry */
 113 typedef struct ipft_s {
 114         int     ipft_cmd;
 115         pfi_t   ipft_pfi;
 116         int     ipft_min_size;
 117         int     ipft_flags;
 118 } ipft_t;
 119 #define IPFT_F_NO_REPLY         0x1     /* IP ioctl does not expect any reply */
 120 #define IPFT_F_SELF_REPLY       0x2     /* ioctl callee does the ioctl reply */
 121 
 122 static int      nd_ill_forward_get(queue_t *, mblk_t *, caddr_t, cred_t *);
 123 static int      nd_ill_forward_set(queue_t *q, mblk_t *mp,
 124                     char *value, caddr_t cp, cred_t *ioc_cr);
 125 
 126 static boolean_t ill_is_quiescent(ill_t *);
 127 static boolean_t ip_addr_ok_v4(ipaddr_t addr, ipaddr_t subnet_mask);


8841         }
8842 
8843         return (B_TRUE);
8844 }
8845 
8846 /*
8847  * process the SIOC{SET|GET}PROP ioctl's
8848  */
8849 /* ARGSUSED */
8850 static void
8851 ip_sioctl_getsetprop(queue_t *q, mblk_t *mp)
8852 {
8853         struct iocblk   *iocp = (struct iocblk *)mp->b_rptr;
8854         mblk_t          *mp1 = mp->b_cont;
8855         mod_ioc_prop_t  *pioc;
8856         mod_prop_info_t *ptbl = NULL, *pinfo = NULL;
8857         ip_stack_t      *ipst;
8858         icmp_stack_t    *is;
8859         tcp_stack_t     *tcps;
8860         sctp_stack_t    *sctps;
8861         dccp_stack_t    *dccps;
8862         udp_stack_t     *us;
8863         netstack_t      *stack;
8864         void            *cbarg;
8865         cred_t          *cr;
8866         boolean_t       set;
8867         int             err;
8868 
8869         ASSERT(q->q_next == NULL);
8870         ASSERT(CONN_Q(q));
8871 
8872         if (!getset_ioctl_checks(mp)) {
8873                 miocnak(q, mp, 0, EINVAL);
8874                 return;
8875         }
8876         ipst = CONNQ_TO_IPST(q);
8877         stack = ipst->ips_netstack;
8878         pioc = (mod_ioc_prop_t *)mp1->b_rptr;
8879 
8880         switch (pioc->mpr_proto) {
8881         case MOD_PROTO_IP:


8887         case MOD_PROTO_RAWIP:
8888                 is = stack->netstack_icmp;
8889                 ptbl = is->is_propinfo_tbl;
8890                 cbarg = is;
8891                 break;
8892         case MOD_PROTO_TCP:
8893                 tcps = stack->netstack_tcp;
8894                 ptbl = tcps->tcps_propinfo_tbl;
8895                 cbarg = tcps;
8896                 break;
8897         case MOD_PROTO_UDP:
8898                 us = stack->netstack_udp;
8899                 ptbl = us->us_propinfo_tbl;
8900                 cbarg = us;
8901                 break;
8902         case MOD_PROTO_SCTP:
8903                 sctps = stack->netstack_sctp;
8904                 ptbl = sctps->sctps_propinfo_tbl;
8905                 cbarg = sctps;
8906                 break;
8907         case MOD_PROTO_DCCP:
8908                 dccps = stack->netstack_dccp;
8909                 ptbl = dccps->dccps_propinfo_tbl;
8910                 cbarg = dccps;
8911         default:
8912                 miocnak(q, mp, 0, EINVAL);
8913                 return;
8914         }
8915 
8916         /* search for given property in respective protocol propinfo table */
8917         for (pinfo = ptbl; pinfo->mpi_name != NULL; pinfo++) {
8918                 if (strcmp(pinfo->mpi_name, pioc->mpr_name) == 0 &&
8919                     pinfo->mpi_proto == pioc->mpr_proto)
8920                         break;
8921         }
8922         if (pinfo->mpi_name == NULL) {
8923                 miocnak(q, mp, 0, ENOENT);
8924                 return;
8925         }
8926 
8927         set = (iocp->ioc_cmd == SIOCSETPROP) ? B_TRUE : B_FALSE;
8928         if (set && pinfo->mpi_setf != NULL) {
8929                 cr = msg_getcred(mp, NULL);
8930                 if (cr == NULL)