+/*
+ * Function: rc_get_nas_id
+ *
+ * Purpose: fills in NAS-Identifier or NAS-IP-Address in request
+ *
+ */
+
+int rc_get_nas_id(VALUE_PAIR **sendpairs)
+{
+ UINT4 client_id;
+ char *nasid;
+
+ nasid = rc_conf_str("nas_identifier");
+ if (strlen(nasid)) {
+ /*
+ * Fill in NAS-Identifier
+ */
+ if (rc_avpair_add(sendpairs, PW_NAS_IDENTIFIER, nasid, 0,
+ VENDOR_NONE) == NULL)
+ return (ERROR_RC);
+
+ return (OK_RC);
+
+ } else {
+ /*
+ * Fill in NAS-IP-Address
+ */
+ if ((client_id = rc_own_ipaddress()) == 0)
+ return (ERROR_RC);
+
+ if (rc_avpair_add(sendpairs, PW_NAS_IP_ADDRESS, &client_id,
+ 0, VENDOR_NONE) == NULL)
+ return (ERROR_RC);
+ }
+
+ return (OK_RC);
+}
+