The intention is to write a packet sniffer for svr4.
[ UnixWare SVR4.2 v1.0.3 +upbnu4, ne2k (ne200) or ee16 (intel EtherExpress) ]
It's known that svr4 implementations of network drivers are conformant to
DLPI specs (more or less).
The idea was to register all possible for my network DLSAPs
(i.e. "type" field of Ethernet packets; 8137 for Novell's,
0x800 and 0x806 for IP and arp respectivly) that would guarantee, as I thought,
those packets would come rigth to my application.
But after requesting info (DL_INFO_REQ), succesfully binding 8137 SAP and
turning on PROMISC ( ioctl ) mode I was trying to "getmsg" , but it hung...
What's wrong ?
PS: I dont have any books (or examples) on SVR4 Network Programming :(
__
Details:
bind_req=(dl_bind_req_t*)malloc(sizeof(dl_bind_req_t));
bind_req->dl_primitive=DL_BIND_REQ;
bind_req->dl_sap= 8137; /* (media_sp->promisc_sap);*/
bind_req->dl_service_mode = DL_CLDLS ; /* connectionless mode */
[ DL_BIND_ACK returns my_ether_addr:c9:1f ]
if (ioctl(fd,DLIOCSPROMISC)<0){
[ OK. I see it at the NE2000 LED as well ]
do {
if ((ret_val=getmsg(fd , Ctl_M, Dat_M, &Flgs)) < 0){
printf("getmsg failed\n");
exit(1);
}
printf(": %s\n | %s\n", Ctl_M->buf, Dat_M->buf );
} while (ret_val != 0);