Print this page
OS-406
OS-249

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdladm/common/libdlvnic.c
          +++ new/usr/src/lib/libdladm/common/libdlvnic.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright (c) 2011, Joyent Inc. All rights reserved.
  23   24   */
  24   25  
  25   26  #include <stdio.h>
  26   27  #include <sys/types.h>
  27   28  #include <sys/stat.h>
  28   29  #include <string.h>
  29   30  #include <fcntl.h>
  30   31  #include <unistd.h>
  31   32  #include <stropts.h>
  32   33  #include <stdlib.h>
↓ open down ↓ 499 lines elided ↑ open up ↑
 532  533          attr.va_vrid = vrid;
 533  534          attr.va_af = af;
 534  535          attr.va_force = (flags & DLADM_OPT_FORCE) != 0;
 535  536  
 536  537          status = i_dladm_vnic_create_sys(handle, &attr);
 537  538          if (status != DLADM_STATUS_OK)
 538  539                  goto done;
 539  540          vnic_created = B_TRUE;
 540  541  
 541  542          /* Save vnic configuration and its properties */
 542      -        if (!(flags & DLADM_OPT_PERSIST))
 543      -                goto done;
      543 +        if (flags & DLADM_OPT_PERSIST) {
      544 +                status = dladm_vnic_persist_conf(handle, name, &attr, class);
      545 +                if (status == DLADM_STATUS_OK)
      546 +                        conf_set = B_TRUE;
      547 +        }
 544  548  
 545      -        status = dladm_vnic_persist_conf(handle, name, &attr, class);
 546      -        if (status != DLADM_STATUS_OK)
 547      -                goto done;
 548      -        conf_set = B_TRUE;
      549 +done:
      550 +        if (status == DLADM_STATUS_OK && proplist != NULL) {
      551 +                uint32_t flg;
 549  552  
 550      -        if (proplist != NULL) {
      553 +                flg = (flags & DLADM_OPT_PERSIST) ?
      554 +                    DLADM_OPT_PERSIST : DLADM_OPT_ACTIVE;
      555 +
 551  556                  for (i = 0; i < proplist->al_count; i++) {
 552  557                          dladm_arg_info_t        *aip = &proplist->al_info[i];
 553  558  
      559 +                        if (strcmp(aip->ai_name, "zone") == 0 &&
      560 +                            flags & DLADM_OPT_TRANSIENT)
      561 +                                flg |= DLADM_OPT_TRANSIENT;
      562 +                        else
      563 +                                flg &= ~DLADM_OPT_TRANSIENT;
      564 +
 554  565                          status = dladm_set_linkprop(handle, vnic_id,
 555      -                            aip->ai_name, aip->ai_val, aip->ai_count,
 556      -                            DLADM_OPT_PERSIST);
      566 +                            aip->ai_name, aip->ai_val, aip->ai_count, flg);
 557  567                          if (status != DLADM_STATUS_OK)
 558  568                                  break;
 559  569                  }
 560  570          }
 561  571  
 562      -done:
 563  572          if (status != DLADM_STATUS_OK) {
 564  573                  if (conf_set)
 565  574                          (void) dladm_remove_conf(handle, vnic_id);
 566  575                  if (vnic_created)
 567  576                          (void) i_dladm_vnic_delete_sys(handle, vnic_id);
 568  577                  (void) dladm_destroy_datalink_id(handle, vnic_id, flags);
 569  578          } else {
 570  579                  if (vnic_id_out != NULL)
 571  580                          *vnic_id_out = vnic_id;
 572  581                  if (mac_slot != NULL)
↓ open down ↓ 243 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX