mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 18:07:52 +00:00 
			
		
		
		
	hostapd: add proxy-state to DAS frames
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		
							
								
								
									
										95
									
								
								feeds/ipq807x_v5.4/hostapd/patches/999-das-proxy-state.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								feeds/ipq807x_v5.4/hostapd/patches/999-das-proxy-state.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,95 @@ | ||||
| Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c | ||||
| +++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c | ||||
| @@ -63,6 +63,7 @@ static struct radius_msg * radius_das_di | ||||
|  		RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, | ||||
|  		RADIUS_ATTR_VENDOR_SPECIFIC, | ||||
|  		RADIUS_ATTR_CALLED_STATION_ID, | ||||
| +		RADIUS_ATTR_PROXY_STATE, | ||||
|  #ifdef CONFIG_IPV6 | ||||
|  		RADIUS_ATTR_NAS_IPV6_ADDRESS, | ||||
|  #endif /* CONFIG_IPV6 */ | ||||
| @@ -159,6 +160,12 @@ static struct radius_msg * radius_das_di | ||||
|  		attrs.cui_len = len; | ||||
|  	} | ||||
|   | ||||
| +	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, | ||||
| +				    &buf, &len, NULL) == 0) { | ||||
| +		attrs.proxy = buf; | ||||
| +		attrs.proxy_len = len; | ||||
| +	} | ||||
| + | ||||
|  	res = das->disconnect(das->ctx, &attrs); | ||||
|  	switch (res) { | ||||
|  	case RADIUS_DAS_NAS_MISMATCH: | ||||
| @@ -167,10 +174,11 @@ static struct radius_msg * radius_das_di | ||||
|  		error = 403; | ||||
|  		break; | ||||
|  	case RADIUS_DAS_SESSION_NOT_FOUND: | ||||
| -		wpa_printf(MSG_INFO, "DAS: Session not found for request from " | ||||
| -			   "%s:%d", abuf, from_port); | ||||
| -		error = 503; | ||||
| -		break; | ||||
| +		return NULL; | ||||
| +//		wpa_printf(MSG_INFO, "DAS: Session not found for request from " | ||||
| +//			   "%s:%d", abuf, from_port); | ||||
| +//		error = 503; | ||||
| +//		break; | ||||
|  	case RADIUS_DAS_MULTI_SESSION_MATCH: | ||||
|  		wpa_printf(MSG_INFO, | ||||
|  			   "DAS: Multiple sessions match for request from %s:%d", | ||||
| @@ -192,6 +200,9 @@ fail: | ||||
|  	if (reply == NULL) | ||||
|  		return NULL; | ||||
|   | ||||
| +	if (attrs.proxy) | ||||
| +		radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); | ||||
| + | ||||
|  	if (error) { | ||||
|  		if (!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, | ||||
|  					       error)) { | ||||
| @@ -222,6 +233,7 @@ static struct radius_msg * radius_das_co | ||||
|  		RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, | ||||
|  		RADIUS_ATTR_VENDOR_SPECIFIC, | ||||
|  		RADIUS_ATTR_CALLED_STATION_ID, | ||||
| +		RADIUS_ATTR_PROXY_STATE, | ||||
|  #ifdef CONFIG_IPV6 | ||||
|  		RADIUS_ATTR_NAS_IPV6_ADDRESS, | ||||
|  #endif /* CONFIG_IPV6 */ | ||||
| @@ -347,6 +359,12 @@ static struct radius_msg * radius_das_co | ||||
|  	} | ||||
|  #endif /* CONFIG_HS20 */ | ||||
|   | ||||
| +	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, | ||||
| +				    &buf, &len, NULL) == 0) { | ||||
| +		attrs.proxy = buf; | ||||
| +		attrs.proxy_len = len; | ||||
| +	} | ||||
| + | ||||
|  	res = das->coa(das->ctx, &attrs); | ||||
|  	switch (res) { | ||||
|  	case RADIUS_DAS_NAS_MISMATCH: | ||||
| @@ -382,6 +400,9 @@ fail: | ||||
|  	if (!reply) | ||||
|  		return NULL; | ||||
|   | ||||
| +	if (attrs.proxy) | ||||
| +		radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); | ||||
| + | ||||
|  	if (error && | ||||
|  	    !radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, error)) { | ||||
|  		radius_msg_free(reply); | ||||
| Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.h | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.h | ||||
| +++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.h | ||||
| @@ -36,6 +36,8 @@ struct radius_das_attrs { | ||||
|  	size_t acct_multi_session_id_len; | ||||
|  	const u8 *cui; | ||||
|  	size_t cui_len; | ||||
| +	const u8 *proxy; | ||||
| +	size_t proxy_len; | ||||
|   | ||||
|  	/* Authorization changes */ | ||||
|  	const u8 *hs20_t_c_filtering; | ||||
							
								
								
									
										95
									
								
								feeds/wifi-ax/hostapd/patches/999-das-proxy-state.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								feeds/wifi-ax/hostapd/patches/999-das-proxy-state.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,95 @@ | ||||
| Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c | ||||
| +++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c | ||||
| @@ -63,6 +63,7 @@ static struct radius_msg * radius_das_di | ||||
|  		RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, | ||||
|  		RADIUS_ATTR_VENDOR_SPECIFIC, | ||||
|  		RADIUS_ATTR_CALLED_STATION_ID, | ||||
| +		RADIUS_ATTR_PROXY_STATE, | ||||
|  #ifdef CONFIG_IPV6 | ||||
|  		RADIUS_ATTR_NAS_IPV6_ADDRESS, | ||||
|  #endif /* CONFIG_IPV6 */ | ||||
| @@ -159,6 +160,12 @@ static struct radius_msg * radius_das_di | ||||
|  		attrs.cui_len = len; | ||||
|  	} | ||||
|   | ||||
| +	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, | ||||
| +				    &buf, &len, NULL) == 0) { | ||||
| +		attrs.proxy = buf; | ||||
| +		attrs.proxy_len = len; | ||||
| +	} | ||||
| + | ||||
|  	res = das->disconnect(das->ctx, &attrs); | ||||
|  	switch (res) { | ||||
|  	case RADIUS_DAS_NAS_MISMATCH: | ||||
| @@ -167,10 +174,11 @@ static struct radius_msg * radius_das_di | ||||
|  		error = 403; | ||||
|  		break; | ||||
|  	case RADIUS_DAS_SESSION_NOT_FOUND: | ||||
| -		wpa_printf(MSG_INFO, "DAS: Session not found for request from " | ||||
| -			   "%s:%d", abuf, from_port); | ||||
| -		error = 503; | ||||
| -		break; | ||||
| +		return NULL; | ||||
| +//		wpa_printf(MSG_INFO, "DAS: Session not found for request from " | ||||
| +//			   "%s:%d", abuf, from_port); | ||||
| +//		error = 503; | ||||
| +//		break; | ||||
|  	case RADIUS_DAS_MULTI_SESSION_MATCH: | ||||
|  		wpa_printf(MSG_INFO, | ||||
|  			   "DAS: Multiple sessions match for request from %s:%d", | ||||
| @@ -192,6 +200,9 @@ fail: | ||||
|  	if (reply == NULL) | ||||
|  		return NULL; | ||||
|   | ||||
| +	if (attrs.proxy) | ||||
| +		radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); | ||||
| + | ||||
|  	if (error) { | ||||
|  		if (!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, | ||||
|  					       error)) { | ||||
| @@ -222,6 +233,7 @@ static struct radius_msg * radius_das_co | ||||
|  		RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, | ||||
|  		RADIUS_ATTR_VENDOR_SPECIFIC, | ||||
|  		RADIUS_ATTR_CALLED_STATION_ID, | ||||
| +		RADIUS_ATTR_PROXY_STATE, | ||||
|  #ifdef CONFIG_IPV6 | ||||
|  		RADIUS_ATTR_NAS_IPV6_ADDRESS, | ||||
|  #endif /* CONFIG_IPV6 */ | ||||
| @@ -347,6 +359,12 @@ static struct radius_msg * radius_das_co | ||||
|  	} | ||||
|  #endif /* CONFIG_HS20 */ | ||||
|   | ||||
| +	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, | ||||
| +				    &buf, &len, NULL) == 0) { | ||||
| +		attrs.proxy = buf; | ||||
| +		attrs.proxy_len = len; | ||||
| +	} | ||||
| + | ||||
|  	res = das->coa(das->ctx, &attrs); | ||||
|  	switch (res) { | ||||
|  	case RADIUS_DAS_NAS_MISMATCH: | ||||
| @@ -382,6 +400,9 @@ fail: | ||||
|  	if (!reply) | ||||
|  		return NULL; | ||||
|   | ||||
| +	if (attrs.proxy) | ||||
| +		radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); | ||||
| + | ||||
|  	if (error && | ||||
|  	    !radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, error)) { | ||||
|  		radius_msg_free(reply); | ||||
| Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.h | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.h | ||||
| +++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.h | ||||
| @@ -36,6 +36,8 @@ struct radius_das_attrs { | ||||
|  	size_t acct_multi_session_id_len; | ||||
|  	const u8 *cui; | ||||
|  	size_t cui_len; | ||||
| +	const u8 *proxy; | ||||
| +	size_t proxy_len; | ||||
|   | ||||
|  	/* Authorization changes */ | ||||
|  	const u8 *hs20_t_c_filtering; | ||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin