706 dlmgmt_table_unlock();
707 return (NULL);
708 }
709
710 static int
711 parse_linkprops(char *buf, dlmgmt_link_t *linkp)
712 {
713 boolean_t found_type = B_FALSE;
714 dladm_datatype_t type = DLADM_TYPE_STR;
715 int i, len;
716 char *curr;
717 char attr_name[MAXLINKATTRLEN];
718 size_t attr_buf_len = 0;
719 void *attr_buf = NULL;
720 boolean_t rename;
721
722 curr = buf;
723 len = strlen(buf);
724 attr_name[0] = '\0';
725 for (i = 0; i < len; i++) {
726 rename = B_FALSE;
727 char c = buf[i];
728 boolean_t match = (c == '=' ||
729 (c == ',' && !found_type) || c == ';');
730
731 /*
732 * Move to the next character if there is no match and
733 * if we have not reached the last character.
734 */
735 if (!match && i != len - 1)
736 continue;
737
738 if (match) {
739 /*
740 * NUL-terminate the string pointed to by 'curr'.
741 */
742 buf[i] = '\0';
743 if (*curr == '\0')
744 goto parse_fail;
745 }
746
747 if (attr_name[0] != '\0' && found_type) {
748 /*
749 * We get here after we have processed the "<prop>="
750 * pattern. The pattern we are now interested in is
|
706 dlmgmt_table_unlock();
707 return (NULL);
708 }
709
710 static int
711 parse_linkprops(char *buf, dlmgmt_link_t *linkp)
712 {
713 boolean_t found_type = B_FALSE;
714 dladm_datatype_t type = DLADM_TYPE_STR;
715 int i, len;
716 char *curr;
717 char attr_name[MAXLINKATTRLEN];
718 size_t attr_buf_len = 0;
719 void *attr_buf = NULL;
720 boolean_t rename;
721
722 curr = buf;
723 len = strlen(buf);
724 attr_name[0] = '\0';
725 for (i = 0; i < len; i++) {
726 char c = buf[i];
727 boolean_t match = (c == '=' ||
728 (c == ',' && !found_type) || c == ';');
729
730 rename = B_FALSE;
731 /*
732 * Move to the next character if there is no match and
733 * if we have not reached the last character.
734 */
735 if (!match && i != len - 1)
736 continue;
737
738 if (match) {
739 /*
740 * NUL-terminate the string pointed to by 'curr'.
741 */
742 buf[i] = '\0';
743 if (*curr == '\0')
744 goto parse_fail;
745 }
746
747 if (attr_name[0] != '\0' && found_type) {
748 /*
749 * We get here after we have processed the "<prop>="
750 * pattern. The pattern we are now interested in is
|