]>
Commit | Line | Data |
---|---|---|
a4c9c660 MT |
1 | --- _startklips_old 2007-08-13 22:45:45.000000000 +0200 |
2 | +++ _startklips 2007-08-13 21:27:00.000000000 +0200 | |
3 | @@ -104,23 +104,35 @@ | |
9ced24a8 MT |
4 | |
5 | # figure out ifconfig for interface | |
6 | addr= | |
7 | - eval `ifconfig $phys | | |
8 | - awk '$1 == "inet" && $2 ~ /^addr:/ && $NF ~ /^Mask:/ { | |
9 | - gsub(/:/, " ", $0) | |
10 | - print "addr=" $3 | |
11 | - other = $5 | |
12 | - if ($4 == "Bcast") | |
13 | - print "type=broadcast" | |
14 | - else if ($4 == "P-t-P") | |
15 | - print "type=pointopoint" | |
16 | - else if (NF == 5) { | |
17 | - print "type=" | |
18 | - other = "" | |
19 | - } else | |
20 | - print "type=unknown" | |
21 | - print "otheraddr=" other | |
22 | - print "mask=" $NF | |
23 | - }'` | |
a4c9c660 | 24 | + eval `ip addr show $phys | awk '$3 ~ /BROADCAST|POINTOPOINT/ { |
9ced24a8 MT |
25 | + if ($3 ~ /BROADCAST/) |
26 | + print "type=broadcast"; | |
a4c9c660 MT |
27 | + else if ($3 ~ /POINTOPOINT/) |
28 | + print "type=pointopoint"; | |
9ced24a8 MT |
29 | + else { |
30 | + print "type="; | |
9ced24a8 MT |
31 | + } |
32 | + }'` | |
a4c9c660 MT |
33 | + |
34 | + if [ "$type" == "broadcast" ]; then | |
35 | + eval `ip addr show $phys | awk '$1 == "inet" { gsub(/\//, " "); | |
36 | + print "addr=" $2; | |
37 | + print "mask=" $3; | |
38 | + print "otheraddr=" $5; | |
39 | + }'` | |
40 | + elif [ "$type" == "pointopoint" ]; then | |
41 | + eval `ip addr show $phys | awk '$1 == "inet" { gsub(/\//, " "); | |
42 | + print "addr=" $2; | |
43 | + print "mask=" $5; | |
44 | + print "otheraddr=" $4; | |
45 | + }'` | |
46 | + else | |
47 | + type="unknown" | |
48 | + otheraddr= | |
49 | + fi | |
50 | + | |
9ced24a8 MT |
51 | + eval `whatmask /$mask | awk -F': ' '$1 ~ /^Netmask =/ { print "mask=" $2 }'` |
52 | + | |
53 | if test " $addr" = " " | |
54 | then | |
55 | echo "unable to determine address of \`$phys'" | |
a4c9c660 | 56 | @@ -129,7 +141,7 @@ |
9ced24a8 MT |
57 | if test " $type" = " unknown" |
58 | then | |
59 | echo "\`$phys' is of an unknown type" | |
60 | - exit 1 | |
61 | + exit 1 | |
62 | fi | |
63 | if test " $omtu" != " " | |
64 | then | |
a4c9c660 MT |
65 | @@ -223,10 +235,10 @@ |
66 | fi | |
67 | next=`netstat -nr | | |
68 | awk '$1 == "0.0.0.0" && $3 == "0.0.0.0" { print $2 }'` | |
69 | - if [ "$next" = "0.0.0.0" ] ; then | |
70 | - next=`ip addr list $phys | grep -E '^ +inet6*.*scope global $phys' | | |
71 | - awk '{ print $2}' | awk -F / '{ print $1 }'` | |
72 | - fi | |
73 | + #if [ "$next" = "0.0.0.0" ] ; then | |
74 | + # next=`ip addr list $phys | grep -E '^ +inet6*.*scope global $phys' | | |
75 | + # awk '{ print $4 }' | awk -F / '{ print $1 }'` | |
76 | + #fi | |
77 | klipsinterface "ipsec0=$phys" $next | |
78 | } | |
79 |