Lines Matching refs:gctx

270 static void	allocifctx(struct bootpc_globalcontext *gctx);
287 static int bootpc_call(struct bootpc_globalcontext *gctx,
294 struct bootpc_globalcontext *gctx, struct lwp *td);
298 struct bootpc_globalcontext *gctx);
300 static int bootpc_received(struct bootpc_globalcontext *gctx,
450 allocifctx(struct bootpc_globalcontext *gctx)
455 ifctx->xid = gctx->xid;
461 gctx->xid += 0x100;
462 STAILQ_INSERT_TAIL(&gctx->interfaces, ifctx, next);
496 bootpc_received(struct bootpc_globalcontext *gctx,
508 (void) bootpc_tag(&gctx->tmptag, &gctx->reply,
509 gctx->replylen,
513 if (gctx->tmptag.badopt != 0)
516 p = bootpc_tag(&gctx->tmptag, &gctx->reply,
517 gctx->replylen, TAG_DHCP_MSGTYPE);
545 (bootpc_tag(&gctx->tmptag, &ifctx->reply,
548 bootpc_tag(&gctx->tmptag, &gctx->reply,
549 gctx->replylen,
553 bcopy(&gctx->reply, &ifctx->reply, gctx->replylen);
554 ifctx->replylen = gctx->replylen;
572 p = bootpc_tag(&gctx->tmptag, &ifctx->reply,
574 if (p != NULL && gctx->tmptag.taglen == 4) {
582 ifctx->gotrootpath = (bootpc_tag(&gctx->tmptag, &ifctx->reply,
585 ifctx->gotgw = (bootpc_tag(&gctx->tmptag, &ifctx->reply,
588 ifctx->gotnetmask = (bootpc_tag(&gctx->tmptag, &ifctx->reply,
595 bootpc_call(struct bootpc_globalcontext *gctx, struct lwp *td)
675 STAILQ_FOREACH(ifctx, &gctx->interfaces, next) {
677 bootpc_tag(&gctx->tmptag, &ifctx->reply,
683 STAILQ_FOREACH(ifctx, &gctx->interfaces, next) {
788 aio.iov_base = (void *) &gctx->reply;
789 aio.iov_len = sizeof(gctx->reply);
796 auio.uio_resid = sizeof(gctx->reply);
802 gctx->secs = time_second - gctx->starttime;
803 STAILQ_FOREACH(ifctx, &gctx->interfaces, next) {
808 ifctx->call.secs = htons(gctx->secs);
814 len = sizeof(gctx->reply) - auio.uio_resid;
819 gctx->replylen = len;
822 if (gctx->reply.op != BOOTP_REPLY)
826 STAILQ_FOREACH(ifctx, &gctx->interfaces, next) {
827 if (gctx->reply.xid != ifctx->call.xid)
831 if (gctx->reply.hlen != ifctx->call.hlen)
835 if (bcmp(gctx->reply.chaddr,
844 s = bootpc_tag(&gctx->tmptag,
845 &gctx->reply,
846 gctx->replylen,
867 print_in_addr(gctx->reply.siaddr);
868 if (gctx->reply.giaddr.s_addr !=
871 print_in_addr(gctx->reply.giaddr);
873 if (bootpc_received(gctx, ifctx) != 0) {
886 gctx->any_root_overrides) {
897 if (gctx->secs > BOOTP_TIMEOUT && BOOTP_TIMEOUT > 0)
902 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
914 gctx->gotrootpath = gotrootpath;
925 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
933 if (gctx->gotrootpath != 0) {
941 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
1023 struct bootpc_globalcontext *gctx, struct lwp *td)
1422 struct bootpc_globalcontext *gctx)
1447 (void) bootpc_tag(&gctx->tmptag,
1450 if ((gctx->tmptag.overload & OVERLOAD_SNAME) == 0)
1453 if ((gctx->tmptag.overload & OVERLOAD_FILE) == 0)
1459 p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
1462 if (gctx->tag.taglen != 4)
1464 gctx->tag.taglen);
1472 p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
1476 if (gctx->tag.taglen % 4)
1477 panic("bootpc: Router Len is %d", gctx->tag.taglen);
1478 if (gctx->tag.taglen > 0) {
1484 gctx->gotgw = 1;
1503 p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
1515 if (gctx->setrootfs != NULL) {
1525 gctx->gotrootpath = 1;
1526 gctx->setrootfs = ifctx;
1528 p = bootpc_tag(&gctx->tag, &ifctx->reply,
1539 p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
1542 if (gctx->tag.taglen >= MAXHOSTNAMELEN)
1545 if (gctx->sethostname != NULL) {
1553 gctx->sethostname = ifctx;
1556 p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
1565 p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
1587 struct bootpc_globalcontext *gctx; /* Global BOOTP context */
1612 gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK | M_ZERO);
1613 STAILQ_INIT(&gctx->interfaces);
1614 gctx->xid = ~0xFFFF;
1615 gctx->starttime = time_second;
1623 gctx->any_root_overrides = 1;
1625 gctx->any_root_overrides = testenv("vfs.root.mountfrom");
1635 allocifctx(gctx);
1662 allocifctx(gctx);
1666 ifctx = STAILQ_FIRST(&gctx->interfaces);
1710 if (STAILQ_EMPTY(&gctx->interfaces) ||
1711 STAILQ_FIRST(&gctx->interfaces)->ifp == NULL) {
1730 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
1733 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
1736 error = bootpc_call(gctx, td);
1743 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
1745 bootpc_decode_reply(nd, ifctx, gctx);
1748 if (gctx->gotrootpath == 0 && gctx->any_root_overrides == 0)
1752 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
1753 bootpc_adjust_interface(ifctx, gctx, td);
1757 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
1761 STAILQ_FOREACH(ifctx, &gctx->interfaces, next)
1768 if (gctx->gotrootpath != 0) {
1778 if (gctx->any_root_overrides == 0)
1797 while((ifctx = STAILQ_FIRST(&gctx->interfaces)) != NULL) {
1798 STAILQ_REMOVE_HEAD(&gctx->interfaces, next);
1801 free(gctx, M_TEMP);