summaryrefslogtreecommitdiff
path: root/net/sipxcommserverlib/files/patch-src_sipx-utils.sh
blob: eafad1f1a51d87ffb5511d81ab4004c67efa5094 (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- ./src/sipx-utils.sh.orig	Mon Jan  1 19:30:33 2007
+++ ./src/sipx-utils.sh	Mon Jan  1 19:37:57 2007
@@ -41,16 +41,24 @@
   }
 
 
+#
+# Let's modify this slightly to allow a hostname as the second arg and
+# not just an IP address.
+#
 sip_resolves_to () { # ( unresolved, targetIp )
     # returns true (0) if the unresolved name resolves to the targetIp address by sip rules
      unresolvedName=$1
      targetAddr=$2
+     targetAddr2=`dns_a $2`
 
      for ip in `dns_a ${unresolvedName}`
      do
        if [ "${ip}" = "${targetAddr}" ]
        then
            return 0
+       elif [ "${ip}" = "${targetAddr2}" ]
+       then
+           return 0
        fi
      done
 
@@ -61,6 +69,9 @@
          if [ "${ip}" = "${targetAddr}" ]
          then
              return 0
+         elif [ "${ip}" = "${targetAddr2}" ]
+         then
+             return 0
          fi
        done
      done
@@ -70,12 +81,18 @@
        if [ "${tcpSrv}" = "${targetAddr}" ]
        then
            return 0
+       elif [ "${tcpSrv}" = "${targetAddr2}" ]
+       then
+           return 0
        else
            for ip in `dns_a ${tcpSrv}`
            do
              if [ "${ip}" = "${targetAddr}" ]
              then
                  return 0
+             elif [ "${ip}" = "${targetAddr2}" ]
+             then
+                 return 0
              fi
            done
        fi
@@ -86,10 +103,16 @@
        if [ "${udpSrv}" = "${targetAddr}" ]
        then
            return 0
+       elif [ "${udpSrv}" = "${targetAddr2}" ]
+       then
+           return 0
        else
            for ip in `dns_a ${udpSrv}`
            do
              if [ "${ip}" = "${targetAddr}" ]
+             then
+                 return 0
+             elif [ "${ip}" = "${targetAddr2}" ]
              then
                  return 0
              fi