Print this page
OS-478 -- lint
OS-406
OS-327

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zoneadmd/vplat.c
          +++ new/usr/src/cmd/zoneadmd/vplat.c
↓ open down ↓ 3116 lines elided ↑ open up ↑
3117 3117  
3118 3118          for (i = 0, dllink = dllinks; i < dlnum; i++, dllink++) {
3119 3119                  char dlerr[DLADM_STRSIZE];
3120 3120  
3121 3121                  dlstatus = dladm_set_linkprop(dld_handle, *dllink,
3122 3122                      "protection", NULL, 0, DLADM_OPT_ACTIVE);
3123 3123                  if (dlstatus == DLADM_STATUS_NOTFOUND) {
3124 3124                          /* datalink does not belong to the GZ */
3125 3125                          continue;
3126 3126                  }
3127      -                if (dlstatus != DLADM_STATUS_OK) {
     3127 +                if (dlstatus != DLADM_STATUS_OK)
3128 3128                          zerror(zlogp, B_FALSE,
     3129 +                            "clear 'protection' link property: %s",
3129 3130                              dladm_status2str(dlstatus, dlerr));
3130      -                        free(dllinks);
3131      -                        return (-1);
3132      -                }
     3131 +
3133 3132                  dlstatus = dladm_set_linkprop(dld_handle, *dllink,
3134 3133                      "allowed-ips", NULL, 0, DLADM_OPT_ACTIVE);
3135      -                if (dlstatus != DLADM_STATUS_OK) {
     3134 +                if (dlstatus != DLADM_STATUS_OK)
3136 3135                          zerror(zlogp, B_FALSE,
     3136 +                            "clear 'allowed-ips' link property: %s",
3137 3137                              dladm_status2str(dlstatus, dlerr));
3138      -                        free(dllinks);
3139      -                        return (-1);
3140      -                }
3141 3138          }
3142 3139          free(dllinks);
3143 3140          return (0);
3144 3141  }
3145 3142  
3146 3143  static int
3147      -unconfigure_exclusive_network_interfaces(zlog_t *zlogp, zoneid_t zoneid)
3148      -{
3149      -        int dlnum = 0;
3150      -
3151      -        /*
3152      -         * The kernel shutdown callback for the dls module should have removed
3153      -         * all datalinks from this zone.  If any remain, then there's a
3154      -         * problem.
3155      -         */
3156      -        if (zone_list_datalink(zoneid, &dlnum, NULL) != 0) {
3157      -                zerror(zlogp, B_TRUE, "unable to list network interfaces");
3158      -                return (-1);
3159      -        }
3160      -        if (dlnum != 0) {
3161      -                zerror(zlogp, B_FALSE,
3162      -                    "datalinks remain in zone after shutdown");
3163      -                return (-1);
3164      -        }
3165      -        return (0);
3166      -}
3167      -
3168      -static int
3169 3144  tcp_abort_conn(zlog_t *zlogp, zoneid_t zoneid,
3170 3145      const struct sockaddr_storage *local, const struct sockaddr_storage *remote)
3171 3146  {
3172 3147          int fd;
3173 3148          struct strioctl ioc;
3174 3149          tcp_ioc_abort_conn_t conn;
3175 3150          int error;
3176 3151  
3177 3152          conn.ac_local = *local;
3178 3153          conn.ac_remote = *remote;
↓ open down ↓ 1972 lines elided ↑ open up ↑
5151 5126          }
5152 5127  
5153 5128          if ((zoneid = getzoneidbyname(kzone)) == ZONE_ID_UNDEFINED) {
5154 5129                  if (!bringup_failure_recovery)
5155 5130                          zerror(zlogp, B_TRUE, "unable to get zoneid");
5156 5131                  if (unmount_cmd)
5157 5132                          (void) lu_root_teardown(zlogp);
5158 5133                  goto error;
5159 5134          }
5160 5135  
5161      -        if (remove_datalink_pool(zlogp, zoneid) != 0) {
     5136 +        if (remove_datalink_pool(zlogp, zoneid) != 0)
5162 5137                  zerror(zlogp, B_FALSE, "unable clear datalink pool property");
5163      -                goto error;
5164      -        }
5165 5138  
5166      -        if (remove_datalink_protect(zlogp, zoneid) != 0) {
     5139 +        if (remove_datalink_protect(zlogp, zoneid) != 0)
5167 5140                  zerror(zlogp, B_FALSE,
5168 5141                      "unable clear datalink protect property");
5169      -                goto error;
5170      -        }
5171 5142  
5172 5143          /*
5173 5144           * The datalinks assigned to the zone will be removed from the NGZ as
5174 5145           * part of zone_shutdown() so that we need to remove protect/pool etc.
5175 5146           * before zone_shutdown(). Even if the shutdown itself fails, the zone
5176 5147           * will not be able to violate any constraints applied because the
5177 5148           * datalinks are no longer available to the zone.
5178 5149           */
5179 5150          if (zone_shutdown(zoneid) != 0) {
5180 5151                  zerror(zlogp, B_TRUE, "unable to shutdown zone");
↓ open down ↓ 51 lines elided ↑ open up ↑
5232 5203                  switch (iptype) {
5233 5204                  case ZS_SHARED:
5234 5205                          if (unconfigure_shared_network_interfaces(zlogp,
5235 5206                              zoneid) != 0) {
5236 5207                                  zerror(zlogp, B_FALSE, "unable to unconfigure "
5237 5208                                      "network interfaces in zone");
5238 5209                                  goto error;
5239 5210                          }
5240 5211                          break;
5241 5212                  case ZS_EXCLUSIVE:
5242      -                        if (unconfigure_exclusive_network_interfaces(zlogp,
5243      -                            zoneid) != 0) {
5244      -                                zerror(zlogp, B_FALSE, "unable to unconfigure "
5245      -                                    "network interfaces in zone");
5246      -                                goto error;
5247      -                        }
5248 5213                          status = dladm_zone_halt(dld_handle, zoneid);
5249 5214                          if (status != DLADM_STATUS_OK) {
5250 5215                                  zerror(zlogp, B_FALSE, "unable to notify "
5251 5216                                      "dlmgmtd of zone halt: %s",
5252 5217                                      dladm_status2str(status, errmsg));
5253 5218                          }
5254 5219                          break;
5255 5220                  }
5256 5221          }
5257 5222  
↓ open down ↓ 66 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX