149 {
150 int rval, fd;
151 ipd_stathdl_t hdl;
152 ipd_config_t *icp;
153
154 if (argc != 0)
155 return (usage(stderr));
156
157 fd = ipd_open(NULL);
158 rval = ipd_status_read(fd, &hdl);
159 (void) ipd_close(fd);
160 if (rval != 0) {
161 (void) fprintf(stderr, "%s: failed to get info: %s\n",
162 g_pname, ipd_errmsg);
163 return (E_ERROR);
164 }
165
166 if (ipd_status_get_config(hdl, g_zid, &icp) != 0) {
167 if (ipd_errno == EIPD_ZC_NOENT) {
168 (void) printf("zone %s does not exist or has no "
169 "ipd actions enabled", g_zonename);
170 return (E_SUCCESS);
171 }
172 (void) fprintf(stderr, "%s: failed to get info: %s\n",
173 g_pname, ipd_errmsg);
174 return (E_ERROR);
175 }
176
177 (void) printf("ipd information for zone %s:\n",
178 g_zonename);
179 (void) printf("\tcorrupt:\t%u%% chance of packet corruption\n",
180 icp->ic_corrupt);
181 (void) printf("\tdrop:\t\t%u%% chance of packet drop\n",
182 icp->ic_drop);
183 (void) printf("\tdelay:\t\t%u microsecond delay per packet\n",
184 icp->ic_delay);
185
186 ipd_status_free(hdl);
187
188 return (E_SUCCESS);
189 }
|
149 {
150 int rval, fd;
151 ipd_stathdl_t hdl;
152 ipd_config_t *icp;
153
154 if (argc != 0)
155 return (usage(stderr));
156
157 fd = ipd_open(NULL);
158 rval = ipd_status_read(fd, &hdl);
159 (void) ipd_close(fd);
160 if (rval != 0) {
161 (void) fprintf(stderr, "%s: failed to get info: %s\n",
162 g_pname, ipd_errmsg);
163 return (E_ERROR);
164 }
165
166 if (ipd_status_get_config(hdl, g_zid, &icp) != 0) {
167 if (ipd_errno == EIPD_ZC_NOENT) {
168 (void) printf("zone %s does not exist or has no "
169 "ipd actions enabled\n", g_zonename);
170 return (E_SUCCESS);
171 }
172 (void) fprintf(stderr, "%s: failed to get info: %s\n",
173 g_pname, ipd_errmsg);
174 return (E_ERROR);
175 }
176
177 (void) printf("ipd information for zone %s:\n",
178 g_zonename);
179 (void) printf("\tcorrupt:\t%u%% chance of packet corruption\n",
180 icp->ic_corrupt);
181 (void) printf("\tdrop:\t\t%u%% chance of packet drop\n",
182 icp->ic_drop);
183 (void) printf("\tdelay:\t\t%u microsecond delay per packet\n",
184 icp->ic_delay);
185
186 ipd_status_free(hdl);
187
188 return (E_SUCCESS);
189 }
|