~ubuntu-branches/ubuntu/trusty/giarpfanoa/trusty

« back to all changes in this revision

Viewing changes to src/15-prep-if-ip.mod

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2003-07-11 12:08:43 UTC
  • Revision ID: james.westby@ubuntu.com-20030711120843-kekc8bw6snqz72c4
Tags: 0.1.1
* Fixed module loading.
* Added config to install target.
* Various other bugfixes so that the tool is really useful.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Now if the target is an IP. Make a reverse DNS CALL and MAC determine.
 
2
if echo "$TARGET" | $IFGREP "^$N\.$N\.$N\.$N\$" ; then
 
3
#    echo "IP $TARGET"
 
4
    IP=$TARGET
 
5
    dnsdetermine $TARGET DNS
 
6
    if [ ! -z "$RET" ] ; then
 
7
        if [ -z "$DNS" ] ; then
 
8
            DNS=$RET
 
9
        elif ! echo " $DNS " | $IFGREP " $RET " ; then
 
10
            DNS="$DNS $RET"
 
11
        fi
 
12
        TARG=$RET
 
13
    fi
 
14
    # Determine MAC (if possible).
 
15
    if ping -c 1 $TARGET > /dev/null ; then
 
16
        TMP=$(/usr/sbin/arp -n | grep "^$TARGET[[:space:]]" | {
 
17
            read TMPJ1 TMPJ2 TMP TMPJUNK
 
18
            echo $TMP
 
19
        })
 
20
        if [ ! -z "$TMP" ] ; then
 
21
            othermac $TMP
 
22
            if [ -z "$MAC" ] ; then
 
23
                MAC=$UMACN
 
24
            elif ! echo " $MAC " | $IFGREP " $UMACN " ; then
 
25
                MAC="$MAC $UMACN"
 
26
            fi
 
27
        fi
 
28
    fi
 
29
fi