- use RESERVE_CONFIG_BUFFER. For defconfig this gives:

text	   data	    bss	    dec	    hex	filename
   3627	      4	    120	   3751	    ea7	networking/arping.o.oorig
   3548	      4	     96	   3648	    e40	networking/arping.o.r14710
   3520	      4	     96	   3620	    e24	networking/arping.o
This commit is contained in:
Bernhard Reutner-Fischer 2006-03-31 18:13:42 +00:00
parent e47c4cbd4d
commit 2766eedde8

View File

@ -71,7 +71,7 @@ static int send_pack(int sock, struct in_addr *src_addr,
{ {
int err; int err;
struct timeval now; struct timeval now;
unsigned char buf[256]; RESERVE_CONFIG_UBUFFER(buf, 256);
struct arphdr *ah = (struct arphdr *) buf; struct arphdr *ah = (struct arphdr *) buf;
unsigned char *p = (unsigned char *) (ah + 1); unsigned char *p = (unsigned char *) (ah + 1);
@ -105,6 +105,7 @@ static int send_pack(int sock, struct in_addr *src_addr,
if (!(cfg&unicasting)) if (!(cfg&unicasting))
brd_sent++; brd_sent++;
} }
RELEASE_CONFIG_BUFFER(buf);
return err; return err;
} }
@ -456,12 +457,12 @@ int arping_main(int argc, char **argv)
while (1) { while (1) {
sigset_t sset, osset; sigset_t sset, osset;
unsigned char packet[4096]; RESERVE_CONFIG_UBUFFER(packet, 4096);
struct sockaddr_ll from; struct sockaddr_ll from;
socklen_t alen = sizeof(from); socklen_t alen = sizeof(from);
int cc; int cc;
if ((cc = recvfrom(s, packet, sizeof(packet), 0, if ((cc = recvfrom(s, packet, 4096, 0,
(struct sockaddr *) &from, &alen)) < 0) { (struct sockaddr *) &from, &alen)) < 0) {
perror("recvfrom"); perror("recvfrom");
continue; continue;
@ -472,5 +473,6 @@ int arping_main(int argc, char **argv)
sigprocmask(SIG_BLOCK, &sset, &osset); sigprocmask(SIG_BLOCK, &sset, &osset);
recv_pack(packet, cc, &from); recv_pack(packet, cc, &from);
sigprocmask(SIG_SETMASK, &osset, NULL); sigprocmask(SIG_SETMASK, &osset, NULL);
RELEASE_CONFIG_BUFFER(packet);
} }
} }