My favorites
▼
|
Sign in
liub-open-source
[LIUB] Open source applications and scripts
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
scripts
/
arp_flush.sh
‹r12
r23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash -
#=======================================================================
#
# FILE: arp_flush.sh
# USAGE: ./arp_flush.sh
# DESCRIPTION: Flush Linux ARP table
# REQUIREMENTS: ARP(8)
# BUGS: N/A
# NOTES: N/A
# AUTHOR: Ali Ayoub
# EMAIL: ali@mellanox.com
# COMPANY: N/A
# CREATED: 09.17.2010-15:03:39
# REVISION: 1.1
#=======================================================================
script_name=`basename $0`
out="/tmp/${script_name}.out.$RANDOM"
touch $out
# checks
if [ $UID -ne 0 ]; then
echo "-E- You must be root to run this script"
exit 10
elif ! ( \touch $out ); then
echo "-E- couldn't create $out"
exit 13
fi
# run arp
\arp -na &> $out
_IFS=$IFS
IFS=`echo -en "\n\b"`;
for i in `cat $out`; do
ip=`echo $i | awk '{print $2}' | tr -d ")" | tr -d "("`
if=`echo $i | sed 's/\[ether\]//' | awk '{print $6}'`
if [ "$if" == "" ]; then
if=`echo $i | awk '{print $3}'`
fi
if [ "$ip" == "Address" ];then
continue
fi
echo arp -d $ip -i $if
arp -d $ip -i $if
done;
IFS=$_IFS
\rm $out
Show details
Hide details
Change log
r23
by aliayoub on Sep 14, 2011
Diff
scripts: bugfixes
Go to:
/trunk/scripts/arp_flush.sh
/trunk/scripts/cp.sh
/trunk/scripts/ifconfig.py
.../scripts/netconsole_devel_set.sh
/trunk/scripts/objdump_parser.py
Project members,
sign in
to write a code review
Older revisions
r12
by Ali.Ayoub on Sep 19, 2010
Diff
fix typos
r2
by Ali.Ayoub on Sep 17, 2010
Diff
add scripts dir
All revisions of this file
File info
Size: 1124 bytes, 55 lines
View raw file
File properties
svn:executable
*
Powered by
Google Project Hosting