r34180 - in /branches/upstream/libnet-arp-perl/current: ARP.pm ARP.xs Changes arp.h get_mac_linux.c send_packet_linux.c

thialme-guest at users.alioth.debian.org thialme-guest at users.alioth.debian.org
Sun Apr 26 19:58:24 UTC 2009


Author: thialme-guest
Date: Sun Apr 26 19:58:19 2009
New Revision: 34180

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=34180
Log:
[svn-upgrade] Integrating new upstream version, libnet-arp-perl (1.0.4)

Modified:
    branches/upstream/libnet-arp-perl/current/ARP.pm
    branches/upstream/libnet-arp-perl/current/ARP.xs
    branches/upstream/libnet-arp-perl/current/Changes
    branches/upstream/libnet-arp-perl/current/arp.h
    branches/upstream/libnet-arp-perl/current/get_mac_linux.c
    branches/upstream/libnet-arp-perl/current/send_packet_linux.c

Modified: branches/upstream/libnet-arp-perl/current/ARP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-arp-perl/current/ARP.pm?rev=34180&op=diff
==============================================================================
--- branches/upstream/libnet-arp-perl/current/ARP.pm (original)
+++ branches/upstream/libnet-arp-perl/current/ARP.pm Sun Apr 26 19:58:19 2009
@@ -87,6 +87,8 @@
 This module can be used to create and send ARP packets and to
 get the mac address of an ethernet interface or ip address.
 
+=over
+
 =item B<send_packet()>
 
   Net::ARP::send_packet('lo',                 # Device
@@ -117,6 +119,8 @@
   and stores it in the variable $mac. The return value is 
   "unknown" if the mac cannot be looked up.
 
+=back
+
 =head1 SEE ALSO
 
  man -a arp

Modified: branches/upstream/libnet-arp-perl/current/ARP.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-arp-perl/current/ARP.xs?rev=34180&op=diff
==============================================================================
--- branches/upstream/libnet-arp-perl/current/ARP.xs (original)
+++ branches/upstream/libnet-arp-perl/current/ARP.xs Sun Apr 26 19:58:19 2009
@@ -27,6 +27,7 @@
 #include <string.h>          
 #include <errno.h>           
 #include <net/ethernet.h>    
+#include <netinet/ether.h>
 #include <net/if.h>
 #include <arpa/inet.h>       
 #include "arp.h"
@@ -44,11 +45,12 @@
 
 	CODE:
 	  int uid;
-	  unsigned int packetsize = sizeof(struct arphdr) + sizeof(struct ether_header);
+	  unsigned int packetsize = sizeof(struct my_arphdr) + sizeof(struct ether_header);
 	  unsigned char packet[packetsize];
 	  struct ether_header *ethhdr = (struct ether_header *)packet;
-	  struct arphdr *arp = (struct arphdr *)(packet + sizeof(struct ether_header));
+	  struct my_arphdr *arp = (struct my_arphdr *)(packet + sizeof(struct ether_header));
 	  u_short op;	
+	  in_addr_t ipaddr;
 
           RETVAL = 1;
 
@@ -158,12 +160,15 @@
 	        arp->pa_len = IP_ALEN;                                                 // Protocol address length
 	        arp->opcode = htons(op);                                               // ARP operation
 	        memcpy(arp->source_add,(u_char *)ether_aton(smac),ETH_ALEN);           // Source MAC
-	        *(u_long *)arp->source_ip = inet_addr(sip);                            // Source IP
+		ipaddr = inet_addr(sip);
+		memcpy(arp->source_ip, (u_char *)&ipaddr, IP_ALEN);		       // Source IP
 
 	        if(strcmp(dmac,"ff:ff:ff:ff:ff:ff"))
-          		memcpy(arp->dest_add,(u_char *)ether_aton(dmac),ETH_ALEN);       // Destination MAC
-
-	         *(u_long *)arp->dest_ip = inet_addr(dip);                              // Destination IP
+          		memcpy(arp->dest_add,(u_char *)ether_aton(dmac),ETH_ALEN);     // Destination MAC
+
+		ipaddr = inet_addr(dip);
+		memcpy(arp->dest_ip, (u_char *)&ipaddr, IP_ALEN);		       // Destination IP
+
 
 
 	         // Run packet!! Run!
@@ -185,8 +190,8 @@
 
 char *
 get_mac(dev)
+	unsigned char *dev;
 	CODE:
-	  char dev[16];
           char tmp[20] = "unknown";
 
 	  if(SOCK_TYPE == SOCK_RAW)

Modified: branches/upstream/libnet-arp-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-arp-perl/current/Changes?rev=34180&op=diff
==============================================================================
--- branches/upstream/libnet-arp-perl/current/Changes (original)
+++ branches/upstream/libnet-arp-perl/current/Changes Sun Apr 26 19:58:19 2009
@@ -1,3 +1,8 @@
+Changes between 1.0.3 and 1.0.4
+
+fix FTBFS due to unaligned assignment problems by Niko Tyni <ntyni at debian.org>
+get_mac unknown device fix by Franck Joncourt <franck.mail at dthconnex.com>
+
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
 Changes between 1.0.2 and 1.0.3

Modified: branches/upstream/libnet-arp-perl/current/arp.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-arp-perl/current/arp.h?rev=34180&op=diff
==============================================================================
--- branches/upstream/libnet-arp-perl/current/arp.h (original)
+++ branches/upstream/libnet-arp-perl/current/arp.h Sun Apr 26 19:58:19 2009
@@ -43,7 +43,7 @@
 #define IP_ALEN          4
 
 // ARP Header Struktur
-struct arphdr {
+struct my_arphdr {
    u_short hw_type;             // hardware type
    u_short proto_type;          // protocol type
    u_char ha_len;               // hardware address len

Modified: branches/upstream/libnet-arp-perl/current/get_mac_linux.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-arp-perl/current/get_mac_linux.c?rev=34180&op=diff
==============================================================================
--- branches/upstream/libnet-arp-perl/current/get_mac_linux.c (original)
+++ branches/upstream/libnet-arp-perl/current/get_mac_linux.c Sun Apr 26 19:58:19 2009
@@ -23,6 +23,9 @@
 #include <stdlib.h>
 #include <sys/ioctl.h>
 #include <net/ethernet.h>    
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include <net/if.h>
 
 int get_mac_linux(u_char *dev, char *mac)

Modified: branches/upstream/libnet-arp-perl/current/send_packet_linux.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-arp-perl/current/send_packet_linux.c?rev=34180&op=diff
==============================================================================
--- branches/upstream/libnet-arp-perl/current/send_packet_linux.c (original)
+++ branches/upstream/libnet-arp-perl/current/send_packet_linux.c Sun Apr 26 19:58:19 2009
@@ -22,6 +22,11 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/socket.h>      
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <arpa/inet.h>
+#include <unistd.h>
 #include "arp.h"
 
 int send_packet_linux(u_char *dev, u_char *packet, u_int packetsize)




More information about the Pkg-perl-cvs-commits mailing list