hi , forgive me if i am completely offtrack ... just a novice ..
the following code binds the AF_P... , SOCK_R... to a device easily ...
is there a difference between this approach and using the bind command and
sockaddr_ll ???
________________________________________________________________________
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <errno.h>
#include <net/if.h>
int main(int argv, char **args)
{
int s;
char *dev;
dev = "eth0";
if ((s = socket(AF_PACKET, SOCK_RAW, 0)) < 0)
{
if (errno == EPERM)
printf("Must be run as root\n");
printf("open_agent_icmp_socket - socket: %s\n",strerror(errno));
return -1;
}
if (dev != NULL &&
setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, dev, IFNAMSIZ))
{
printf("open_agent_icmp_socket - setsockopt(SOL_SOCKET, SO_BINDTODEVICE):
%s\n",
strerror(errno));
close(s);
return -1;
}
}
__________________________________________________________________________
Vijay Thirumalai wrote:
> Hi Alan and netters...
> Based on the mail i sent before about tapping the network , i
> attempted to create a socket with AF_PACKET, SOCK_RAW (bcos SOCK_PACKET
> is obsolete) and then attempt to BIND it to the interface....thats where
> the problem is...It does not bind itself to the interface...and i see a
> couple of mails in the archive about this the end of last week ...Could
> someone give me pointers as to why this happens...or if someone has an
> application that uses this.it would be of great help.
> Thanks a lot
> -VJ
>
> -
--
sorry for such a lame email address ... can't block my main account with
around 1000 mails everyday
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]