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 17:03:30 -0700 (PDT)
Or try this patch, which tries both 1537 and 0 as SAPs, and may be a little more robust in the face of the various "features" of AIX's DLPI providers (e.g., the "feature" wherein it apparently rejects attempts to bind "/dev/dlpi/en" to SAPs that aren't valid Ethernet types, i.e. not > 1536, but still apparently requires that you bind to a SAP even though you're later going to request DL_PROMISC_SAP mode so that you get packets for *all* SAPs). > Use "--with-pcap=dlpi" when configuring. ...or else the code in question won't be used. If you don't use it, BPF is used instead; unfortunately, AIX's BPF is non-standard, undocumented, and supported only for the use of the tcpdump that comes with AIX, and appears to have problems if you try to use it in standard libpcap. Without testing this patch, we will be unable to help you, and you will be unable to use Ethereal on Token Ring networks on AIX.
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:59:05 *************** *** 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 *); *************** *** 361,370 **** */ #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 --- 363,381 ---- */ #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 if 1537 ! ** fails, we try 0, in the hopes that it'll work (perhaps we ! ** need to use 1537 on "/dev/dlpi/en" because that device is ! ** for D/I/X Ethernet, the "SAP" is actually an Ethernet type, ! ** and it rejects invalid Ethernet types). ! */ ! if ((dlbindreq(p->fd, 15370, ebuf) < 0 && ! dlbindreq(p->fd, 0, ebuf) < 0) || #else if (dlbindreq(p->fd, 0, ebuf) < 0 || #endif *************** *** 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) { --- 656,819 ---- #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++ != '.') --- 924,930 ---- 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++ != '.')
- References:
- Re: [Ethereal-users] running ethereal on aix
- From: Guy Harris
- Re: [Ethereal-users] running ethereal on aix
- Prev by Date: Re: [Ethereal-users] running ethereal on aix
- Next by Date: Re: [Ethereal-users] Question about Capture Filters
- Previous by thread: Re: [Ethereal-users] running ethereal on aix
- Next by thread: Re: [Ethereal-users] running ethereal on aix
- Index(es):