|
|
|
@ -1437,6 +1437,11 @@ static int cmp_int(const void *a, const void *b)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int tag_is_valid(u8 tag) {
|
|
|
|
|
return 0x1 <= tag && tag <= 0x1F;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* radius_msg_get_vlanid - Parse RADIUS attributes for VLAN tunnel information
|
|
|
|
|
* The k tagged vlans found are sorted by vlan_id and stored in the first k
|
|
|
|
@ -1450,7 +1455,7 @@ static int cmp_int(const void *a, const void *b)
|
|
|
|
|
* Returns: 0 if neither tagged nor untagged configuration is found, 1 otherwise
|
|
|
|
|
*/
|
|
|
|
|
int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged,
|
|
|
|
|
int *tagged)
|
|
|
|
|
int *tagged, u8 tag)
|
|
|
|
|
{
|
|
|
|
|
struct radius_tunnel_attrs tunnel[RADIUS_TUNNEL_TAGS], *tun;
|
|
|
|
|
size_t i;
|
|
|
|
@ -1524,6 +1529,8 @@ int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged,
|
|
|
|
|
/* Use tunnel with the lowest tag for untagged VLAN id */
|
|
|
|
|
for (i = 0; i < RADIUS_TUNNEL_TAGS; i++) {
|
|
|
|
|
tun = &tunnel[i];
|
|
|
|
|
if (tag_is_valid(tag) && i != tag)
|
|
|
|
|
continue;
|
|
|
|
|
if (tun->tag_used &&
|
|
|
|
|
tun->type == RADIUS_TUNNEL_TYPE_VLAN &&
|
|
|
|
|
tun->medium_type == RADIUS_TUNNEL_MEDIUM_TYPE_802 &&
|
|
|
|
@ -1554,7 +1561,7 @@ int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged,
|
|
|
|
|
*/
|
|
|
|
|
char * radius_msg_get_tunnel_password(struct radius_msg *msg, int *keylen,
|
|
|
|
|
const u8 *secret, size_t secret_len,
|
|
|
|
|
struct radius_msg *sent_msg, size_t n)
|
|
|
|
|
struct radius_msg *sent_msg, size_t n, u8 *tag)
|
|
|
|
|
{
|
|
|
|
|
u8 *buf = NULL;
|
|
|
|
|
size_t buflen;
|
|
|
|
@ -1572,6 +1579,9 @@ char * radius_msg_get_tunnel_password(struct radius_msg *msg, int *keylen,
|
|
|
|
|
size_t fdlen = -1;
|
|
|
|
|
char *ret = NULL;
|
|
|
|
|
|
|
|
|
|
if (tag)
|
|
|
|
|
*tag = 0;
|
|
|
|
|
|
|
|
|
|
/* find n-th valid Tunnel-Password attribute */
|
|
|
|
|
for (i = 0; i < msg->attr_used; i++) {
|
|
|
|
|
attr = radius_get_attr_hdr(msg, i);
|
|
|
|
@ -1589,6 +1599,9 @@ char * radius_msg_get_tunnel_password(struct radius_msg *msg, int *keylen,
|
|
|
|
|
if (j <= n)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (tag_is_valid(data[0]))
|
|
|
|
|
*tag = data[0];
|
|
|
|
|
|
|
|
|
|
fdata = data;
|
|
|
|
|
fdlen = dlen;
|
|
|
|
|
break;
|
|
|
|
|