ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-users: Re: [Ethereal-users] running ethereal on aix

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 27 Jul 2001 16:05:23 -0700 (PDT)
> Try downloading both libpcap and tcpdump source from tcpdump.org,
> building libpcap and installing it, and then building tcpdump and
> linking it with that libpcap.
> 
> If that works, try linking Ethereal with the same libpcap.
> 
> If that doesn't work, try complaining to somebody in AIXland in Austin,
> asking them either to
> 
> 	1) get the tcpdump.org libpcap and tcpdump to work with whatever
> 	   type of network device tr0 is (Token-Ring?) using DLPI

Or try downloading the latest snapshot from tcpdump.org - look for
"Current Tar files" on the home page, and download
"tcpdump-current.tar.gz" and "libpcap-current.tar.gz" - and then apply
the attached patch to "pcap-dlpi.c" in the libpcap tarball.  Then
configure and build libpcap and tcpdump.  (Make sure tcpdump and libpcap
are unpacked into directories under the same directory, so that tcpdump
is linked with the libpcap you built.)

Use "--with-pcap=dlpi" when configuring.
Index: pcap-dlpi.c
===================================================================
RCS file: /tcpdump/master/libpcap/pcap-dlpi.c,v
retrieving revision 1.68
diff -c -r1.68 pcap-dlpi.c
*** pcap-dlpi.c	2001/06/27 05:22:44	1.68
--- pcap-dlpi.c	2001/07/27 23:01:37
***************
*** 103,108 ****
--- 103,110 ----
  static int dlinforeq(int, char *);
  static int dlokack(int, const char *, char *, char *);
  static int recv_ack(int, int, const char *, char *, char *);
+ static char *dlstrerror(bpf_u_int32);
+ static char *dlprim(bpf_u_int32);
  static int dlpromisconreq(int, bpf_u_int32, char *);
  #if defined(HAVE_SOLARIS) && defined(HAVE_SYS_BUFMOD_H)
  static char *get_release(bpf_u_int32 *, bpf_u_int32 *, bpf_u_int32 *);
***************
*** 356,370 ****
  	    dlokack(p->fd, "attach", (char *)buf, ebuf) < 0))
  		goto bad;
  	/*
  	** Bind (defer if using HP-UX 9 or HP-UX 10.20, totally skip if
  	** using SINIX)
  	*/
  #if !defined(HAVE_HPUX9) && !defined(HAVE_HPUX10_20) && !defined(sinix)
  #ifdef _AIX
!         /* According to IBM's AIX Support Line, the dl_sap value
!         ** should not be less than 0x600 (1536) for standard ethernet 
!          */
! 	if (dlbindreq(p->fd, 1537, ebuf) < 0 ||
  #else
  	if (dlbindreq(p->fd, 0, ebuf) < 0 ||
  #endif
--- 358,410 ----
  	    dlokack(p->fd, "attach", (char *)buf, ebuf) < 0))
  		goto bad;
  	/*
+ 	** Determine link type
+ 	*/
+ 	if (dlinforeq(p->fd, ebuf) < 0 ||
+ 	    dlinfoack(p->fd, (char *)buf, ebuf) < 0)
+ 		goto bad;
+ 
+ 	infop = &((union DL_primitives *)buf)->info_ack;
+ 	switch (infop->dl_mac_type) {
+ 
+ 	case DL_CSMACD:
+ 	case DL_ETHER:
+ 		p->linktype = DLT_EN10MB;
+ 		p->offset = 2;
+ 		break;
+ 
+ 	case DL_FDDI:
+ 		p->linktype = DLT_FDDI;
+ 		p->offset = 3;
+ 		break;
+ 
+ 	case DL_TPR:
+ 		p->linktype = DLT_IEEE802;
+ 		p->offset = 2;
+ 		break;
+ 
+ 	default:
+ 		snprintf(ebuf, PCAP_ERRBUF_SIZE, "unknown mac type %lu",
+ 		    infop->dl_mac_type);
+ 		goto bad;
+ 	}
+ 
+ 	/*
  	** Bind (defer if using HP-UX 9 or HP-UX 10.20, totally skip if
  	** using SINIX)
  	*/
  #if !defined(HAVE_HPUX9) && !defined(HAVE_HPUX10_20) && !defined(sinix)
  #ifdef _AIX
! 	/* According to IBM's AIX Support Line, the dl_sap value
! 	** should not be less than 0x600 (1536) for standard Ethernet.
! 	** However, we seem to get DL_BADADDR - "DLSAP addr in improper
! 	** format or invalid" - errors if we use 1537 on the "tr0"
! 	** device, which, given that its name starts with "tr" and that
! 	** it's IBM, probably means a Token Ring device.  So we try 0
! 	** on non-Ethernet devices, for now.
! 	*/
! 	if (dlbindreq(p->fd,
! 	    (p->linktype == DLT_EN10MB) ? 1537 : 0, ebuf) < 0 ||
  #else
  	if (dlbindreq(p->fd, 0, ebuf) < 0 ||
  #endif
***************
*** 422,459 ****
  		goto bad;
  #endif
  
- 	/*
- 	** Determine link type
- 	*/
- 	if (dlinforeq(p->fd, ebuf) < 0 ||
- 	    dlinfoack(p->fd, (char *)buf, ebuf) < 0)
- 		goto bad;
- 
- 	infop = &((union DL_primitives *)buf)->info_ack;
- 	switch (infop->dl_mac_type) {
- 
- 	case DL_CSMACD:
- 	case DL_ETHER:
- 		p->linktype = DLT_EN10MB;
- 		p->offset = 2;
- 		break;
- 
- 	case DL_FDDI:
- 		p->linktype = DLT_FDDI;
- 		p->offset = 3;
- 		break;
- 
- 	case DL_TPR:
- 		p->linktype = DLT_IEEE802;
- 		p->offset = 2;
- 		break;
- 
- 	default:
- 		snprintf(ebuf, PCAP_ERRBUF_SIZE, "unknown mac type %lu",
- 		    infop->dl_mac_type);
- 		goto bad;
- 	}
- 
  #ifdef	DLIOCRAW
  	/*
  	** This is a non standard SunOS hack to get the ethernet header.
--- 462,467 ----
***************
*** 645,698 ****
  #ifdef DL_HP_PPA_ACK
  	case DL_HP_PPA_ACK:
  #endif
- 
  		/* These are OK */
  		break;
  
  	case DL_ERROR_ACK:
  		switch (dlp->error_ack.dl_errno) {
  
- 		case DL_BADPPA:
- 			snprintf(ebuf, PCAP_ERRBUF_SIZE,
- 			    "recv_ack: %s bad ppa (device unit)", what);
- 			break;
- 
- 
  		case DL_SYSERR:
- 			snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s: %s",
- 			    what, pcap_strerror(dlp->error_ack.dl_unix_errno));
- 			break;
- 
- 		case DL_UNSUPPORTED:
  			snprintf(ebuf, PCAP_ERRBUF_SIZE,
! 			    "recv_ack: %s: Service not supplied by provider",
! 			    what);
  			break;
  
  		default:
! 			snprintf(ebuf, PCAP_ERRBUF_SIZE,
! 			    "recv_ack: %s error 0x%x",
! 			    what, (bpf_u_int32)dlp->error_ack.dl_errno);
  			break;
  		}
  		return (-1);
  
  	default:
  		snprintf(ebuf, PCAP_ERRBUF_SIZE,
! 		    "recv_ack: %s unexpected primitive ack 0x%x ",
! 		    what, (bpf_u_int32)dlp->dl_primitive);
  		return (-1);
  	}
  
  	if (ctl.len < size) {
  		snprintf(ebuf, PCAP_ERRBUF_SIZE,
! 		    "recv_ack: %s ack too small (%d < %d)",
  		    what, ctl.len, size);
  		return (-1);
  	}
  	return (ctl.len);
  }
  
  static int
  dlattachreq(int fd, bpf_u_int32 ppa, char *ebuf)
  {
--- 653,816 ----
  #ifdef DL_HP_PPA_ACK
  	case DL_HP_PPA_ACK:
  #endif
  		/* These are OK */
  		break;
  
  	case DL_ERROR_ACK:
  		switch (dlp->error_ack.dl_errno) {
  
  		case DL_SYSERR:
  			snprintf(ebuf, PCAP_ERRBUF_SIZE,
! 			    "recv_ack: %s: UNIX error - %s",
! 			    what, pcap_strerror(dlp->error_ack.dl_unix_errno));
  			break;
  
  		default:
! 			snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s: %s",
! 			    what, dlstrerror(dlp->error_ack.dl_errno));
  			break;
  		}
  		return (-1);
  
  	default:
  		snprintf(ebuf, PCAP_ERRBUF_SIZE,
! 		    "recv_ack: %s: Unexpected primitive ack %s",
! 		    what, dlprim(dlp->dl_primitive));
  		return (-1);
  	}
  
  	if (ctl.len < size) {
  		snprintf(ebuf, PCAP_ERRBUF_SIZE,
! 		    "recv_ack: %s: Ack too small (%d < %d)",
  		    what, ctl.len, size);
  		return (-1);
  	}
  	return (ctl.len);
  }
  
+ static char *
+ dlstrerror(bpf_u_int32 dl_errno)
+ {
+ 	static char errstring[6+2+8+1];
+ 
+ 	switch (dl_errno) {
+ 
+ 	case DL_ACCESS:
+ 		return "Improper permissions for request";
+ 	case DL_BADADDR:
+ 		return "DLSAP addr in improper format or invalid";
+ 	case DL_BADCORR:
+ 		return "Seq number not from outstand DL_CONN_IND";
+ 	case DL_BADDATA:
+ 		return "User data exceeded provider limit";
+ 	case DL_BADPPA:
+ #ifdef HAVE_DEV_DLPI
+ 		/*
+ 		 * With a single "/dev/dlpi" device used for all
+ 		 * DLPI providers, PPAs have nothing to do with
+ 		 * unit numbers.
+ 		 */
+ 		return "Specified PPA was invalid";
+ #else
+ 		/*
+ 		 * We have separate devices for separate devices;
+ 		 * the PPA is just the unit number.
+ 		 */
+ 		return "Specified PPA (device unit) was invalid";
+ #endif
+ 	case DL_BADPRIM:
+ 		return "Primitive received not known by provider";
+ 	case DL_BADQOSPARAM:
+ 		return "QOS parameters contained invalid values";
+ 	case DL_BADQOSTYPE:
+ 		return "QOS structure type is unknown/unsupported";
+ 	case DL_BADSAP:
+ 		return "Bad LSAP selector";
+ 	case DL_BADTOKEN:
+ 		return "Token used not an active stream";
+ 	case DL_BOUND:
+ 		return "Attempted second bind with dl_max_conind";
+ 	case DL_INITFAILED:
+ 		return "Physical Link initialization failed";
+ 	case DL_NOADDR:
+ 		return "Provider couldn't allocate alt. address";
+ 	case DL_NOTINIT:
+ 		return "Physical Link not initialized";
+ 	case DL_OUTSTATE:
+ 		return "Primitive issued in improper state";
+ 	case DL_SYSERR:
+ 		return "UNIX system error occurred";
+ 	case DL_UNSUPPORTED:
+ 		return "Requested service not supplied by provider";
+ 	case DL_UNDELIVERABLE:
+ 		return "Previous data unit could not be delivered";
+ 	case DL_NOTSUPPORTED:
+ 		return "Primitive is known but not supported";
+ 	case DL_TOOMANY:
+ 		return "Limit exceeded";
+ 	case DL_NOTENAB:
+ 		return "Promiscuous mode not enabled";
+ 	case DL_BUSY:
+ 		return "Other streams for PPA in post-attached";
+ 	case DL_NOAUTO:
+ 		return "Automatic handling XID&TEST not supported";
+ 	case DL_NOXIDAUTO:
+ 		return "Automatic handling of XID not supported";
+ 	case DL_NOTESTAUTO:
+ 		return "Automatic handling of TEST not supported";
+ 	case DL_XIDAUTO:
+ 		return "Automatic handling of XID response";
+ 	case DL_TESTAUTO:
+ 		return "Automatic handling of TEST response";
+ 	case DL_PENDING:
+ 		return "Pending outstanding connect indications";
+ 	default:
+ 		sprintf(errstring, "Error %02x", dl_errno);
+ 		return errstring;
+ 	}
+ }
+ 
+ #define CASERET(s)	case s:  return (# s)
+ 
+ static char *
+ dlprim(bpf_u_int32 prim)
+ {
+ 	static char primbuf[80];
+ 
+ 	switch (prim) {
+ 		CASERET(DL_INFO_REQ);
+ 		CASERET(DL_INFO_ACK);
+ 		CASERET(DL_ATTACH_REQ);
+ 		CASERET(DL_DETACH_REQ);
+ 		CASERET(DL_BIND_REQ);
+ 		CASERET(DL_BIND_ACK);
+ 		CASERET(DL_UNBIND_REQ);
+ 		CASERET(DL_OK_ACK);
+ 		CASERET(DL_ERROR_ACK);
+ 		CASERET(DL_SUBS_BIND_REQ);
+ 		CASERET(DL_SUBS_BIND_ACK);
+ 		CASERET(DL_UNITDATA_REQ);
+ 		CASERET(DL_UNITDATA_IND);
+ 		CASERET(DL_UDERROR_IND);
+ 		CASERET(DL_UDQOS_REQ);
+ 		CASERET(DL_CONNECT_REQ);
+ 		CASERET(DL_CONNECT_IND);
+ 		CASERET(DL_CONNECT_RES);
+ 		CASERET(DL_CONNECT_CON);
+ 		CASERET(DL_TOKEN_REQ);
+ 		CASERET(DL_TOKEN_ACK);
+ 		CASERET(DL_DISCONNECT_REQ);
+ 		CASERET(DL_DISCONNECT_IND);
+ 		CASERET(DL_RESET_REQ);
+ 		CASERET(DL_RESET_IND);
+ 		CASERET(DL_RESET_RES);
+ 		CASERET(DL_RESET_CON);
+ 		default:
+ 			(void) sprintf(primbuf, "unknown primitive 0x%x", prim);
+ 			return (primbuf);
+ 	}
+ }
+ 
  static int
  dlattachreq(int fd, bpf_u_int32 ppa, char *ebuf)
  {
***************
*** 803,809 ****
  	if (sysinfo(SI_RELEASE, buf, sizeof(buf)) < 0)
  		return ("?");
  	cp = buf;
! 	if (!isdigit(*cp))
  		return (buf);
  	*majorp = strtol(cp, &cp, 10);
  	if (*cp++ != '.')
--- 921,927 ----
  	if (sysinfo(SI_RELEASE, buf, sizeof(buf)) < 0)
  		return ("?");
  	cp = buf;
! 	if (!isdigit((unsigned char)*cp))
  		return (buf);
  	*majorp = strtol(cp, &cp, 10);
  	if (*cp++ != '.')