1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate *
4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate * with the License.
8*7c478bd9Sstevel@tonic-gate *
9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate *
14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate *
20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate * Copyright (c) 2001 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate * All rights reserved.
25*7c478bd9Sstevel@tonic-gate */
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gate #include <stdio.h>
30*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
31*7c478bd9Sstevel@tonic-gate
32*7c478bd9Sstevel@tonic-gate #include <at.h>
33*7c478bd9Sstevel@tonic-gate #include <snoop.h>
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gate char *print_macaddr(uint8_t *, int);
36*7c478bd9Sstevel@tonic-gate
37*7c478bd9Sstevel@tonic-gate static char *zip_flags(char);
38*7c478bd9Sstevel@tonic-gate static char *zip_flags_long(char);
39*7c478bd9Sstevel@tonic-gate
40*7c478bd9Sstevel@tonic-gate void
interpret_ddp_zip(int flags,struct zip_hdr * zip,int len)41*7c478bd9Sstevel@tonic-gate interpret_ddp_zip(int flags, struct zip_hdr *zip, int len)
42*7c478bd9Sstevel@tonic-gate {
43*7c478bd9Sstevel@tonic-gate int cnt;
44*7c478bd9Sstevel@tonic-gate uint16_t net;
45*7c478bd9Sstevel@tonic-gate uint16_t range;
46*7c478bd9Sstevel@tonic-gate uint8_t *p;
47*7c478bd9Sstevel@tonic-gate char zone[33];
48*7c478bd9Sstevel@tonic-gate char defzone[60] = "";
49*7c478bd9Sstevel@tonic-gate char mcast[50] = "";
50*7c478bd9Sstevel@tonic-gate uint8_t gniflags;
51*7c478bd9Sstevel@tonic-gate uint8_t *tail = (uint8_t *)zip + len;
52*7c478bd9Sstevel@tonic-gate
53*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) {
54*7c478bd9Sstevel@tonic-gate if (len < sizeof (struct zip_hdr))
55*7c478bd9Sstevel@tonic-gate goto out;
56*7c478bd9Sstevel@tonic-gate
57*7c478bd9Sstevel@tonic-gate switch (zip->zip_func) {
58*7c478bd9Sstevel@tonic-gate case ZIP_QUERY:
59*7c478bd9Sstevel@tonic-gate cnt = zip->zip_netcnt;
60*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
61*7c478bd9Sstevel@tonic-gate "ZIP Query CNT = %d", cnt);
62*7c478bd9Sstevel@tonic-gate break;
63*7c478bd9Sstevel@tonic-gate case ZIP_REPLY:
64*7c478bd9Sstevel@tonic-gate case ZIP_EXT_REPLY:
65*7c478bd9Sstevel@tonic-gate cnt = zip->zip_netcnt;
66*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
67*7c478bd9Sstevel@tonic-gate "ZIP Reply CNT = %d", cnt);
68*7c478bd9Sstevel@tonic-gate break;
69*7c478bd9Sstevel@tonic-gate case ZIP_GET_NET_INFO:
70*7c478bd9Sstevel@tonic-gate p = &zip->zip_func;
71*7c478bd9Sstevel@tonic-gate
72*7c478bd9Sstevel@tonic-gate if ((p+6 > tail) || (p+7+p[6] > tail))
73*7c478bd9Sstevel@tonic-gate goto out;
74*7c478bd9Sstevel@tonic-gate
75*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
76*7c478bd9Sstevel@tonic-gate "ZIP GNI Zone = \"%.*s\"", p[6], &p[7]);
77*7c478bd9Sstevel@tonic-gate break;
78*7c478bd9Sstevel@tonic-gate case ZIP_GET_NET_INFO_REPLY:
79*7c478bd9Sstevel@tonic-gate p = &zip->zip_func;
80*7c478bd9Sstevel@tonic-gate
81*7c478bd9Sstevel@tonic-gate gniflags = p[1];
82*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
83*7c478bd9Sstevel@tonic-gate "ZIP GNI Rep Flags 0x%x (%s)",
84*7c478bd9Sstevel@tonic-gate gniflags, zip_flags(gniflags));
85*7c478bd9Sstevel@tonic-gate break;
86*7c478bd9Sstevel@tonic-gate default:
87*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
88*7c478bd9Sstevel@tonic-gate "ZIP CMD = %d", zip->zip_func);
89*7c478bd9Sstevel@tonic-gate break;
90*7c478bd9Sstevel@tonic-gate }
91*7c478bd9Sstevel@tonic-gate }
92*7c478bd9Sstevel@tonic-gate
93*7c478bd9Sstevel@tonic-gate if (flags & F_DTAIL) {
94*7c478bd9Sstevel@tonic-gate show_header("ZIP: ", "ZIP Header", len);
95*7c478bd9Sstevel@tonic-gate show_space();
96*7c478bd9Sstevel@tonic-gate
97*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
98*7c478bd9Sstevel@tonic-gate "Length = %d", len);
99*7c478bd9Sstevel@tonic-gate
100*7c478bd9Sstevel@tonic-gate if (len < sizeof (struct zip_hdr))
101*7c478bd9Sstevel@tonic-gate goto out;
102*7c478bd9Sstevel@tonic-gate
103*7c478bd9Sstevel@tonic-gate switch (zip->zip_func) {
104*7c478bd9Sstevel@tonic-gate case ZIP_QUERY:
105*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
106*7c478bd9Sstevel@tonic-gate "Query, Network count = %d", zip->zip_netcnt);
107*7c478bd9Sstevel@tonic-gate cnt = zip->zip_netcnt;
108*7c478bd9Sstevel@tonic-gate p = (uint8_t *)(zip + 1);
109*7c478bd9Sstevel@tonic-gate while (cnt--) {
110*7c478bd9Sstevel@tonic-gate if (p+2 > tail)
111*7c478bd9Sstevel@tonic-gate goto out;
112*7c478bd9Sstevel@tonic-gate net = get_short(p);
113*7c478bd9Sstevel@tonic-gate p += 2;
114*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
115*7c478bd9Sstevel@tonic-gate get_line_remain(), "Net = %d", net);
116*7c478bd9Sstevel@tonic-gate }
117*7c478bd9Sstevel@tonic-gate break;
118*7c478bd9Sstevel@tonic-gate case ZIP_REPLY:
119*7c478bd9Sstevel@tonic-gate case ZIP_EXT_REPLY:
120*7c478bd9Sstevel@tonic-gate cnt = zip->zip_netcnt;
121*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
122*7c478bd9Sstevel@tonic-gate "Reply, Network count = %d", cnt);
123*7c478bd9Sstevel@tonic-gate
124*7c478bd9Sstevel@tonic-gate p = (uint8_t *)(zip + 1);
125*7c478bd9Sstevel@tonic-gate while (cnt--) {
126*7c478bd9Sstevel@tonic-gate if (p+2 > tail)
127*7c478bd9Sstevel@tonic-gate goto out;
128*7c478bd9Sstevel@tonic-gate net = get_short(p);
129*7c478bd9Sstevel@tonic-gate p += 2;
130*7c478bd9Sstevel@tonic-gate if (p+1 > tail || (&p[1] + p[0]) > tail)
131*7c478bd9Sstevel@tonic-gate goto out;
132*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
133*7c478bd9Sstevel@tonic-gate get_line_remain(),
134*7c478bd9Sstevel@tonic-gate "Network = %d, Zone = \"%.*s\"",
135*7c478bd9Sstevel@tonic-gate net, p[0], &p[1]);
136*7c478bd9Sstevel@tonic-gate p += p[0] + 1;
137*7c478bd9Sstevel@tonic-gate }
138*7c478bd9Sstevel@tonic-gate break;
139*7c478bd9Sstevel@tonic-gate case ZIP_GET_NET_INFO:
140*7c478bd9Sstevel@tonic-gate p = &zip->zip_func;
141*7c478bd9Sstevel@tonic-gate if (p+1 > tail || (&p[1] + p[0]) > tail)
142*7c478bd9Sstevel@tonic-gate goto out;
143*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
144*7c478bd9Sstevel@tonic-gate "GetNetInfo Zone = \"%.*s\"", p[0], &p[1]);
145*7c478bd9Sstevel@tonic-gate break;
146*7c478bd9Sstevel@tonic-gate case ZIP_GET_NET_INFO_REPLY:
147*7c478bd9Sstevel@tonic-gate p = &zip->zip_func;
148*7c478bd9Sstevel@tonic-gate if (p+5 > tail)
149*7c478bd9Sstevel@tonic-gate goto out;
150*7c478bd9Sstevel@tonic-gate gniflags = p[1];
151*7c478bd9Sstevel@tonic-gate net = get_short(&p[2]);
152*7c478bd9Sstevel@tonic-gate range = get_short(&p[4]);
153*7c478bd9Sstevel@tonic-gate
154*7c478bd9Sstevel@tonic-gate if (p+7 > tail || (&p[7] + p[6]) > tail)
155*7c478bd9Sstevel@tonic-gate goto out;
156*7c478bd9Sstevel@tonic-gate (void) snprintf(zone, sizeof (zone),
157*7c478bd9Sstevel@tonic-gate "%.*s", p[6], &p[7]);
158*7c478bd9Sstevel@tonic-gate p = &p[7] + p[6];
159*7c478bd9Sstevel@tonic-gate
160*7c478bd9Sstevel@tonic-gate if ((gniflags & ZIP_FLG_USEBRC) == 0) {
161*7c478bd9Sstevel@tonic-gate if (p+1 > tail || (&p[1] + p[0]) > tail)
162*7c478bd9Sstevel@tonic-gate goto out;
163*7c478bd9Sstevel@tonic-gate (void) snprintf(mcast, sizeof (mcast),
164*7c478bd9Sstevel@tonic-gate "Multicast address = %s",
165*7c478bd9Sstevel@tonic-gate print_macaddr(&p[1], p[0]));
166*7c478bd9Sstevel@tonic-gate }
167*7c478bd9Sstevel@tonic-gate
168*7c478bd9Sstevel@tonic-gate if (gniflags & ZIP_FLG_ZINV) {
169*7c478bd9Sstevel@tonic-gate p = &p[1] + p[0];
170*7c478bd9Sstevel@tonic-gate if (p+1 > tail || (&p[1] + p[0]) > tail)
171*7c478bd9Sstevel@tonic-gate goto out;
172*7c478bd9Sstevel@tonic-gate (void) snprintf(defzone, sizeof (defzone),
173*7c478bd9Sstevel@tonic-gate "Default Zone = \"%.*s\"",
174*7c478bd9Sstevel@tonic-gate p[0], &p[1]);
175*7c478bd9Sstevel@tonic-gate }
176*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
177*7c478bd9Sstevel@tonic-gate "GetNetInfo Reply, Flags 0x%x (%s)",
178*7c478bd9Sstevel@tonic-gate gniflags, zip_flags_long(gniflags));
179*7c478bd9Sstevel@tonic-gate
180*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
181*7c478bd9Sstevel@tonic-gate "Network number = %d-%d", net, range);
182*7c478bd9Sstevel@tonic-gate
183*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
184*7c478bd9Sstevel@tonic-gate "Zone = \"%s\"", zone);
185*7c478bd9Sstevel@tonic-gate
186*7c478bd9Sstevel@tonic-gate if (mcast[0])
187*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
188*7c478bd9Sstevel@tonic-gate get_line_remain(),
189*7c478bd9Sstevel@tonic-gate "%s", mcast);
190*7c478bd9Sstevel@tonic-gate
191*7c478bd9Sstevel@tonic-gate if (defzone[0])
192*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
193*7c478bd9Sstevel@tonic-gate get_line_remain(),
194*7c478bd9Sstevel@tonic-gate "%s", defzone);
195*7c478bd9Sstevel@tonic-gate
196*7c478bd9Sstevel@tonic-gate break;
197*7c478bd9Sstevel@tonic-gate case ZIP_NOTIFY:
198*7c478bd9Sstevel@tonic-gate p = &zip->zip_func;
199*7c478bd9Sstevel@tonic-gate if (p+5 > tail)
200*7c478bd9Sstevel@tonic-gate goto out;
201*7c478bd9Sstevel@tonic-gate
202*7c478bd9Sstevel@tonic-gate gniflags = p[1];
203*7c478bd9Sstevel@tonic-gate net = get_short(&p[2]);
204*7c478bd9Sstevel@tonic-gate range = get_short(&p[4]);
205*7c478bd9Sstevel@tonic-gate
206*7c478bd9Sstevel@tonic-gate if (p+7 > tail || (&p[7] + p[6]) > tail)
207*7c478bd9Sstevel@tonic-gate goto out;
208*7c478bd9Sstevel@tonic-gate (void) snprintf(zone, sizeof (zone),
209*7c478bd9Sstevel@tonic-gate "%.*s", p[6], &p[7]);
210*7c478bd9Sstevel@tonic-gate p = &p[7] + p[6];
211*7c478bd9Sstevel@tonic-gate
212*7c478bd9Sstevel@tonic-gate if ((gniflags & ZIP_FLG_USEBRC) == 0) {
213*7c478bd9Sstevel@tonic-gate if (p+1 > tail || (&p[1] + p[0]) > tail)
214*7c478bd9Sstevel@tonic-gate goto out;
215*7c478bd9Sstevel@tonic-gate (void) snprintf(mcast, sizeof (mcast),
216*7c478bd9Sstevel@tonic-gate "New Multicast address = %s",
217*7c478bd9Sstevel@tonic-gate print_macaddr(&p[1], p[0]));
218*7c478bd9Sstevel@tonic-gate }
219*7c478bd9Sstevel@tonic-gate
220*7c478bd9Sstevel@tonic-gate if (p+1 > tail || (&p[1] + p[0]) > tail)
221*7c478bd9Sstevel@tonic-gate goto out;
222*7c478bd9Sstevel@tonic-gate
223*7c478bd9Sstevel@tonic-gate p = &p[1] + p[0];
224*7c478bd9Sstevel@tonic-gate
225*7c478bd9Sstevel@tonic-gate if (p+1 > tail || (&p[1] + p[0]) > tail)
226*7c478bd9Sstevel@tonic-gate goto out;
227*7c478bd9Sstevel@tonic-gate
228*7c478bd9Sstevel@tonic-gate (void) snprintf(defzone, sizeof (defzone),
229*7c478bd9Sstevel@tonic-gate "New Default Zone = \"%.*s\"",
230*7c478bd9Sstevel@tonic-gate p[0], &p[1]);
231*7c478bd9Sstevel@tonic-gate
232*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
233*7c478bd9Sstevel@tonic-gate "Notify, Flags 0x%x (%s)",
234*7c478bd9Sstevel@tonic-gate gniflags, zip_flags_long(gniflags));
235*7c478bd9Sstevel@tonic-gate
236*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
237*7c478bd9Sstevel@tonic-gate "Old Zone = \"%s\"", zone);
238*7c478bd9Sstevel@tonic-gate
239*7c478bd9Sstevel@tonic-gate if (mcast[0])
240*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
241*7c478bd9Sstevel@tonic-gate get_line_remain(), "%s", mcast);
242*7c478bd9Sstevel@tonic-gate
243*7c478bd9Sstevel@tonic-gate if (defzone[0])
244*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
245*7c478bd9Sstevel@tonic-gate get_line_remain(), "%s", defzone);
246*7c478bd9Sstevel@tonic-gate
247*7c478bd9Sstevel@tonic-gate break;
248*7c478bd9Sstevel@tonic-gate default:
249*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
250*7c478bd9Sstevel@tonic-gate "Op = %d", zip->zip_func);
251*7c478bd9Sstevel@tonic-gate break;
252*7c478bd9Sstevel@tonic-gate }
253*7c478bd9Sstevel@tonic-gate }
254*7c478bd9Sstevel@tonic-gate return;
255*7c478bd9Sstevel@tonic-gate out:
256*7c478bd9Sstevel@tonic-gate if (flags & F_SUM)
257*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
258*7c478bd9Sstevel@tonic-gate "ZIP (short packet)");
259*7c478bd9Sstevel@tonic-gate if (flags & F_DTAIL)
260*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
261*7c478bd9Sstevel@tonic-gate "ZIP (short packet)");
262*7c478bd9Sstevel@tonic-gate }
263*7c478bd9Sstevel@tonic-gate
264*7c478bd9Sstevel@tonic-gate static char *
zip_flags(char flags)265*7c478bd9Sstevel@tonic-gate zip_flags(char flags)
266*7c478bd9Sstevel@tonic-gate {
267*7c478bd9Sstevel@tonic-gate static char buf[50];
268*7c478bd9Sstevel@tonic-gate char *p = buf;
269*7c478bd9Sstevel@tonic-gate char *tail = &buf[sizeof (buf)];
270*7c478bd9Sstevel@tonic-gate
271*7c478bd9Sstevel@tonic-gate buf[0] = '\0';
272*7c478bd9Sstevel@tonic-gate
273*7c478bd9Sstevel@tonic-gate if (flags & ZIP_FLG_ZINV)
274*7c478bd9Sstevel@tonic-gate p += snprintf(p, tail-p, "IZ");
275*7c478bd9Sstevel@tonic-gate
276*7c478bd9Sstevel@tonic-gate if (flags & ZIP_FLG_USEBRC)
277*7c478bd9Sstevel@tonic-gate p += snprintf(p, tail-p, p == buf ? "UB" : " UB");
278*7c478bd9Sstevel@tonic-gate
279*7c478bd9Sstevel@tonic-gate if (flags & ZIP_FLG_ONEZ)
280*7c478bd9Sstevel@tonic-gate (void) snprintf(p, tail-p, p == buf ? "OOZ" : " OOZ");
281*7c478bd9Sstevel@tonic-gate
282*7c478bd9Sstevel@tonic-gate return (buf);
283*7c478bd9Sstevel@tonic-gate }
284*7c478bd9Sstevel@tonic-gate
285*7c478bd9Sstevel@tonic-gate static char *
zip_flags_long(char flags)286*7c478bd9Sstevel@tonic-gate zip_flags_long(char flags)
287*7c478bd9Sstevel@tonic-gate {
288*7c478bd9Sstevel@tonic-gate static char buf[50];
289*7c478bd9Sstevel@tonic-gate char *p = buf;
290*7c478bd9Sstevel@tonic-gate char *tail = &buf[sizeof (buf)];
291*7c478bd9Sstevel@tonic-gate
292*7c478bd9Sstevel@tonic-gate buf[0] = '\0';
293*7c478bd9Sstevel@tonic-gate
294*7c478bd9Sstevel@tonic-gate if (flags & ZIP_FLG_ZINV)
295*7c478bd9Sstevel@tonic-gate p += snprintf(p, tail-p, "ZoneInvalid");
296*7c478bd9Sstevel@tonic-gate
297*7c478bd9Sstevel@tonic-gate if (flags & ZIP_FLG_USEBRC)
298*7c478bd9Sstevel@tonic-gate p += snprintf(p, tail-p,
299*7c478bd9Sstevel@tonic-gate p == buf ? "UseBroadcast" : " UseBroadcast");
300*7c478bd9Sstevel@tonic-gate
301*7c478bd9Sstevel@tonic-gate if (flags & ZIP_FLG_ONEZ)
302*7c478bd9Sstevel@tonic-gate (void) snprintf(p, tail-p,
303*7c478bd9Sstevel@tonic-gate p == buf ? "OnlyOneZone" : " OnlyOneZone");
304*7c478bd9Sstevel@tonic-gate
305*7c478bd9Sstevel@tonic-gate return (buf);
306*7c478bd9Sstevel@tonic-gate }
307*7c478bd9Sstevel@tonic-gate
308*7c478bd9Sstevel@tonic-gate void
interpret_atp_zip(int flags,struct atp_hdr * atp,int len)309*7c478bd9Sstevel@tonic-gate interpret_atp_zip(int flags, struct atp_hdr *atp, int len)
310*7c478bd9Sstevel@tonic-gate {
311*7c478bd9Sstevel@tonic-gate int cnt;
312*7c478bd9Sstevel@tonic-gate uint8_t *data;
313*7c478bd9Sstevel@tonic-gate uint8_t *tail = (uint8_t *)(atp+1) + len;
314*7c478bd9Sstevel@tonic-gate
315*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) {
316*7c478bd9Sstevel@tonic-gate if (len < 0) {
317*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
318*7c478bd9Sstevel@tonic-gate "ZIP (short packet)");
319*7c478bd9Sstevel@tonic-gate return;
320*7c478bd9Sstevel@tonic-gate }
321*7c478bd9Sstevel@tonic-gate
322*7c478bd9Sstevel@tonic-gate switch (atp_fun(atp->atp_ctrl)) {
323*7c478bd9Sstevel@tonic-gate case ATP_TREQ:
324*7c478bd9Sstevel@tonic-gate switch (atp->atp_user[0]) {
325*7c478bd9Sstevel@tonic-gate case ZIP_ATP_GETMYZONE:
326*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
327*7c478bd9Sstevel@tonic-gate "ZIP GetMyZone");
328*7c478bd9Sstevel@tonic-gate break;
329*7c478bd9Sstevel@tonic-gate
330*7c478bd9Sstevel@tonic-gate case ZIP_ATP_GETZONELIST:
331*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
332*7c478bd9Sstevel@tonic-gate "ZIP GetZoneList");
333*7c478bd9Sstevel@tonic-gate break;
334*7c478bd9Sstevel@tonic-gate
335*7c478bd9Sstevel@tonic-gate case ZIP_ATP_GETLOCALZONES:
336*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
337*7c478bd9Sstevel@tonic-gate "ZIP GetLocalZones");
338*7c478bd9Sstevel@tonic-gate break;
339*7c478bd9Sstevel@tonic-gate }
340*7c478bd9Sstevel@tonic-gate break;
341*7c478bd9Sstevel@tonic-gate case ATP_TRESP:
342*7c478bd9Sstevel@tonic-gate cnt = get_short(&atp->atp_user[2]);
343*7c478bd9Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE,
344*7c478bd9Sstevel@tonic-gate "ZIP ZoneReply, Cnt = %d", cnt);
345*7c478bd9Sstevel@tonic-gate
346*7c478bd9Sstevel@tonic-gate break;
347*7c478bd9Sstevel@tonic-gate }
348*7c478bd9Sstevel@tonic-gate }
349*7c478bd9Sstevel@tonic-gate
350*7c478bd9Sstevel@tonic-gate if (flags & F_DTAIL) {
351*7c478bd9Sstevel@tonic-gate show_header("ZIP: ", "ZIP Header", len);
352*7c478bd9Sstevel@tonic-gate show_space();
353*7c478bd9Sstevel@tonic-gate
354*7c478bd9Sstevel@tonic-gate if (len < 0) {
355*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
356*7c478bd9Sstevel@tonic-gate "ZIP (short packet)");
357*7c478bd9Sstevel@tonic-gate return;
358*7c478bd9Sstevel@tonic-gate }
359*7c478bd9Sstevel@tonic-gate
360*7c478bd9Sstevel@tonic-gate switch (atp_fun(atp->atp_ctrl)) {
361*7c478bd9Sstevel@tonic-gate case ATP_TREQ:
362*7c478bd9Sstevel@tonic-gate switch (atp->atp_user[0]) {
363*7c478bd9Sstevel@tonic-gate case ZIP_ATP_GETMYZONE:
364*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
365*7c478bd9Sstevel@tonic-gate get_line_remain(),
366*7c478bd9Sstevel@tonic-gate "GetMyZone, Start Index = %d",
367*7c478bd9Sstevel@tonic-gate get_short(&atp->atp_user[2]));
368*7c478bd9Sstevel@tonic-gate break;
369*7c478bd9Sstevel@tonic-gate case ZIP_ATP_GETZONELIST:
370*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
371*7c478bd9Sstevel@tonic-gate get_line_remain(),
372*7c478bd9Sstevel@tonic-gate "GetZoneList, Start Index = %d",
373*7c478bd9Sstevel@tonic-gate get_short(&atp->atp_user[2]));
374*7c478bd9Sstevel@tonic-gate break;
375*7c478bd9Sstevel@tonic-gate case ZIP_ATP_GETLOCALZONES:
376*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
377*7c478bd9Sstevel@tonic-gate get_line_remain(),
378*7c478bd9Sstevel@tonic-gate "GetLocalZones, Start Index = %d",
379*7c478bd9Sstevel@tonic-gate get_short(&atp->atp_user[2]));
380*7c478bd9Sstevel@tonic-gate break;
381*7c478bd9Sstevel@tonic-gate }
382*7c478bd9Sstevel@tonic-gate break;
383*7c478bd9Sstevel@tonic-gate case ATP_TRESP:
384*7c478bd9Sstevel@tonic-gate cnt = get_short(&atp->atp_user[2]);
385*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(),
386*7c478bd9Sstevel@tonic-gate "ZoneReply, Number of Zones = %d, Length = %d",
387*7c478bd9Sstevel@tonic-gate cnt, len);
388*7c478bd9Sstevel@tonic-gate
389*7c478bd9Sstevel@tonic-gate data = (uint8_t *)atp + DDPHDR_SIZE + ATPHDR_SIZE;
390*7c478bd9Sstevel@tonic-gate
391*7c478bd9Sstevel@tonic-gate while (cnt--) {
392*7c478bd9Sstevel@tonic-gate if (data > tail ||
393*7c478bd9Sstevel@tonic-gate (&data[1] + data[0]) > tail) {
394*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
395*7c478bd9Sstevel@tonic-gate get_line_remain(),
396*7c478bd9Sstevel@tonic-gate "ZoneReply (short packet)");
397*7c478bd9Sstevel@tonic-gate return;
398*7c478bd9Sstevel@tonic-gate }
399*7c478bd9Sstevel@tonic-gate (void) snprintf(get_line(0, 0),
400*7c478bd9Sstevel@tonic-gate get_line_remain(),
401*7c478bd9Sstevel@tonic-gate "Zone = \"%.*s\"", data[0], &data[1]);
402*7c478bd9Sstevel@tonic-gate data += data[0] + 1;
403*7c478bd9Sstevel@tonic-gate }
404*7c478bd9Sstevel@tonic-gate break;
405*7c478bd9Sstevel@tonic-gate }
406*7c478bd9Sstevel@tonic-gate }
407*7c478bd9Sstevel@tonic-gate }
408