1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1991, 1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ident "%Z%%M% %I% %E% SMI" /* SunOS */
#include <sys/types.h>
#include <sys/errno.h>
#include <setjmp.h>
#include <string.h>
#include <netinet/in.h>
#include <rpc/types.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
#include <rpc/clnt.h>
#include <rpc/rpc_msg.h>
#include <rpcsvc/bootparam_prot.h>
#include "snoop.h"
extern char *dlc_header;
extern jmp_buf xdr_err;
static void show_address(char *);
static char *sum_address(void);
static char *procnames_short[] = {
"Null", /* 0 */
"WHOAMI?", /* 1 */
"GETFILE", /* 2 */
};
static char *procnames_long[] = {
"Null procedure", /* 0 */
"Who am I?", /* 1 */
"Get file name", /* 2 */
};
#define MAXPROC 2
void
interpret_bparam(flags, type, xid, vers, proc, data, len)
int flags, type, xid, vers, proc;
char *data;
int len;
{
char *line;
char buff[MAX_PATH_LEN + 1];
char buff2[MAX_MACHINE_NAME + 1];
if (proc < 0 || proc > MAXPROC)
return;
if (flags & F_SUM) {
if (setjmp(xdr_err)) {
return;
}
line = get_sum_line();
if (type == CALL) {
(void) sprintf(line,
"BPARAM C %s",
procnames_short[proc]);
line += strlen(line);
switch (proc) {
case BOOTPARAMPROC_WHOAMI:
(void) sprintf(line, " %s",
sum_address());
break;
case BOOTPARAMPROC_GETFILE:
(void) getxdr_string(buff,
MAX_MACHINE_NAME);
(void) sprintf(line, " %s",
getxdr_string(buff,
MAX_FILEID));
break;
}
check_retransmit(line, xid);
} else {
(void) sprintf(line, "BPARAM R %s ",
procnames_short[proc]);
line += strlen(line);
switch (proc) {
case BOOTPARAMPROC_WHOAMI:
(void) getxdr_string(buff,
MAX_MACHINE_NAME);
(void) getxdr_string(buff2,
MAX_MACHINE_NAME);
(void) sprintf(line, "%s in %s",
buff, buff2);
break;
case BOOTPARAMPROC_GETFILE:
(void) getxdr_string(buff,
MAX_MACHINE_NAME);
(void) sum_address();
(void) sprintf(line, "File=%s",
getxdr_string(buff,
MAX_PATH_LEN));
break;
}
}
}
if (flags & F_DTAIL) {
show_header("BPARAM: ", "Boot Parameters", len);
show_space();
if (setjmp(xdr_err)) {
return;
}
(void) sprintf(get_line(0, 0),
"Proc = %d (%s)",
proc, procnames_long[proc]);
if (type == CALL) {
switch (proc) {
case BOOTPARAMPROC_WHOAMI:
show_address("Client address");
break;
case BOOTPARAMPROC_GETFILE:
(void) showxdr_string(MAX_MACHINE_NAME,
"Hostname = %s");
(void) showxdr_string(MAX_FILEID,
"File = %s");
break;
}
} else {
switch (proc) {
case BOOTPARAMPROC_WHOAMI:
(void) showxdr_string(MAX_MACHINE_NAME,
"Client name = %s");
(void) showxdr_string(MAX_MACHINE_NAME,
"Domain name = %s");
show_address("Router addr");
break;
case BOOTPARAMPROC_GETFILE:
(void) showxdr_string(MAX_MACHINE_NAME,
"Server name = %s");
show_address("Server addr");
(void) showxdr_string(MAX_PATH_LEN,
"Server file = %s");
break;
}
}
show_trailer();
}
}
static char *
sum_address()
{
struct in_addr host;
extern char *inet_ntoa();
int atype;
atype = getxdr_u_long();
if (atype != IP_ADDR_TYPE)
return ("?");
host.S_un.S_un_b.s_b1 = getxdr_char();
host.S_un.S_un_b.s_b2 = getxdr_char();
host.S_un.S_un_b.s_b3 = getxdr_char();
host.S_un.S_un_b.s_b4 = getxdr_char();
return (inet_ntoa(host));
}
static void
show_address(label)
char *label;
{
struct in_addr host;
extern char *inet_ntoa();
int atype;
atype = getxdr_u_long();
if (atype == IP_ADDR_TYPE) {
host.S_un.S_un_b.s_b1 = getxdr_char();
host.S_un.S_un_b.s_b2 = getxdr_char();
host.S_un.S_un_b.s_b3 = getxdr_char();
host.S_un.S_un_b.s_b4 = getxdr_char();
(void) sprintf(get_line(0, 0),
"%s = %s (%s)",
label,
inet_ntoa(host),
addrtoname(AF_INET, &host));
} else {
(void) sprintf(get_line(0, 0),
"Router addr = ? (type not known)");
}
}
|