1 $Id: README.hpux,v 1.11 2000/04/04 21:07:33 guy Exp $
6 2 - Building GTK+/GLib with HP's C compiler
12 The Software Porting And Archive Centre for HP-UX, at
14 http://hpux.csc.liv.ac.uk/
16 (and with mirrors in various countries, listed on the Centre's home
17 page) has ported versions, in both source and binary form, for Ethereal,
18 as well as for the "libpcap", GLib, GTK+, "zlib", and CMU SNMP libraries
21 The changes they've made appear largely to be compile option changes; if
22 you've downloaded the source to the latest version of Ethereal (the
23 version on the Centre's site may not necessarily be the latest version),
24 it should be able to compile, perhaps with those changes.
26 They appear to have used HP-UX's "cc" compiler, with the options "-Ae
27 -O"; there's a comment "Add -Dhpux_9 if building under 9.X". It may
30 2 - Building GTK+/GLib with HP's C compiler
32 By default, HP's C compiler doesn't support "long long int" to provide
33 64-bit integral data types on 32-bit platforms; the "-Ae" flag must be
34 supplied to enable extensions such as that.
36 Ethereal's "configure" script automatically includes that flag if it
37 detects that the native compiler is being used on HP-UX; however, the
38 configure scripts for GTK+ and GLib don't do so, which means that 64-bit
39 integer support won't be enabled.
41 This may prevent some parts of Ethereal from compiling; in order to get
42 64-bit integer support in GTK+/GLib, edit all the Makefiles for GTK+ and
43 GLib, as generated by the GTK+ and GLib "configure" scripts, to add
44 "-Ae" to all "CFLAGS = " definitions found in those Makefiles. (If a
45 Makefile lacks a "CFLAGS = " definition, there's no need to add a
46 definition that includes "-Ae".)
50 nettl is used on HP-UX to trace various streams based subsystems. Ethereal
51 can read nettl files containing IP frames (NS_LS_IP subsystem) and LAPB
52 frames (SX25L2 subsystem).
53 It has been tested with files generated on HP-UX 9.04 and 10.20.
55 Use the following commands to generate a trace (cf. nettl(1M)):
57 # IP capture. 0x30000000 means PDU in and PDU out :
58 nettl -tn 0x30000000 -e NS_LS_IP -f tracefile
59 # X25 capture. You must specify an interface :
60 nettl -tn 0x30000000 -e SX25l2 -d /dev/x25_0 -f tracefile
61 # stop capture. subsystem is NS_LS_IP or SX25L2 :
62 nettl -tf -e subsystem
64 One may be able to specify "-tn pduin pduout" rather than
65 "-tn 0x30000000"; the nettl man page for HP-UX 10.30 implies that it
68 4 - "libpcap" on HP-UX
70 If you want to use Ethereal to capture packets, you will have to install
71 "libpcap"; the INSTALL file for "libpcap" has several comments about
72 HP-UX, which you should read if you're going to install and use
75 Note that packet-capture programs such as Ethereal/Tethereal or tcpdump
76 may, on HP-UX, not be able to see packets sent from the machine on which
77 they're running. Some articles on Deja.com discussing this are:
79 http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=558092266
83 Newsgroups: comp.sys.hp.hpux
84 Subject: Re: Did someone made tcpdump working on 10.20 ?
86 From: Lutz Jaenicke <jaenicke@emserv1.ee.TU-Berlin.DE>
88 In article <82ks5i$5vc$1@news1.dti.ne.jp>, mtsat <mtsat@iris.dti.ne.jp>
92 >I downloaded and compiled tcpdump3.4 a couple of week ago. I tried to use
93 >it, but I can only see incoming data, never outgoing.
94 >Someone (raj) explained me that a patch was missing, and that this patch
95 >must me "patched" (poked) in order to see outbound data in promiscuous mode.
96 >Many things to do .... So the question is : did someone has already this
97 >"ready to use" PHNE_**** patch ?
100 1. You do need a late "LAN products cumulative patch" (e.g. PHNE_18173
103 echo 'lanc_outbound_promisc_flag/W1' | /usr/bin/adb -w /stand/vmunix /dev/kmem
104 You can insert this e.g. into /sbin/init.d/lan
111 http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=586287166
115 Newsgroups: comp.sys.hp.hpux
116 Subject: Re: tcpdump only shows incoming packets
118 From: Rick Jones <foo@bar.baz.invalid>
120 Harald Skotnes <harald@cc.uit.no> wrote:
121 > I am running HPUX 11.0 on a C200 hanging on a 100Mb switch. I have
122 > compiled libpcap-0.4 an tcpdump-3.4 and it seems to work. But at a
123 > closer look I only get to see the incoming packets not the
124 > outgoing. I have tried tcpflow-0.12 which also uses libpcap and the
125 > same thing happens. Could someone please give me a hint on how to
128 Search/Read the archives ?-)
130 What you are seeing is expected, un-patched, behaviour for an HP-UX
131 system. On 11.00, you need to install the latest lancommon/DLPI
132 patches, and then the latest driver patch for the interface(s) in use.
133 At that point, a miracle happens and you should start seeing outbound
136 [That article also mentions the patch that appears below.]
140 http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=586494200
144 Newsgroups: comp.sys.hp.hpux
145 Subject: Re: tcpdump only shows incoming packets
147 From: Harald Skotnes <harald@cc.uit.no>
153 > What you are seeing is expected, un-patched, behaviour for an HP-UX
154 > system. On 11.00, you need to install the latest lancommon/DLPI
155 > patches, and then the latest driver patch for the interface(s) in
156 > use. At that point, a miracle happens and you should start seeing
159 Thanks a lot. I have this problem on several machines running HPUX
160 10.20 and 11.00. The machines where patched up before y2k so did not
161 know what to think. Anyway I have now installed PHNE_19766,
162 PHNE_19826, PHNE_20008, PHNE_20735 on the C200 and now I can see the
163 outbound traffic too. Thanks again.
167 http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=457744130
169 indicates that you need to install the optional STREAMS product to do
170 captures on HP-UX 9.x:
172 Newsgroups: comp.sys.hp.hpux
173 Subject: Re: tcpdump HP/UX 9.x
175 From: Rick Jones <foo@bar.baz>
177 Dave Barr (barr@cis.ohio-state.edu) wrote:
178 : Has anyone ported tcpdump (or something similar) to HP/UX 9.x?
180 I'm reasonably confident that any port of tcpdump to 9.X would require
181 the (then optional) STREAMS product. This would bring DLPI, which is
182 what one uses to access interfaces in promiscuous mode.
184 I'm not sure that HP even sells the 9.X STREAMS product any longer,
185 since HP-UX 9.X is off the pricelist (well, maybe 9.10 for the old 68K
188 Your best bet is to be up on 10.20 or better if that is at all
189 possible. If your hardware is supported by it, I'd go with HP-UX 11.
190 If you want to see the system's own outbound traffic, you'll never get
191 that functionality on 9.X, but it might happen at some point for 10.20
196 (as per other messages cited here, the ability to see the system's own
197 outbound traffic did happen).
199 Another note, from a mail message to the "ethereal-users" list:
201 Date: Wed, 22 Dec 1999 09:05:47 -0600 (EST)
202 From: Gerald Combs <gerald@zing.org>
203 To: Lothar Seitter <lothar.seitter@arcormail.de>
204 cc: ethereal-users@zing.org
205 Subject: Re: [ethereal-users] permission problem with capturing
207 On Wed, 22 Dec 1999, Lothar Seitter wrote:
209 > running 'ethereal' under HP-UX 11 with root permission and
210 > /dev/lan0 set to 777, I always get the message:
211 > "There are no network interfaces that can be opened.
212 > Please to make sure you have sufficient permission to
215 > I start ethereal with 'etheral -i lan0' and lan0 is definitely
218 > What am I missing???
220 You may need to reference the card's DLPI device directly. We were having
221 trouble getting Ethereal to capture on an HP-UX 10.20 machine here. I
222 found an article on Deja News that says:
224 "To access a particular interface, you would say "tcpdump -i /dev/dlpiN"
225 where N is the PPA of the interface you wish to use. You get the PPA by
226 looking at the output of lanscan. On 10.20, it is the same value as the
227 NMID. On 11.X, it is the Card Instance number."
229 This didn't help in our case, but it might in yours. The full article is
230 at http://x34.deja.com/[ST_rn=ps]/getdoc.xp?AN=549366486 .
232 Another article by the same author mentions that experimental versions of
233 libpcap and tcpdump are available at
234 ftp://ftp.cup.hp.com/dist/networking/tools/ . The article itself is at
235 http://x34.deja.com/[ST_rn=ps]/getdoc.xp?AN=558665378 .
237 The first of those articles also says:
239 BTW, before you have to make a follow-up post, you will find that
240 unless you have the latest lan common/DLPI/driver patches installed,
241 you will _not_ see the system's own outbound traffic.
243 An additional note, from Jost Martin, for HP-UX 10.20:
245 Q: How do I get ethereral on HPUX to capture the _outgoing_ packets
247 A: You need to get PHNE_20892,PHNE_20725 and PHCO_10947 (or
248 newer, this is as of 4.4.00) and its dependencies. Then you can
249 enable the feature as descibed below:
251 Patch Name: PHNE_20892
252 Patch Description: s700 10.20 PCI 100Base-T cumulative patch
253 To trace the outbound packets, please do the following
254 to turn on a global promiscuous switch before running
255 the promiscuous applications like snoop or tcpdump:
257 adb -w /stand/vmunix /dev/mem
258 lanc_outbound_promisc_flag/W 1
259 (adb will echo the result showing that the flag has
262 (Thanks for this part to HP-support, Ratingen)
264 The attached hack does this and some security-related stuff
265 (thanks to hildeb@www.stahl.bau.tu-bs.de (Ralf Hildebrandt) who
266 posted the security-part some time ago)
270 (Don't switch IP-forwarding off, if you need it !)
271 Install the hack as /sbin/init.d/hacl_ip_stack (adjust
272 permissions !) and make a sequencing-symlink
273 /sbin/rc2.d/S350hack_ip_stack pointing to this script.
274 Now all this is done on every reboot.
276 Here's the "hack_ip_stack" script:
278 -----------------------------------Cut Here-------------------------------------
281 # nettune: hack kernel parms for safety
286 # /usr/contrib/bin fuer nettune auf Pfad
287 PATH=/sbin:/usr/sbin:/usr/bin:/usr/contrib/bin
297 print "Tune IP-Stack for security"
302 print "This action is not applicable"
314 print "USAGE: $0 {start_msg | stop_msg | start | stop}" >&2
324 # tcp-Sequence-Numbers nicht mehr inkrementieren sondern random
325 # Syn-Flood-Protection an
328 # Ausgehende Packets an ethereal/tcpdump etc.
330 /usr/contrib/bin/nettune -s tcp_random_seq 2 || exit $ERROR
331 /usr/contrib/bin/nettune -s hp_syn_protect 1 || exit $ERROR
332 /usr/contrib/bin/nettune -s ip_forwarding 0 || exit $ERROR
333 echo 'ip_block_source_routed/W1' | /usr/bin/adb -w /stand/vmunix /dev/kmem || exit $ERROR
334 echo 'lanc_outbound_promisc_flag/W 1' | adb -w /stand/vmunix /dev/mem || exit $ERROR
337 -----------------------------------Cut Here-------------------------------------
339 It appears that a consequence of the fact that HP-UX's DLPI doesn't work
340 like Solaris's, in that, on Solaris, to get at the device "hme0", say,
341 "libpcap" has to open "/dev/hme" and then tell it to use the 0th
342 interface, whilst on HP-UX you have to go through "/dev/dlpi", you won't
343 get a list of interfaces in the dialog box for "Capture:Start" - you'll
344 have to do through the aforementioned song and dance to find the PPA of
345 the interface you want to use, and supply the "dlpiN" name by hand (I
346 think you can omit the "/dev/" in both tcpdump and Ethereal).
348 Here is a patch to "pcap-dlpi.c" in libpcap that, at least on HP-UX
349 11.X, allows the name of the network interface, rather than the "dlpiN"
350 name, to be specified to tcpdump and Ethereal. It has not been tried on
351 HP-UX 10.20; it fixes one bug that could have caused the code in vanilla
352 libpcap not to correctly find the PPA for an interface on HP-UX 10.20,
353 but HP-UX 10.20's DLPI doesn't supply, in the data returned by a
354 DL_HP_PPA_REQ request, network interface names, so, on systems without
355 the network interface names in that data, the code continues to check
356 the major device number.
358 On HP-UX 11.00, the patch allows a network interface to be specified by
359 name as an argument to tcpdump, rather than requiring that you specify a
360 "dlpiN" name (and it should work equally well with Ethereal).
362 If you try this code on HP-UX 10.20, and it doesn't let you specify the
363 interface by name, please send mail to ethereal-dev@zing.org, so that we
364 know that it didn't work - we'll probably send you debugging patches in
365 the hopes of being able to make it work on 10.20 as well.
367 Here's the patch (to vanilla libpcap 0.4; it patches "configure",
368 "aclocal.m4", and "configure.in", to make the configure script check
369 whether your version of HP-UX supplies the interface names in the reply
370 to a DL_HP_PPA_REQ request, and "pcap-dlpi.c"):
372 *** ../libpcap-0.4/configure Sat Jul 25 12:41:51 1998
373 --- configure Fri Jan 14 00:40:04 2000
379 echo $ac_n "checking if unaligned accesses fail""... $ac_c" 1>&6
380 ! echo "configure:1707: checking if unaligned accesses fail" >&5
381 if eval "test \"`echo '$''{'ac_cv_lbl_unaligned_fail'+set}'`\" = set"; then
382 echo $ac_n "(cached) $ac_c" 1>&6
388 + echo $ac_n "checking if dl_hp_ppa_info_t struct has dl_module_id_1 member""... $ac_c" 1>&6
389 + echo "configure:1707: checking if dl_hp_ppa_info_t struct has dl_module_id_1 member" >&5
390 + if eval "test \"`echo '$''{'ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1'+set}'`\" = set"; then
391 + echo $ac_n "(cached) $ac_c" 1>&6
393 + cat > conftest.$ac_ext <<EOF
394 + #line 1712 "configure"
395 + #include "confdefs.h"
397 + # include <sys/types.h>
398 + # include <sys/dlpi.h>
399 + # include <sys/dlpi_ext.h>
401 + u_int i = sizeof(((dl_hp_ppa_info_t *)0)->dl_module_id_1)
404 + if { (eval echo configure:1722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
406 + ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1=yes
408 + echo "configure: failed program was:" >&5
409 + cat conftest.$ac_ext >&5
411 + ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1=no
416 + echo "$ac_t""$ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1" 1>&6
417 + if test $ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1 = yes ; then
418 + cat >> confdefs.h <<\EOF
419 + #define HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1 1
424 echo $ac_n "checking if unaligned accesses fail""... $ac_c" 1>&6
425 ! echo "configure:1743: checking if unaligned accesses fail" >&5
426 if eval "test \"`echo '$''{'ac_cv_lbl_unaligned_fail'+set}'`\" = set"; then
427 echo $ac_n "(cached) $ac_c" 1>&6
431 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
432 # ./install, which can be erroneously created by make from ./install.sh.
433 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
434 ! echo "configure:1803: checking for a BSD compatible install" >&5
435 if test -z "$INSTALL"; then
436 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
437 echo $ac_n "(cached) $ac_c" 1>&6
439 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
440 # ./install, which can be erroneously created by make from ./install.sh.
441 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
442 ! echo "configure:1839: checking for a BSD compatible install" >&5
443 if test -z "$INSTALL"; then
444 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
445 echo $ac_n "(cached) $ac_c" 1>&6
448 *** ../libpcap-0.4/aclocal.m4 Fri Jun 12 03:45:15 1998
449 --- aclocal.m4 Tue Jan 4 21:02:13 2000
456 + dnl Checks to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
457 + dnl dl_module_id_1 member
461 + dnl AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
465 + dnl HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1 (defined)
467 + dnl NOTE: any compile failure means we conclude that it doesn't have
468 + dnl that member, so if we don't have DLPI, don't have a <sys/dlpi_ext.h>
469 + dnl header, or have one that doesn't declare a dl_hp_ppa_info_t type,
470 + dnl we conclude it doesn't have that member (which is OK, as either we
471 + dnl won't be using code that would use that member, or we wouldn't
472 + dnl compile in any case).
474 + AC_DEFUN(AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1,
475 + [AC_MSG_CHECKING(if dl_hp_ppa_info_t struct has dl_module_id_1 member)
476 + AC_CACHE_VAL(ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1,
478 + # include <sys/types.h>
479 + # include <sys/dlpi.h>
480 + # include <sys/dlpi_ext.h>],
481 + [u_int i = sizeof(((dl_hp_ppa_info_t *)0)->dl_module_id_1)],
482 + ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1=yes,
483 + ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1=no))
484 + AC_MSG_RESULT($ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1)
485 + if test $ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1 = yes ; then
486 + AC_DEFINE(HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1)
490 dnl Checks to see if -R is used
495 *** ../libpcap-0.4/configure.in Sun Jul 27 22:16:22 1997
496 --- configure.in Tue Jan 4 21:02:13 2000
501 AC_LBL_SOCKADDR_SA_LEN
503 + AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
505 AC_LBL_UNALIGNED_ACCESS
507 if test "${srcdir}" = "." ; then
509 *** ../libpcap-0.4/pcap-dlpi.c Wed Oct 15 21:59:34 1997
510 --- pcap-dlpi.c Tue Jan 4 21:02:13 2000
514 memset(p, 0, sizeof(*p));
517 ! ** Determine device and ppa
519 ! cp = strpbrk(device, "0123456789");
521 sprintf(ebuf, "%s missing unit number", device);
525 memset(p, 0, sizeof(*p));
527 + #ifdef HAVE_DEV_DLPI
529 ! ** Remove any "/dev/" on the front of the device.
531 ! cp = strrchr(device, '/');
539 ! * Split the name into a device type and a unit number.
541 ! cp = strpbrk(dname, "0123456789");
543 sprintf(ebuf, "%s missing unit number", device);
547 sprintf(ebuf, "%s bad unit number", device);
551 ! if (*device == '/')
552 ! strcpy(dname, device);
554 ! sprintf(dname, "%s/%s", PCAP_DEV_PREFIX, device);
555 ! #ifdef HAVE_DEV_DLPI
556 ! /* Map network device to /dev/dlpi unit */
558 if ((p->fd = open(cp, O_RDWR)) < 0) {
559 sprintf(ebuf, "%s: %s", cp, pcap_strerror(errno));
562 ! /* Map network interface to /dev/dlpi unit */
563 ppa = get_dlpi_ppa(p->fd, dname, ppa, ebuf);
567 /* Try device without unit number */
568 strcpy(dname2, dname);
569 cp = strchr(dname, *cp);
571 sprintf(ebuf, "%s bad unit number", device);
577 ! * Use "/dev/dlpi" as the device.
579 ! * XXX - HP's DLPI Programmer's Guide for HP-UX 11.00 says that
580 ! * the "dl_mjr_num" field is for the "major number of interface
581 ! * driver"; that's the major of "/dev/dlpi" on the system on
582 ! * which I tried this, but there may be DLPI devices that
583 ! * use a different driver, in which case we may need to
584 ! * search "/dev" for the appropriate device with that major
585 ! * device number, rather than hardwiring "/dev/dlpi".
587 ! * I'm assuming that the code that was used for HP-UX 10.x
588 ! * is valid, and therefore that, in 10.x, DLPIable devices have
589 ! * "/dev" entries corresponding to them and that their
590 ! * major device number is what appears in the "dl_hp_ppa_info_t"
591 ! * structure for that device. We can search by name in 11.x
592 ! * (and we may have to, as it's not clear that DLPIable devices
593 ! * will have those sorts of "/dev" entries), but we can't in
594 ! * 10.x, as 10.x doesn't have the "dl_module_id_1" and
595 ! * "dl_module_id_2" members in the "dl_hp_ppa_info_t" structure.
598 if ((p->fd = open(cp, O_RDWR)) < 0) {
599 sprintf(ebuf, "%s: %s", cp, pcap_strerror(errno));
604 ! * Get a table of all PPAs for that device, and search that
605 ! * table for the specified device type name and unit number.
607 ppa = get_dlpi_ppa(p->fd, dname, ppa, ebuf);
612 + ** Determine device and ppa
614 + cp = strpbrk(device, "0123456789");
616 + sprintf(ebuf, "%s missing unit number", device);
619 + ppa = strtol(cp, &eos, 10);
620 + if (*eos != '\0') {
621 + sprintf(ebuf, "%s bad unit number", device);
625 + if (*device == '/')
626 + strcpy(dname, device);
628 + sprintf(dname, "%s/%s", PCAP_DEV_PREFIX, device);
630 /* Try device without unit number */
631 strcpy(dname2, dname);
632 cp = strchr(dname, *cp);
638 ! sprintf(ebuf, "unknown mac type 0x%lu", infop->dl_mac_type);
646 ! sprintf(ebuf, "unknown mac type 0x%lu",
647 ! (unsigned long)infop->dl_mac_type);
654 #ifdef DL_HP_PPA_ACK_OBS
656 ! * Under HP-UX 10, we can ask for the ppa
662 #ifdef DL_HP_PPA_ACK_OBS
664 ! * Under HP-UX 10 and HP-UX 11, we can ask for the ppa
672 register dl_hp_ppa_ack_t *ap;
673 ! register dl_hp_ppa_info_t *ip;
675 register u_long majdev;
676 - dl_hp_ppa_req_t req;
678 bpf_u_int32 buf[MAXDLBUF];
680 ! if (stat(device, &statbuf) < 0) {
681 ! sprintf(ebuf, "stat: %s: %s", device, pcap_strerror(errno));
684 majdev = major(statbuf.st_rdev);
686 memset((char *)&req, 0, sizeof(req));
687 req.dl_primitive = DL_HP_PPA_REQ;
691 register dl_hp_ppa_ack_t *ap;
692 ! register dl_hp_ppa_info_t *ipstart, *ip;
694 + #ifndef HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1
696 register u_long majdev;
699 + dl_hp_ppa_req_t req;
700 bpf_u_int32 buf[MAXDLBUF];
702 ! #ifndef HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1
704 ! * HP-UX 10 doesn't put the interface name in the
705 ! * "dl_hp_ppa_info_t" structure, so we have to
706 ! * try to get the major device number for the device
707 ! * corresponding to the device and unit name provided to
708 ! * us, and search for the entry with that major device number.
710 ! sprintf(dname, "/dev/%s%d", device, unit);
711 ! if (stat(dname, &statbuf) < 0) {
712 ! sprintf(ebuf, "stat: %s: %s", dname, pcap_strerror(errno));
715 majdev = major(statbuf.st_rdev);
718 memset((char *)&req, 0, sizeof(req));
719 req.dl_primitive = DL_HP_PPA_REQ;
724 ap = (dl_hp_ppa_ack_t *)buf;
725 ! ip = (dl_hp_ppa_info_t *)((u_char *)ap + ap->dl_offset);
727 for(i = 0; i < ap->dl_count; i++) {
728 ! if (ip->dl_mjr_num == majdev && ip->dl_instance_num == unit)
731 ! ip = (dl_hp_ppa_info_t *)((u_char *)ip + ip->dl_next_offset);
733 if (i == ap->dl_count) {
734 ! sprintf(ebuf, "can't find PPA for %s", device);
737 if (ip->dl_hdw_state == HDW_DEAD) {
738 ! sprintf(ebuf, "%s: hardware state: DOWN\n", device);
741 return ((int)ip->dl_ppa);
745 ap = (dl_hp_ppa_ack_t *)buf;
746 ! ipstart = (dl_hp_ppa_info_t *)((u_char *)ap + ap->dl_offset);
749 for(i = 0; i < ap->dl_count; i++) {
750 ! #ifdef HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1
751 ! if ((strcmp(ip->dl_module_id_1, device) == 0 ||
752 ! strcmp(ip->dl_module_id_2, device) == 0) &&
754 ! if (ip->dl_mjr_num == majdev &&
756 ! ip->dl_instance_num == unit)
759 ! ip = (dl_hp_ppa_info_t *)((u_char *)ipstart + ip->dl_next_offset);
761 if (i == ap->dl_count) {
762 ! sprintf(ebuf, "can't find PPA for %s%d", device, unit);
765 if (ip->dl_hdw_state == HDW_DEAD) {
766 ! sprintf(ebuf, "%s%d: hardware state: DOWN\n", device, unit);
769 return ((int)ip->dl_ppa);
775 ! char if_name[sizeof(ifnet.if_name)], tifname[32];
777 cp = strrchr(ifname, '/');
783 ! char if_name[sizeof(ifnet.if_name) + 1];
785 cp = strrchr(ifname, '/');
789 if (dlpi_kread(kd, (off_t)addr,
790 &ifnet, sizeof(ifnet), ebuf) < 0 ||
791 dlpi_kread(kd, (off_t)ifnet.if_name,
792 ! if_name, sizeof(if_name), ebuf) < 0) {
796 ! sprintf(tifname, "%.*s%d",
797 ! (int)sizeof(if_name), if_name, ifnet.if_unit);
798 ! if (strcmp(tifname, ifname) == 0)
799 return (ifnet.if_index);
803 if (dlpi_kread(kd, (off_t)addr,
804 &ifnet, sizeof(ifnet), ebuf) < 0 ||
805 dlpi_kread(kd, (off_t)ifnet.if_name,
806 ! if_name, sizeof(ifnet.if_name), ebuf) < 0) {
810 ! if_name[sizeof(ifnet.if_name)] = '\0';
811 ! if (strcmp(if_name, ifname) == 0 && ifnet.if_unit == unit)
812 return (ifnet.if_index);