Print this page
dccp: properties


 616 {
 617         show_prop_state_t       *statep = arg;
 618 
 619         statep->sps_pname = pname;
 620         statep->sps_proto = proto;
 621         statep->sps_status = IPADM_SUCCESS;
 622         ofmt_print(statep->sps_ofmt, arg);
 623 
 624         /*
 625          * if an object is not found or operation is not supported then
 626          * stop the walker.
 627          */
 628         if (statep->sps_status == IPADM_NOTFOUND ||
 629             statep->sps_status == IPADM_NOTSUP)
 630                 return (_B_FALSE);
 631         return (_B_TRUE);
 632 }
 633 
 634 /*
 635  * Properties to be displayed is in `statep->sps_proplist'. If it is NULL,
 636  * for all the properties for the specified object, relavant information, will
 637  * be displayed. Otherwise, for the selected property set, display relevant
 638  * information
 639  */
 640 static void
 641 show_properties(void *arg, int prop_class)
 642 {
 643         show_prop_state_t       *statep = arg;
 644         nvlist_t                *nvl = statep->sps_proplist;
 645         uint_t                  proto = statep->sps_proto;
 646         nvpair_t                *curr_nvp;
 647         char                    *buf, *name;
 648         ipadm_status_t          status;
 649 
 650         /* allocate sufficient buffer to hold a property value */
 651         if ((buf = malloc(MAXPROPVALLEN)) == NULL)
 652                 die("insufficient memory");
 653         statep->sps_propval = buf;
 654 
 655         /* if no properties were specified, display all the properties */
 656         if (nvl == NULL) {


 838                 else
 839                         die("set-ifprop: %s: %s",
 840                             prop_name, ipadm_status2str(status));
 841         }
 842 }
 843 
 844 static void
 845 do_set_ifprop(int argc, char **argv, const char *use)
 846 {
 847         set_ifprop(argc, argv, _B_FALSE, use);
 848 }
 849 
 850 static void
 851 do_reset_ifprop(int argc, char **argv, const char *use)
 852 {
 853         set_ifprop(argc, argv, _B_TRUE, use);
 854 }
 855 
 856 /*
 857  * Display information for all or specific protocol properties, either for a
 858  * given protocol or for supported protocols (IP/IPv4/IPv6/TCP/UDP/SCTP)
 859  */
 860 static void
 861 do_show_prop(int argc, char **argv, const char *use)
 862 {
 863         char                    option;
 864         nvlist_t                *proplist = NULL;
 865         char                    *fields_str = NULL;
 866         char                    *protostr;
 867         show_prop_state_t       state;
 868         ofmt_handle_t           ofmt;
 869         ofmt_status_t           oferr;
 870         uint_t                  ofmtflags = 0;
 871         uint_t                  proto;
 872         boolean_t               p_arg = _B_FALSE;
 873 
 874         opterr = 0;
 875         bzero(&state, sizeof (state));
 876         state.sps_propval = NULL;
 877         state.sps_parsable = _B_FALSE;
 878         state.sps_modprop = _B_TRUE;




 616 {
 617         show_prop_state_t       *statep = arg;
 618 
 619         statep->sps_pname = pname;
 620         statep->sps_proto = proto;
 621         statep->sps_status = IPADM_SUCCESS;
 622         ofmt_print(statep->sps_ofmt, arg);
 623 
 624         /*
 625          * if an object is not found or operation is not supported then
 626          * stop the walker.
 627          */
 628         if (statep->sps_status == IPADM_NOTFOUND ||
 629             statep->sps_status == IPADM_NOTSUP)
 630                 return (_B_FALSE);
 631         return (_B_TRUE);
 632 }
 633 
 634 /*
 635  * Properties to be displayed is in `statep->sps_proplist'. If it is NULL,
 636  * for all the properties for the specified object, relevant information, will
 637  * be displayed. Otherwise, for the selected property set, display relevant
 638  * information
 639  */
 640 static void
 641 show_properties(void *arg, int prop_class)
 642 {
 643         show_prop_state_t       *statep = arg;
 644         nvlist_t                *nvl = statep->sps_proplist;
 645         uint_t                  proto = statep->sps_proto;
 646         nvpair_t                *curr_nvp;
 647         char                    *buf, *name;
 648         ipadm_status_t          status;
 649 
 650         /* allocate sufficient buffer to hold a property value */
 651         if ((buf = malloc(MAXPROPVALLEN)) == NULL)
 652                 die("insufficient memory");
 653         statep->sps_propval = buf;
 654 
 655         /* if no properties were specified, display all the properties */
 656         if (nvl == NULL) {


 838                 else
 839                         die("set-ifprop: %s: %s",
 840                             prop_name, ipadm_status2str(status));
 841         }
 842 }
 843 
 844 static void
 845 do_set_ifprop(int argc, char **argv, const char *use)
 846 {
 847         set_ifprop(argc, argv, _B_FALSE, use);
 848 }
 849 
 850 static void
 851 do_reset_ifprop(int argc, char **argv, const char *use)
 852 {
 853         set_ifprop(argc, argv, _B_TRUE, use);
 854 }
 855 
 856 /*
 857  * Display information for all or specific protocol properties, either for a
 858  * given protocol or for supported protocols (IP/IPv4/IPv6/TCP/UDP/SCTP/DCCP)
 859  */
 860 static void
 861 do_show_prop(int argc, char **argv, const char *use)
 862 {
 863         char                    option;
 864         nvlist_t                *proplist = NULL;
 865         char                    *fields_str = NULL;
 866         char                    *protostr;
 867         show_prop_state_t       state;
 868         ofmt_handle_t           ofmt;
 869         ofmt_status_t           oferr;
 870         uint_t                  ofmtflags = 0;
 871         uint_t                  proto;
 872         boolean_t               p_arg = _B_FALSE;
 873 
 874         opterr = 0;
 875         bzero(&state, sizeof (state));
 876         state.sps_propval = NULL;
 877         state.sps_parsable = _B_FALSE;
 878         state.sps_modprop = _B_TRUE;