mirror of
https://github.com/dreamlayers/netbsd-mopd.git
synced 2026-04-26 20:16:47 +00:00
Map different program types to different files, for Ultrix netload.
This commit is contained in:
@@ -435,6 +435,7 @@ mopProcessDL(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
|
|||||||
int i, nfd;
|
int i, nfd;
|
||||||
struct dllist dl, *dl_rpr;
|
struct dllist dl, *dl_rpr;
|
||||||
u_char load;
|
u_char load;
|
||||||
|
u_char pgtype;
|
||||||
|
|
||||||
if (DebugFlag == DEBUG_ONELINE) {
|
if (DebugFlag == DEBUG_ONELINE) {
|
||||||
mopPrintOneline(stdout, pkt, trans);
|
mopPrintOneline(stdout, pkt, trans);
|
||||||
@@ -475,9 +476,12 @@ mopProcessDL(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
|
|||||||
(void)fprintf(stderr,"\n");
|
(void)fprintf(stderr,"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)mopGetChar(pkt,idx); /* Program Type */
|
pgtype = mopGetChar(pkt,idx); /* Program Type */
|
||||||
|
|
||||||
tmpc = mopGetChar(pkt,idx); /* Software ID Len */
|
tmpc = mopGetChar(pkt,idx); /* Software ID Len */
|
||||||
|
/* Ultrix 4.00 netload sends 0xff, but no string after it. */
|
||||||
|
if (tmpc == 0xff)
|
||||||
|
tmpc = 0;
|
||||||
if (tmpc > sizeof(pfile) - 1)
|
if (tmpc > sizeof(pfile) - 1)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < tmpc; i++) {
|
for (i = 0; i < tmpc; i++) {
|
||||||
@@ -485,6 +489,7 @@ mopProcessDL(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
|
|||||||
pfile[i+1] = '\0';
|
pfile[i+1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (tmpc == 0) {
|
if (tmpc == 0) {
|
||||||
/* In a normal implementation of a MOP Loader this */
|
/* In a normal implementation of a MOP Loader this */
|
||||||
/* would cause a question to NML (DECnet) if this */
|
/* would cause a question to NML (DECnet) if this */
|
||||||
@@ -493,9 +498,24 @@ mopProcessDL(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
|
|||||||
/* to ask. My solution is to use the ethernet addr */
|
/* to ask. My solution is to use the ethernet addr */
|
||||||
/* as filename. Implementing a database would be */
|
/* as filename. Implementing a database would be */
|
||||||
/* overkill. */
|
/* overkill. */
|
||||||
|
const char *suffix;
|
||||||
|
switch (pgtype) {
|
||||||
|
case MOP_K_PGTY_SECLDR:
|
||||||
|
suffix = ".2";
|
||||||
|
break;
|
||||||
|
case MOP_K_PGTY_TERLDR:
|
||||||
|
suffix = ".3";
|
||||||
|
break;
|
||||||
|
case MOP_K_PGTY_MGNTFL:
|
||||||
|
suffix = ".M";
|
||||||
|
case MOP_K_PGTY_OPRSYS:
|
||||||
|
default:
|
||||||
|
suffix = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
snprintf(pfile, sizeof(pfile),
|
snprintf(pfile, sizeof(pfile),
|
||||||
"%02x%02x%02x%02x%02x%02x%c",
|
"%02x%02x%02x%02x%02x%02x%s%c",
|
||||||
src[0],src[1],src[2],src[3],src[4],src[5],0);
|
src[0],src[1],src[2],src[3],src[4],src[5],suffix,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpc = mopGetChar(pkt,idx); /* Processor */
|
tmpc = mopGetChar(pkt,idx); /* Processor */
|
||||||
|
|||||||
Reference in New Issue
Block a user