Re: Can anybody correct this code that is used to get/set ARP entries and uses ioctl( )
- From: floyd@xxxxxxxxxx (Floyd L. Davidson)
- Date: Mon, 24 Apr 2006 23:07:40 -0800
"jeniffer" <zenith.of.perfection@xxxxxxxxx> wrote:
This is a C program compiled on gcc compiler that tries to set a new
entry in the arp cache,get an entry and also delete an entry from it.I
have run this program but in the set function Set_Entry function a call
Your code is just loaded with problems. It does not use the
facilities of ANSI/ISO Standard C, which suggests it dates back
prior to perhaps 1990 or so.
Instead of using the example you are, look up the code for /arp/
from any current Linux distribution. You can, for example,
download net-tools-1.60.tar.bz2 from ftp.oss.cc.gatech.edu.
You'll find it on that server at,
/pub/linux/distributions/slackware/slackware-10.2/source/n/tcpip/net-tools-1.60.tar.bz2
And turn your compiler warnings up as high as you can. The
least you would want is a command line like this:
gcc -W -Wall -O2 -o foo foo.c
There are actually several other warnings that can also be enabled
most of the time. The point is to let the compiler help you write
better code. For example, I test short programs with a "generic"
Makefile that uses this command to compile:
gcc -ggdb -O2 -std=c99 -pedantic -Wall -W -Wcast-align \
-Wcast-qual -Wmissing-prototypes -Wshadow \
-Wnested-externs -Wstrict-prototypes -Waggregate-return \
-Wpointer-arith -c foo.c
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.
- References:
- Prev by Date: Re: Syntax somewhere??
- Next by Date: pppoe-server replies never make it to the client
- Previous by thread: Can anybody correct this code that is used to get/set ARP entries and uses ioctl( )
- Next by thread: FC4 64-bits: dynamic IP hard-to be removed
- Index(es):
Relevant Pages
|
|