View | Details | Raw Unified | Return to bug 189219
Collapse All | Expand All

(-)src/sys/netpfil/ipfw/ip_dummynet.c (-11 / +14 lines)
Lines 1210-1224 Link Here
1210
 * configure a link (and its FIFO instance)
1210
 * configure a link (and its FIFO instance)
1211
 */
1211
 */
1212
static int
1212
static int
1213
config_link(struct dn_link *p, struct dn_id *arg)
1213
config_link(struct dn_link *op, struct dn_id *arg)
1214
{
1214
{
1215
	struct dn_link np;
1215
	int i;
1216
	int i;
1216
1217
1217
	if (p->oid.len != sizeof(*p)) {
1218
	bcopy(&(op->oid.len), &(np.oid.len), sizeof(np.oid.len));
1218
		D("invalid pipe len %d", p->oid.len);
1219
	if (np.oid.len != sizeof(np)) {
1220
		D("invalid pipe len %d", np.oid.len);
1219
		return EINVAL;
1221
		return EINVAL;
1220
	}
1222
	}
1221
	i = p->link_nr;
1223
	bcopy(op, &np, sizeof(np));
1224
	i = np.link_nr;
1222
	if (i <= 0 || i >= DN_MAX_ID)
1225
	if (i <= 0 || i >= DN_MAX_ID)
1223
		return EINVAL;
1226
		return EINVAL;
1224
	/*
1227
	/*
Lines 1228-1236 Link Here
1228
	 * qsize = slots/bytes
1231
	 * qsize = slots/bytes
1229
	 * burst ???
1232
	 * burst ???
1230
	 */
1233
	 */
1231
	p->delay = (p->delay * hz) / 1000;
1234
	np.delay = (np.delay * hz) / 1000;
1232
	/* Scale burst size: bytes -> bits * hz */
1235
	/* Scale burst size: bytes -> bits * hz */
1233
	p->burst *= 8 * hz;
1236
	np.burst *= 8 * hz;
1234
1237
1235
	DN_BH_WLOCK();
1238
	DN_BH_WLOCK();
1236
	/* do it twice, base link and FIFO link */
1239
	/* do it twice, base link and FIFO link */
Lines 1247-1261 Link Here
1247
		s->profile = NULL;
1250
		s->profile = NULL;
1248
	    }
1251
	    }
1249
	    /* copy all parameters */
1252
	    /* copy all parameters */
1250
	    s->link.oid = p->oid;
1253
	    s->link.oid = np.oid;
1251
	    s->link.link_nr = i;
1254
	    s->link.link_nr = i;
1252
	    s->link.delay = p->delay;
1255
	    s->link.delay = np.delay;
1253
	    if (s->link.bandwidth != p->bandwidth) {
1256
	    if (s->link.bandwidth != np.bandwidth) {
1254
		/* XXX bandwidth changes, need to update red params */
1257
		/* XXX bandwidth changes, need to update red params */
1255
	    s->link.bandwidth = p->bandwidth;
1258
	    s->link.bandwidth = np.bandwidth;
1256
		update_red(s);
1259
		update_red(s);
1257
	    }
1260
	    }
1258
	    s->link.burst = p->burst;
1261
	    s->link.burst = np.burst;
1259
	    schk_reset_credit(s);
1262
	    schk_reset_credit(s);
1260
	}
1263
	}
1261
	dn_cfg.id++;
1264
	dn_cfg.id++;

Return to bug 189219