--- mopd-2.5.3.orig/patches/mopd-2.5.3-vax-linux.patch
+++ mopd-2.5.3/patches/mopd-2.5.3-vax-linux.patch
@@ -0,0 +1,328 @@
+diff -up --recursive --new-file mopd-2.5.3.macro/README mopd-2.5.3/README
+--- mopd-2.5.3.macro/README	Thu Jan  1 00:00:00 1970
++++ mopd-2.5.3/README	Sun Jun 24 19:33:44 2001
+@@ -0,0 +1,20 @@
++mopd-linux-20000808
++
++ This is the Linux version of Mats Jansens' Mopd.
++ 
++ The sources here are taken from the NetBSD version of mopd 2.5.3/4 
++ in CVS, plus some bits from the OpenBSD port, and the security 
++ fixes reported on BUGTRAQ on 08 Aug 2000. 
++ 
++ I had to rewrite the Makefiles, and hack things about a bit to compile 
++ under Linux, So if this version doesnt work for you, send email to the 
++ Linux/VAX list detailing the problem. 
++ 
++ The mopa.out program does not work. The a.out structures have different
++ names under NetBSD and Linux (see /usr/include/a.out.h), and so the 
++ code needs re-writing.
++ 
++ atp@pergamentum.com 8/Aug/2000
++ 
++ Patches from John Nall added for Alpha/Linux
++ 
+diff -up --recursive --new-file mopd-2.5.3.macro/common/common.h mopd-2.5.3/common/common.h
+--- mopd-2.5.3.macro/common/common.h	Tue Aug 13 12:22:45 1996
++++ mopd-2.5.3/common/common.h	Fri Oct 26 01:33:20 2001
+@@ -38,6 +38,10 @@
+ #define BUFSIZE		1600		/* main receive buffer size	*/
+ #define HDRSIZ		22		/* room for 803.2 header	*/
+ 
++#ifndef DEFAULT_HOSTNAME
++#define DEFAULT_HOSTNAME	"ipc"
++#endif
++
+ #ifndef MOP_FILE_PATH
+ #define MOP_FILE_PATH	"/tftpboot/mop"
+ #endif
+diff -up --recursive --new-file mopd-2.5.3.macro/common/device.c mopd-2.5.3/common/device.c
+--- mopd-2.5.3.macro/common/device.c	Sat Oct 27 18:49:32 2001
++++ mopd-2.5.3/common/device.c	Sat Oct 27 19:14:58 2001
+@@ -82,6 +82,7 @@ deviceEthAddr(ifname, eaddr)
+ 	if (ioctl(fd, SIOCGIFCONF, (caddr_t)&ifc) < 0 ||
+ 	    ifc.ifc_len < sizeof(struct ifreq)) {
+ 		syslog(LOG_ERR, "deviceEthAddr: SIOGIFCONF: %m");
++		(void) close(fd);
+ 		exit(1);
+ 	}
+ 	ifr = ifc.ifc_req;
+@@ -94,11 +95,13 @@ deviceEthAddr(ifname, eaddr)
+ 			continue;
+ 		if (!strncmp(ifr->ifr_name, ifname, sizeof(ifr->ifr_name))) {
+ 			bcopy((caddr_t)LLADDR(sdl), (caddr_t)eaddr, 6);
++			(void) close(fd);
+ 			return;
+ 		}
+ 	}
+ 
+ 	syslog(LOG_ERR, "deviceEthAddr: Never saw interface `%s'!", ifname);
++	(void) close(fd);
+ 	exit(1);
+ }
+ #endif	/* DEV_NEW_CONF */
+@@ -213,11 +216,7 @@ deviceInitOne(ifname)
+ 
+ 	/* Ok, get transport information */
+ 	
+-#ifdef __linux__
+-	trans = TRANS_ETHER+TRANS_8023+TRANS_AND; 
+-#else
+ 	trans = pfTrans(interface);
+-#endif
+ 
+ #ifndef NORC
+ 	/* Start with MOP Remote Console */
+diff -up --recursive --new-file mopd-2.5.3.macro/common/dl.c mopd-2.5.3/common/dl.c
+--- mopd-2.5.3.macro/common/dl.c	Sat Oct 27 18:49:32 2001
++++ mopd-2.5.3/common/dl.c	Sat Oct 27 19:14:58 2001
+@@ -44,8 +44,8 @@ mopDumpDL(fd, pkt, trans)
+ {
+ 	int	i,index = 0;
+ 	long	tmpl;
+-	u_char	tmpc,c,program[17],code,*ucp;
+-	u_short	len,tmps,moplen;
++	u_char	tmpc,c,program[257],code,*ucp;
++	int	len,tmps,moplen;
+ 
+ 	len = mopGetLength(pkt, trans);
+ 
+@@ -58,6 +58,8 @@ mopDumpDL(fd, pkt, trans)
+ 		index = 16;
+ 		moplen = len;
+ 	}
++	if (moplen < 1)				/* broken packet */
++		return;
+ 	code = mopGetChar(pkt,&index);
+ 	
+ 	switch (code) {
+diff -up --recursive --new-file mopd-2.5.3.macro/common/loop-bsd.c mopd-2.5.3/common/loop-bsd.c
+--- mopd-2.5.3.macro/common/loop-bsd.c	Sat Oct 27 18:49:32 2001
++++ mopd-2.5.3/common/loop-bsd.c	Sat Oct 27 19:14:58 2001
+@@ -34,7 +34,7 @@ static char rcsid[] = "$Id: loop-bsd.c,v
+ #include <stdlib.h>
+ #include <strings.h>
+ #include <unistd.h>
+-#if defined(__bsdi__) || defined(__FreeBSD__)
++#if defined(__bsdi__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <sys/time.h>
+ #endif
+ #if !defined(__linux__)
+diff -up --recursive --new-file mopd-2.5.3.macro/common/os.h mopd-2.5.3/common/os.h
+--- mopd-2.5.3.macro/common/os.h	Thu Oct 25 22:19:18 2001
++++ mopd-2.5.3/common/os.h	Sat Oct 27 19:14:58 2001
+@@ -70,6 +70,9 @@
+ #endif
+ #include <unistd.h>
+ 
++#include <sys/utsname.h>
++#include <sys/param.h>
++
+ #if defined(sun)
+ typedef int ssize_t;
+ #endif
+diff -up --recursive --new-file mopd-2.5.3.macro/common/pf-linux.c mopd-2.5.3/common/pf-linux.c
+--- mopd-2.5.3.macro/common/pf-linux.c	Sat Oct 27 18:49:32 2001
++++ mopd-2.5.3/common/pf-linux.c	Sat Oct 27 19:14:58 2001
+@@ -45,6 +45,8 @@
+ #include <unistd.h>
+ #include <string.h>
+ 
++#include "mopdef.h"
++
+ /*
+  * map compatible functions
+  *
+@@ -131,7 +133,7 @@ int typ, mode;
+ 
+   { u_short prot;
+ 
+-    prot = ((typ == 2) ? htons(ETH_P_802_2) : htons(protocol));
++    prot = ((typ == TRANS_8023) ? htons(ETH_P_802_2) : htons(protocol));
+     if ((s = socket(AF_INET, SOCK_PACKET, prot)) < 0) {
+       perror(interface);
+       return(-1);
+@@ -175,7 +177,8 @@ int s;
+ char *interface;
+ u_char *addr;
+ {
+-  strcpy(ifr.ifr_name, interface);
++  strncpy(ifr.ifr_name, interface, sizeof (ifr.ifr_name) - 1);
++  ifr.ifr_name[sizeof(ifr.ifr_name)] = 0;
+   ifr.ifr_addr.sa_family = AF_INET;
+   if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
+     perror("SIOCGIFHWADDR");
+@@ -200,7 +203,8 @@ u_char *addr;
+ 
+ #ifdef	USE_SADDMULTI
+ 
+-  strcpy(ifr.ifr_name, interface);
++  strncpy(ifr.ifr_name, interface, sizeof (ifr.ifr_name) - 1);
++  ifr.ifr_name[sizeof(ifr.ifr_name)] = 0;
+ 
+ #ifdef	UPFILT
+   /* get the real interface name */
+@@ -248,7 +252,8 @@ u_char *addr;
+ 
+ #ifdef	USE_SADDMULTI
+ 
+-  strcpy(ifr.ifr_name, interface);
++  strncpy(ifr.ifr_name, interface, sizeof (ifr.ifr_name) - 1);
++  ifr.ifr_name[sizeof(ifr.ifr_name)] = 0;
+ 
+   ifr.ifr_addr.sa_family = AF_UNSPEC;
+   bcopy((char *)addr, ifr.ifr_addr.sa_data, 6);
+@@ -352,6 +357,19 @@ u_char *buf;
+     return(len);
+ 
+   return(-1);
++}
++
++/*
++ * Return information to device.c how to open device.
++ * In this case the driver can handle both Ethernet type II and
++ * IEEE 802.3 frames (SNAP) in a single pfOpen.
++ */
++
++int
++pfTrans(interface)
++	char *interface;
++{
++	return TRANS_ETHER+TRANS_8023;
+ }
+ 
+ #endif /* __linux__ */
+diff -up --recursive --new-file mopd-2.5.3.macro/common/rc.c mopd-2.5.3/common/rc.c
+--- mopd-2.5.3.macro/common/rc.c	Sat Oct 27 18:49:32 2001
++++ mopd-2.5.3/common/rc.c	Sat Oct 27 19:14:58 2001
+@@ -45,7 +45,7 @@ mopDumpRC(fd, pkt, trans)
+ 	int	i,index = 0;
+ 	long	tmpl;
+ 	u_char	tmpc,code,control;
+-	u_short	len,tmps,moplen;
++	int	len,tmps,moplen;
+ 
+ 	len = mopGetLength(pkt, trans);
+ 
+@@ -58,6 +58,8 @@ mopDumpRC(fd, pkt, trans)
+ 		index = 16;
+ 		moplen = len;
+ 	}
++	if (moplen < 1)				/* broken packet */
++		return;
+ 	code = mopGetChar(pkt,&index);
+ 	
+ 	switch (code) {
+diff -up --recursive --new-file mopd-2.5.3.macro/mopd/process.c mopd-2.5.3/mopd/process.c
+--- mopd-2.5.3.macro/mopd/process.c	Sat Oct 27 18:49:32 2001
++++ mopd-2.5.3/mopd/process.c	Sat Oct 27 19:14:58 2001
+@@ -45,6 +45,10 @@ static char rcsid[] = "$Id: process.c,v 
+ #include <common/file.h>
+ #include "process.h"
+ 
++#define SEND_REAL_HOSTNAME
++
++#define MAX_ETH_PAYLOAD 1492
++
+ extern u_char	buf[];
+ extern int	DebugFlag;
+ 
+@@ -266,10 +270,12 @@ mopStartLoad(dst, src, dl_rpr, trans)
+ 	dllist[slot].a_lseek   = 0;
+ 
+ 	dllist[slot].count     = 0;
+-	if (dllist[slot].dl_bsz >= 1492)
+-		dllist[slot].dl_bsz = 1492;
++	if (dllist[slot].dl_bsz >= MAX_ETH_PAYLOAD)
++		dllist[slot].dl_bsz = MAX_ETH_PAYLOAD;
+ 	if (dllist[slot].dl_bsz == 1030)	/* VS/uVAX 2000 needs this */
+ 		dllist[slot].dl_bsz = 1000;
++	if (dllist[slot].dl_bsz == 0)           /* Needed by "big" VAXen */
++		dllist[slot].dl_bsz = MAX_ETH_PAYLOAD;
+ 	if (trans == TRANS_8023)
+ 		dllist[slot].dl_bsz = dllist[slot].dl_bsz - 8;
+ 
+@@ -324,6 +330,13 @@ mopNextLoad(dst, src, new_count, trans)
+ 	u_short  newlen = 0,ptype = MOP_K_PROTO_DL;
+ 	u_char	 mopcode;
+ 
++#ifdef SEND_REAL_HOSTNAME
++	struct utsname uts_name;
++	char hostname[MAXHOSTNAMELEN];
++#else
++	char hostname[MAXHOSTNAMELEN] = DEFAULT_HOSTNAME;
++#endif
++
+ 	slot = -1;
+ 	
+ 	for (i = 0; i < MAXDL; i++) {
+@@ -352,14 +365,14 @@ mopNextLoad(dst, src, new_count, trans)
+ 		sprintf(line,
+ 			"%x:%x:%x:%x:%x:%x Load completed",
+ 			dst[0],dst[1],dst[2],dst[3],dst[4],dst[5]);
+-		syslog(LOG_INFO, line);
++		syslog(LOG_INFO, "%s", line);
+ 		return;
+ 	}
+ 
+ 	dllist[slot].lseek     = lseek(dllist[slot].ldfd,0L,SEEK_CUR);
+ 	
+-	if (dllist[slot].dl_bsz >= 1492)
+-		dllist[slot].dl_bsz = 1492;
++	if (dllist[slot].dl_bsz >= MAX_ETH_PAYLOAD)
++		dllist[slot].dl_bsz = MAX_ETH_PAYLOAD;
+ 	
+ 	index = 0;
+ 	mopPutHeader(pkt, &index, dst, src, ptype, trans);
+@@ -382,13 +395,22 @@ mopNextLoad(dst, src, new_count, trans)
+ 		
+ 	} else {
+ 		if (len == 0) {
++#ifdef SEND_REAL_HOSTNAME
++			if (uname(&uts_name) < 0) {
++				syslog(LOG_ERR,
++				       "uname: %m, sending `%s' as hostname",
++				       DEFAULT_HOSTNAME);
++				sprintf(hostname, "%s", DEFAULT_HOSTNAME);
++			} else
++				sprintf(hostname, "%s", uts_name.nodename);
++#endif
+ 			index = pindex;
+ 			mopcode = MOP_K_CODE_PLT;
+ 			mopPutChar (pkt,&index,mopcode);
+ 			mopPutChar (pkt,&index,dllist[slot].count);
+ 			mopPutChar (pkt,&index,MOP_K_PLTP_HSN);
+- 			mopPutChar (pkt,&index,3);
+-			mopPutMulti(pkt,&index,"ipc",3);
++ 			mopPutChar (pkt,&index,strlen(hostname));
++			mopPutMulti(pkt,&index,hostname,strlen(hostname));
+ 			mopPutChar (pkt,&index,MOP_K_PLTP_HSA);
+ 			mopPutChar (pkt,&index,6);
+ 			mopPutMulti(pkt,&index,src,6);
+@@ -437,7 +459,7 @@ mopProcessDL(fd, ii, pkt, index, dst, sr
+ {
+ 	u_char  tmpc;
+ 	u_short moplen;
+-	u_char  pfile[17], mopcode;
++	u_char  pfile[257], mopcode;
+ 	char    filename[FILENAME_MAX];
+ 	char    line[100];
+ 	int     i,nfd,iindex;
+@@ -527,7 +549,7 @@ mopProcessDL(fd, ii, pkt, index, dst, sr
+ 					src[0],src[1],src[2],
+ 					src[3],src[4],src[5],trans,pfile);
+ 			}
+-			syslog(LOG_INFO, line);
++			syslog(LOG_INFO, "%s", line);
+ 		} else {
+ 			if ((mopCmpEAddr(dst,ii->eaddr) == 0)) {
+ 				dl_rpr->ldfd = open(filename, O_RDONLY, 0);
+@@ -536,7 +558,7 @@ mopProcessDL(fd, ii, pkt, index, dst, sr
+ 					"%x:%x:%x:%x:%x:%x Send me %s",
+ 					src[0],src[1],src[2],
+ 					src[3],src[4],src[5],pfile);
+-				syslog(LOG_INFO, line);
++				syslog(LOG_INFO, "%s", line);
+ 			}
+ 		}
+ 		
