blob: 657b540fbe9538df0e4da86b5a512df918ba7ef5 (
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
|
--- lib/ip_util.c
+++ lib/ip_util.c
@@ -350,6 +350,36 @@
}
/*
+ * Function: rc_nasaddress
+ *
+ * Purpose: get the IP address to be declared as NAS-Address
+ * for sending requests in host order
+ *
+ * Returns: IP address, or 0 if didn't specified
+ *
+ */
+
+uint32_t rc_nasaddress(rc_handle *rh)
+{
+ const char *cs;
+ char hostname[256];
+ uint32_t rval;
+
+ cs = rc_conf_str(rh, "nasaddr");
+ if (cs == NULL || 0 == strcmp(cs, "*"))
+ return 0;
+
+ strncpy(hostname, cs, sizeof(hostname));
+ hostname[sizeof(hostname) - 1] = '\0';
+ if ((rval = rc_get_ipaddr(hostname)) == 0) {
+ rc_log(LOG_ERR, "rc_own_ipaddress: couldn't get IP address from bindaddr");
+ rval = INADDR_ANY;
+ }
+
+ return rval;
+}
+
+/*
* Function: rc_get_srcaddr
*
* Purpose: given remote address find local address which the
|