Index: ip_dummynet.c =================================================================== --- ip_dummynet.c (revision 233234) +++ ip_dummynet.c (working copy) @@ -794,29 +794,33 @@ delete_schk(int i) static int copy_obj(char **start, char *end, void *_o, const char *msg, int i) { - struct dn_id *o = _o; + struct dn_id o; + struct dn_link l; + struct dn_schk s; int have = end - *start; - if (have < o->len || o->len == 0 || o->type == 0) { + bcopy(_o, &o, sizeof(o)); + if (have < o.len || o.len == 0 || o.type == 0) { D("(WARN) type %d %s %d have %d need %d", - o->type, msg, i, have, o->len); + o.type, msg, i, have, o.len); return 1; } - ND("type %d %s %d len %d", o->type, msg, i, o->len); - bcopy(_o, *start, o->len); - if (o->type == DN_LINK) { + ND("type %d %s %d len %d", o.type, msg, i, o.len); + if (o.type == DN_LINK) { + bcopy(_o, &l, sizeof(l)); /* Adjust burst parameter for link */ - struct dn_link *l = (struct dn_link *)*start; - l->burst = div64(l->burst, 8 * hz); - l->delay = l->delay * 1000 / hz; - } else if (o->type == DN_SCH) { - /* Set id->id to the number of instances */ - struct dn_schk *s = _o; - struct dn_id *id = (struct dn_id *)(*start); - id->id = (s->sch.flags & DN_HAVE_MASK) ? - dn_ht_entries(s->siht) : (s->siht ? 1 : 0); - } - *start += o->len; + l.burst = div64(l.burst, 8 * hz); + l.delay = l.delay * 1000 / hz; + bcopy(&l, *start, sizeof(l)); + } else if (o.type == DN_SCH) { + /* Set s.sch.oid.id to the number of instances */ + bcopy(_o, &s, sizeof(s)); + s.sch.oid.id = (s.sch.flags & DN_HAVE_MASK) ? + dn_ht_entries(s.siht) : (s.siht ? 1 : 0); + bcopy(&s, *start, sizeof(s)); + } else + bcopy(_o, *start, o.len); + *start += o.len; return 0; } @@ -1624,6 +1628,7 @@ dummynet_flush(void) int do_config(void *p, int l) { + struct dn_link link; struct dn_id *next, *o; int err = 0, err2 = 0; struct dn_id *arg = NULL; @@ -1704,7 +1709,8 @@ do_config(void *p, int l) arg = o; break; case DN_LINK: - err = config_link((struct dn_link *)o, arg); + bcopy(o, &link, sizeof(link)); + err = config_link(&link, arg); break; case DN_PROFILE: err = config_profile((struct dn_profile *)o, arg);