* Returns: 0 on failure
*/
-UINT4 rc_get_ipaddr (char *host)
+UINT4 rc_get_ipaddr (const char *host)
{
struct hostent *hp;
*
*/
-int rc_good_ipaddr (char *addr)
+int rc_good_ipaddr (const char *addr)
{
int dot_count;
int digit_count;
static UINT4 this_host_ipaddr = 0;
if (!this_host_ipaddr) {
- if ((this_host_ipaddr = rc_get_ipaddr (hostname)) == 0) {
+ if ((this_host_ipaddr = rc_get_ipaddr (ppp_hostname())) == 0) {
error("rc_own_ipaddress: couldn't get own IP address");
return 0;
}
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;
+}