"Fossies" - the Fresh Open Source Software Archive

Member "fake-1.1.11/send_arp.dev.patch" (8 Jul 2009, 1214 Bytes) of package /linux/misc/old/fake-1.1.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 --- send_arp.orig/send_arp.c    Mon Jan  7 05:07:03 2002
    2 +++ send_arp/send_arp.c Mon Jan  7 05:08:09 2002
    3 @@ -35,7 +35,7 @@
    4  #define DEFAULT_DEVICE "eth0"
    5  
    6  char usage[]={"send_arp: sends out custom ARP packet. yuri volobuev'97\n\
    7 -\tusage: send_arp src_ip_addr src_hw_addr targ_ip_addr tar_hw_addr\n\n"};
    8 +usage: send_arp src_ip_addr src_hw_addr targ_ip_addr targ_hw_addr [targ_int]\n\n"};
    9  
   10  struct arp_packet {
   11          u_char targ_hw_addr[ETH_HW_ADDR_LEN];
   12 @@ -62,9 +62,11 @@
   13  struct in_addr src_in_addr,targ_in_addr;
   14  struct arp_packet pkt;
   15  struct sockaddr sa;
   16 +char *c;
   17 +int n;
   18  int sock;
   19  
   20 -if(argc != 5)die(usage);
   21 +if(argc != 5 && argc !=6)die(usage);
   22  
   23  sock=socket(AF_INET,SOCK_PACKET,htons(ETH_P_RARP));
   24  if(sock<0){
   25 @@ -92,7 +94,17 @@
   26  
   27  bzero(pkt.padding,18);
   28  
   29 -strcpy(sa.sa_data,DEFAULT_DEVICE);
   30 +if (argc!=6) {
   31 +        strcpy(sa.sa_data,DEFAULT_DEVICE);
   32 +} else {
   33 +       if ((c=strchr(argv[5], ':'))) {
   34 +               n=c-argv[5];
   35 +               strncpy(sa.sa_data, argv[5], n);
   36 +               *(sa.sa_data+n)='\0';
   37 +       } else {
   38 +               strcpy(sa.sa_data, argv[5]);
   39 +       }
   40 +}
   41  if(sendto(sock,&pkt,sizeof(pkt),0,&sa,sizeof(sa)) < 0){
   42          perror("sendto");
   43          exit(1);