DF-0802 / fix.diff
diff --git a/sys/vfs/nfs/bootp_subr.c b/sys/vfs/nfs/bootp_subr.c --- a/sys/vfs/nfs/bootp_subr.c +++ b/sys/vfs/nfs/bootp_subr.c @@ -1386,23 +1386,26 @@ p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, TAG_SUBNETMASK); if (p != NULL) { - if (gctx->tag.taglen != 4) - panic("bootpc: subnet mask len is %d", + if (gctx->tag.taglen != 4) { + kprintf("bootpc: bad subnet mask len %d (ignored)\n", gctx->tag.taglen); - bcopy(p, &ifctx->netmask.sin_addr, 4); - ifctx->gotnetmask = 1; - kprintf("subnet mask "); - print_sin_addr(&ifctx->netmask); - kprintf(" "); + } else { + bcopy(p, &ifctx->netmask.sin_addr, 4); + ifctx->gotnetmask = 1; + kprintf("subnet mask "); + print_sin_addr(&ifctx->netmask); + kprintf(" "); + } } p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, TAG_ROUTERS); if (p != NULL) { /* Routers */ - if (gctx->tag.taglen % 4) - panic("bootpc: Router Len is %d", gctx->tag.taglen); - if (gctx->tag.taglen > 0) { + if (gctx->tag.taglen % 4) { + kprintf("bootpc: bad router len %d (ignored)\n", + gctx->tag.taglen); + } else if (gctx->tag.taglen > 0) { bcopy(p, &ifctx->gw.sin_addr, 4); kprintf("router "); print_sin_addr(&ifctx->gw); @@ -1432,7 +1435,7 @@ kprintf("rootopts %s ", p); } } else - panic("Failed to set rootfs to %s",p); + kprintf("bootpc: invalid rootfs '%s' (ignored)\n", p); } p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, @@ -1459,28 +1462,28 @@ ifctx->replylen, TAG_SWAPSIZE); if (p != NULL) { - int swaplen; - if (gctx->tag.taglen != 4) - panic("bootpc: " - "Expected 4 bytes for swaplen, " - "not %d bytes", - gctx->tag.taglen); - bcopy(p, &swaplen, 4); - nd->swap_nblks = ntohl(swaplen); - kprintf("swapsize %d KB ", - nd->swap_nblks); + if (gctx->tag.taglen != 4) { + kprintf("bootpc: bad swapsize len %d " + "(ignored)\n", gctx->tag.taglen); + } else { + int swaplen; + bcopy(p, &swaplen, 4); + nd->swap_nblks = ntohl(swaplen); + kprintf("swapsize %d KB ", + nd->swap_nblks); + } } } else - panic("Failed to set swapfs to %s", p); + kprintf("bootpc: invalid swapfs '%s' (ignored)\n", p); } p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, TAG_HOSTNAME); if (p != NULL) { - if (gctx->tag.taglen >= MAXHOSTNAMELEN) - panic("bootpc: hostname >= %d bytes", - MAXHOSTNAMELEN); - if (gctx->sethostname != NULL) { + if (gctx->tag.taglen >= MAXHOSTNAMELEN) { + kprintf("bootpc: hostname too long (%d, ignored)\n", + gctx->tag.taglen); + } else if (gctx->sethostname != NULL) { kprintf("hostname %s (ignored) ", p); } else { strcpy(nd->my_hostnam, p); |