return this_host_ipaddr;
}
+
+/*
+ * Function: rc_own_bind_ipaddress
+ *
+ * Purpose: get the IP address to be used as a source address
+ * for sending requests in host order
+ *
+ * Returns: IP address
+ *
+ */
+
+UINT4 rc_own_bind_ipaddress(void)
+{
+ char *bindaddr;
+ UINT4 rval = 0;
+
+ if ((bindaddr = rc_conf_str("bindaddr")) == NULL ||
+ strcmp(rc_conf_str("bindaddr"), "*") == 0) {
+ rval = INADDR_ANY;
+ } else {
+ if ((rval = rc_get_ipaddr(bindaddr)) == 0) {
+ error("rc_own_bind_ipaddress: couldn't get IP address from bindaddr");
+ rval = INADDR_ANY;
+ }
+ }
+
+ return rval;
+}
{"radius_timeout", OT_INT, ST_UNDEF, NULL},
{"radius_retries", OT_INT, ST_UNDEF, NULL},
{"nas_identifier", OT_STR, ST_UNDEF, ""},
+{"bindaddr", OT_STR, ST_UNDEF, NULL},
/* local options */
{"login_local", OT_STR, ST_UNDEF, NULL},
};
sin = (struct sockaddr_in *) & salocal;
memset ((char *) sin, '\0', (size_t) length);
sin->sin_family = AF_INET;
- sin->sin_addr.s_addr = htonl(INADDR_ANY);
+ sin->sin_addr.s_addr = htonl(rc_own_bind_ipaddress());
sin->sin_port = htons ((unsigned short) 0);
if (bind (sockfd, (struct sockaddr *) sin, length) < 0 ||
getsockname (sockfd, (struct sockaddr *) sin, &length) < 0)