All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 19ddf571 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Some PXE related stuff.

parent 37d79f28
INSTALL_BINDIR = /usr/testbed/bin
INSTALL = /usr/bin/install -c
INCS = -I//n/moab/z/stoller/oskit-debug/install/include/oskit/boot
all: proxydhcp bootinfo
proxydhcp: proxydhcp.c
cc $(CFLAGS) -o proxydhcp proxydhcp.c $(LFLAGS)
bootinfo: bootinfo.c
cc $(CFLAGS) $(INCS) -o bootinfo bootinfo.c $(LFLAGS)
install: all
-mkdir $(INSTALL_BINDIR)/pxe
$(INSTALL) proxydhcp $(INSTALL_BINDIR)/pxe
$(INSTALL) -m 444 proxydhcp.conf $(INSTALL_BINDIR)/pxe
$(INSTALL) -m 755 proxydhcp.restart $(INSTALL_BINDIR)/pxe
$(INSTALL) bootinfo $(INSTALL_BINDIR)/pxe
$(INSTALL) -m 755 bootinfo.restart $(INSTALL_BINDIR)/pxe
rm proxydhcp bootinfo
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include "bootwhat.h"
* For now, hardwired.
#define NETBOOT "/tftpboot/netboot"
int sock, length, data, i, mlen;
struct sockaddr_in name, client;
boot_info_t boot_info;
boot_what_t *boot_whatp = (boot_what_t *) &;
/* Create socket from which to read. */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
perror("opening datagram socket");
/* Create name. */
name.sin_family = AF_INET;
name.sin_addr.s_addr = INADDR_ANY;
name.sin_port = htons(BOOTWHAT_DSTPORT);
if (bind(sock, (struct sockaddr *) &name, sizeof(name))) {
perror("binding datagram socket");
/* Find assigned port value and print it out. */
length = sizeof(name);
if (getsockname(sock, (struct sockaddr *) &name, &length)) {
perror("getting socket name");
printf("Socket has port #%d\n", ntohs(name.sin_port));
while (1) {
if ((mlen = recvfrom(sock, &boot_info, sizeof(boot_info),
0, (struct sockaddr *)&client, &length))
< 0) {
perror("receiving datagram packet");
printf("Datagram of %d bytes received from %s\n",
mlen, inet_ntoa(client.sin_addr));
if (boot_info.opcode != BIOPCODE_BOOTWHAT_REQUEST) {
printf("Throwing away invalid packet\n");
boot_info.opcode = BIOPCODE_BOOTWHAT_REPLY;
boot_info.status = BISTAT_SUCCESS;
#if 0
boot_whatp->type = BIBOOTWHAT_TYPE_MB;
boot_whatp->what.mb.tftp_ip.s_addr = 0;
strcpy(boot_whatp->what.mb.filename, NETBOOT);
boot_whatp->type = BIBOOTWHAT_TYPE_SYSID;
boot_whatp->what.sysid = 165; /* BSD */
client.sin_family = AF_INET;
client.sin_port = htons(BOOTWHAT_SRCPORT);
if (sendto(sock, (char *)&boot_info, sizeof(boot_info), 0,
(struct sockaddr *)&client, sizeof(client)) < 0)
killall bootinfo
${DIR}/bootinfo > /dev/null 2>&1 &
This diff is collapsed.
# This is a comment.
# Client IP TFTPD IP File to boot
# /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot /tftpboot/pxeboot
killall proxydhcp
${DIR}/proxydhcp ${DIR}/proxydhcp.conf > /dev/null 2>&1 &
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment