Changeset View
Changeset View
Standalone View
Standalone View
sys/nfs/bootp_subr.c
Show First 20 Lines • Show All 648 Lines • ▼ Show 20 Lines | STAILQ_FOREACH(ifctx, &gctx->interfaces, next) { | ||||
error = sosend(bootp_so, (struct sockaddr *) &dst, | error = sosend(bootp_so, (struct sockaddr *) &dst, | ||||
&auio, NULL, NULL, 0, td); | &auio, NULL, NULL, 0, td); | ||||
if (error != 0) | if (error != 0) | ||||
printf("%s: sosend: %d state %08x\n", __func__, | printf("%s: sosend: %d state %08x\n", __func__, | ||||
error, (int )bootp_so->so_state); | error, (int )bootp_so->so_state); | ||||
/* Set netmask to 255.0.0.0 */ | /* Set netmask to 255.0.0.0 */ | ||||
sin->sin_addr.s_addr = htonl(IN_CLASSA_NET); | sin->sin_addr.s_addr = htonl(0xff000000); | ||||
imp: Why is 0xff000000 right here? I know it is historical behavior, but what is its root? Does it… | |||||
Done Inline ActionsI don't know why this value is used. It may deserve a comment, but I wouldn't know what to say. karels: I don't know why this value is used. It may deserve a comment, but I wouldn't know what to say. | |||||
error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, | error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, | ||||
td); | td); | ||||
if (error != 0) | if (error != 0) | ||||
panic("%s: SIOCAIFADDR, error=%d", __func__, | panic("%s: SIOCAIFADDR, error=%d", __func__, | ||||
error); | error); | ||||
} | } | ||||
if (outstanding == 0 && | if (outstanding == 0 && | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct thread *td) | ||||
* Do enough of ifconfig(8) so that the chosen interface | * Do enough of ifconfig(8) so that the chosen interface | ||||
* can talk to the servers. Set address to 0.0.0.0/8 and | * can talk to the servers. Set address to 0.0.0.0/8 and | ||||
* broadcast address to local broadcast. | * broadcast address to local broadcast. | ||||
*/ | */ | ||||
sin = (struct sockaddr_in *)&ifra->ifra_addr; | sin = (struct sockaddr_in *)&ifra->ifra_addr; | ||||
clear_sinaddr(sin); | clear_sinaddr(sin); | ||||
sin = (struct sockaddr_in *)&ifra->ifra_mask; | sin = (struct sockaddr_in *)&ifra->ifra_mask; | ||||
clear_sinaddr(sin); | clear_sinaddr(sin); | ||||
sin->sin_addr.s_addr = htonl(IN_CLASSA_NET); | sin->sin_addr.s_addr = htonl(0xff000000); | ||||
sin = (struct sockaddr_in *)&ifra->ifra_broadaddr; | sin = (struct sockaddr_in *)&ifra->ifra_broadaddr; | ||||
clear_sinaddr(sin); | clear_sinaddr(sin); | ||||
sin->sin_addr.s_addr = htonl(INADDR_BROADCAST); | sin->sin_addr.s_addr = htonl(INADDR_BROADCAST); | ||||
error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td); | error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td); | ||||
if (error != 0) | if (error != 0) | ||||
panic("%s: SIOCAIFADDR, error=%d", __func__, error); | panic("%s: SIOCAIFADDR, error=%d", __func__, error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 586 Lines • ▼ Show 20 Lines | p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, | ||||
TAG_INTF_MTU); | TAG_INTF_MTU); | ||||
if (p != NULL) { | if (p != NULL) { | ||||
ifctx->mtu = be16dec(p); | ifctx->mtu = be16dec(p); | ||||
} | } | ||||
printf("\n"); | printf("\n"); | ||||
if (ifctx->gotnetmask == 0) { | if (ifctx->gotnetmask == 0) { | ||||
if (IN_CLASSA(ntohl(ifctx->myaddr.sin_addr.s_addr))) | /* | ||||
ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSA_NET); | * If there is no netmask, use a default, but we really | ||||
else if (IN_CLASSB(ntohl(ifctx->myaddr.sin_addr.s_addr))) | * need the right mask from the server. | ||||
ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSB_NET); | */ | ||||
else | printf("%s: no netmask received!\n", ifctx->ireq.ifr_name); | ||||
ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSC_NET); | ifctx->netmask.sin_addr.s_addr = htonl(IN_NETMASK_DEFAULT); | ||||
} | } | ||||
} | } | ||||
void | void | ||||
bootpc_init(void) | bootpc_init(void) | ||||
{ | { | ||||
struct bootpc_ifcontext *ifctx; /* Interface BOOTP contexts */ | struct bootpc_ifcontext *ifctx; /* Interface BOOTP contexts */ | ||||
struct bootpc_globalcontext *gctx; /* Global BOOTP context */ | struct bootpc_globalcontext *gctx; /* Global BOOTP context */ | ||||
▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines |
Why is 0xff000000 right here? I know it is historical behavior, but what is its root? Does it deserve a comment?