summaryrefslogtreecommitdiffstats
path: root/lib/libstand
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libstand')
-rw-r--r--lib/libstand/bootp.c4
-rw-r--r--lib/libstand/bootp.h1
-rw-r--r--lib/libstand/globals.c2
-rw-r--r--lib/libstand/net.h11
-rw-r--r--lib/libstand/nfs.c6
-rw-r--r--lib/libstand/tftp.c3
6 files changed, 27 insertions, 0 deletions
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index f3bc816..7474f8f 100644
--- a/lib/libstand/bootp.c
+++ b/lib/libstand/bootp.c
@@ -411,6 +411,10 @@ vend_rfc1048(cp, len)
bcopy(cp, &dhcp_serverip.s_addr,
sizeof(dhcp_serverip.s_addr));
}
+ if (tag == TAG_TFTP_SERVER) {
+ bcopy(cp, &tftpip.s_addr,
+ sizeof(tftpip.s_addr));
+ }
#endif
cp += size;
}
diff --git a/lib/libstand/bootp.h b/lib/libstand/bootp.h
index 47e5649..9f4d413 100644
--- a/lib/libstand/bootp.h
+++ b/lib/libstand/bootp.h
@@ -106,6 +106,7 @@ struct bootp {
#define TAG_T2 ((unsigned char) 59)
#define TAG_CLASSID ((unsigned char) 60)
#define TAG_CLIENTID ((unsigned char) 61)
+#define TAG_TFTP_SERVER ((unsigned char) 150)
#endif
#define TAG_END ((unsigned char) 255)
diff --git a/lib/libstand/globals.c b/lib/libstand/globals.c
index f2c6240..83b9f77 100644
--- a/lib/libstand/globals.c
+++ b/lib/libstand/globals.c
@@ -25,12 +25,14 @@ char hostname[FNAME_SIZE]; /* our hostname */
int hostnamelen;
char domainname[FNAME_SIZE]; /* our DNS domain */
int domainnamelen;
+int netproto = NET_NONE; /* Network prototol */
char ifname[IFNAME_SIZE]; /* name of interface (e.g. "le0") */
struct in_addr myip; /* my ip address */
struct in_addr nameip; /* DNS server ip address */
struct in_addr rootip; /* root ip address */
struct in_addr swapip; /* swap ip address */
struct in_addr gateip; /* gateway ip address */
+struct in_addr tftpip; /* TFTP ip address */
n_long netmask = 0xffffff00; /* subnet or net mask */
u_int intf_mtu; /* interface mtu from bootp/dhcp */
int errno; /* our old friend */
diff --git a/lib/libstand/net.h b/lib/libstand/net.h
index ce7df49..2c7fd4c 100644
--- a/lib/libstand/net.h
+++ b/lib/libstand/net.h
@@ -36,6 +36,8 @@
* $FreeBSD$
*/
+#ifndef _STAND_NET_H
+#define _STAND_NET_H
#ifndef _KERNEL /* XXX - see <netinet/in.h> */
#undef __IPADDR
#define __IPADDR(x) htonl((u_int32_t)(x))
@@ -45,6 +47,12 @@
#define BA { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
+enum net_proto {
+ NET_NONE,
+ NET_NFS,
+ NET_TFTP
+};
+
/* Returns true if n_long's on the same net */
#define SAMENET(a1, a2, m) ((a1.s_addr & m) == (a2.s_addr & m))
@@ -74,6 +82,7 @@ extern char hostname[FNAME_SIZE];
extern int hostnamelen;
extern char domainname[FNAME_SIZE];
extern int domainnamelen;
+extern int netproto;
extern char ifname[IFNAME_SIZE];
/* All of these are in network order. */
@@ -82,6 +91,7 @@ extern struct in_addr rootip;
extern struct in_addr swapip;
extern struct in_addr gateip;
extern struct in_addr nameip;
+extern struct in_addr tftpip;
extern n_long netmask;
extern u_int intf_mtu;
@@ -120,3 +130,4 @@ n_long inet_addr(char *);
/* Machine-dependent functions: */
time_t getsecs(void);
+#endif /* ! _STAND_NET_H */
diff --git a/lib/libstand/nfs.c b/lib/libstand/nfs.c
index 36986db..19bc73c 100644
--- a/lib/libstand/nfs.c
+++ b/lib/libstand/nfs.c
@@ -473,6 +473,9 @@ nfs_open(const char *upath, struct open_file *f)
int error;
char *path;
+ if (netproto != NET_NFS)
+ return (EINVAL);
+
#ifdef NFS_DEBUG
if (debug)
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
@@ -1115,6 +1118,9 @@ nfs_open(const char *upath, struct open_file *f)
int error;
char *path;
+ if (netproto != NET_NFS)
+ return (EINVAL);
+
#ifdef NFS_DEBUG
if (debug)
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c
index 001cbfd..621cfd8 100644
--- a/lib/libstand/tftp.c
+++ b/lib/libstand/tftp.c
@@ -402,6 +402,9 @@ tftp_open(const char *path, struct open_file *f)
size_t pathsize;
const char *extraslash;
+ if (netproto != NET_TFTP)
+ return (EINVAL);
+
if (strcmp(f->f_dev->dv_name, "net") != 0) {
#ifdef __i386__
if (strcmp(f->f_dev->dv_name, "pxe") != 0)
OpenPOWER on IntegriCloud