diff --git a/src/pam_radius_auth.c b/src/pam_radius_auth.c index be1d0ed..9002555 100644 --- a/src/pam_radius_auth.c +++ b/src/pam_radius_auth.c @@ -1591,6 +1591,23 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, UNUSED int flags, int arg _pam_log(LOG_DEBUG, "Set PAM environment variable : %s", frameip); } } + if ((attr_fip = find_attribute(response, PW_FRAMED_IPV6_PREFIX))) { + const char name[] = "Framed-IPv6-Prefix"; + char buffer[INET6_ADDRSTRLEN]; + char frameip[sizeof(name) + INET6_ADDRSTRLEN]; + struct in6_addr ip_addr; + + memcpy(ip_addr.s6_addr, attr_fip->data, 16); + + snprintf(frameip, sizeof(frameip), "%s=%s", name, inet_ntop(AF_INET6, (const void *)ip_addr, buffer, INET6_ADDRSTRLEN)); + retval = pam_putenv(pamh, frameip); + if (retval != PAM_SUCCESS) { + _pam_log(LOG_ERR, "unable to set PAM environment variable : %s", name); + } + else { + _pam_log(LOG_DEBUG, "Set PAM environment variable : %s", frameip); + } + } } else { retval = PAM_AUTH_ERR; /* authentication failure */ diff --git a/src/radius.h b/src/radius.h index 287d4d8..3620203 100644 --- a/src/radius.h +++ b/src/radius.h @@ -123,6 +123,7 @@ typedef struct pw_auth_hdr { #define PW_MANAGEMENT_PRIVILEGE_LEVEL 136 /* integer */ #define PW_NAS_IPV6_ADDRESS 95 /* octets */ +#define PW_FRAMED_IPV6_PREFIX 97 /* octets */ /* * INTEGER TRANSLATIONS