From 6e851767b3074244d01f58da4208c9f2c779fa58 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Sun, 13 Sep 2020 00:51:13 +0500 Subject: radius: keep vendor & attr numbers in order --- accel-pppd/radius/attr_defs.h | 166 +++++++++++++++++++++++------------------- accel-pppd/radius/auth.c | 2 +- accel-pppd/radius/radius.c | 2 +- 3 files changed, 94 insertions(+), 76 deletions(-) (limited to 'accel-pppd/radius') diff --git a/accel-pppd/radius/attr_defs.h b/accel-pppd/radius/attr_defs.h index 80ae426..8e5bf9b 100644 --- a/accel-pppd/radius/attr_defs.h +++ b/accel-pppd/radius/attr_defs.h @@ -1,3 +1,6 @@ +#define VENDOR_Microsoft 311 +#define VENDOR_Accel_PPP 55999 + #define User_Name 1 #define User_Password 2 #define CHAP_Password 3 @@ -35,10 +38,69 @@ #define Framed_AppleTalk_Link 37 #define Framed_AppleTalk_Network 38 #define Framed_AppleTalk_Zone 39 +#define Acct_Status_Type 40 +#define Acct_Delay_Time 41 +#define Acct_Input_Octets 42 +#define Acct_Output_Octets 43 +#define Acct_Session_Id 44 +#define Acct_Authentic 45 +#define Acct_Session_Time 46 +#define Acct_Input_Packets 47 +#define Acct_Output_Packets 48 +#define Acct_Terminate_Cause 49 +#define Acct_Multi_Session_Id 50 +#define Acct_Link_Count 51 +#define Acct_Input_Gigawords 52 +#define Acct_Output_Gigawords 53 +#define Event_Timestamp 55 #define CHAP_Challenge 60 #define NAS_Port_Type 61 #define Port_Limit 62 #define Login_LAT_Port 63 +#define Tunnel_Type 64 +#define Tunnel_Medium_Type 65 +#define Tunnel_Client_Endpoint 66 +#define Tunnel_Server_Endpoint 67 +#define Acct_Tunnel_Connection 68 +#define Tunnel_Password 69 +#define ARAP_Password 70 +#define ARAP_Features 71 +#define ARAP_Zone_Access 72 +#define ARAP_Security 73 +#define ARAP_Security_Data 74 +#define Password_Retry 75 +#define Prompt 76 +#define Connect_Info 77 +#define Configuration_Token 78 +#define EAP_Message 79 +#define Message_Authenticator 80 +#define Tunnel_Private_Group_Id 81 +#define Tunnel_Assignment_Id 82 +#define Tunnel_Preference 83 +#define ARAP_Challenge_Response 84 +#define Acct_Interim_Interval 85 +#define Acct_Tunnel_Packets_Lost 86 +#define NAS_Port_Id 87 +#define Framed_Pool 88 +#define Chargeable_User_Identity 89 +#define Tunnel_Client_Auth_Id 90 +#define Tunnel_Server_Auth_Id 91 +#define NAS_IPv6_Address 95 +#define Framed_Interface_Id 96 +#define Framed_IPv6_Prefix 97 +#define Login_IPv6_Host 98 +#define Framed_IPv6_Route 99 +#define Framed_IPv6_Pool 100 +#define Error_Cause 101 +#define EAP_Key_Name 102 +#define Delegated_IPv6_Prefix 123 +#define Framed_IPv6_Address 168 +#define DNS_Server_IPv6_Address 169 +#define Route_IPv6_Information 170 +#define Delegated_IPv6_Prefix_Pool 171 +#define Stateful_IPv6_Address_Pool 172 +#define Traffic_Shape_in 231 + #define Service_Type_Login_User 1 #define Service_Type_Framed_User 2 #define Service_Type_Callback_Login_User 3 @@ -50,20 +112,25 @@ #define Service_Type_Callback_NAS_Prompt 9 #define Service_Type_Call_Check 10 #define Service_Type_Callback_Administrative 11 +#define Service_Type_Authorize_Only 17 + #define Framed_Protocol_PPP 1 #define Framed_Protocol_SLIP 2 #define Framed_Protocol_ARAP 3 #define Framed_Protocol_Gandalf_SLML 4 #define Framed_Protocol_Xylogics_IPX_SLIP 5 #define Framed_Protocol_X_75_Synchronous 6 + #define Framed_Routing_None 0 #define Framed_Routing_Broadcast 1 #define Framed_Routing_Listen 2 #define Framed_Routing_Broadcast_Listen 3 + #define Framed_Compression_None 0 #define Framed_Compression_Van_Jacobson_TCP_IP 1 #define Framed_Compression_IPX_Header_Compression 2 #define Framed_Compression_Stac_LZS 3 + #define Login_Service_Telnet 0 #define Login_Service_Rlogin 1 #define Login_Service_TCP_Clear 2 @@ -75,8 +142,10 @@ #define Login_TCP_Port_Telnet 23 #define Login_TCP_Port_Rlogin 513 #define Login_TCP_Port_Rsh 514 + #define Termination_Action_Default 0 #define Termination_Action_RADIUS_Request 1 + #define NAS_Port_Type_Async 0 #define NAS_Port_Type_Sync 1 #define NAS_Port_Type_ISDN 2 @@ -97,29 +166,28 @@ #define NAS_Port_Type_Cable 17 #define NAS_Port_Type_Wireless_Other 18 #define NAS_Port_Type_Wireless_802_11 19 -#define Acct_Status_Type 40 -#define Acct_Delay_Time 41 -#define Acct_Input_Octets 42 -#define Acct_Output_Octets 43 -#define Acct_Session_Id 44 -#define Acct_Authentic 45 -#define Acct_Session_Time 46 -#define Acct_Input_Packets 47 -#define Acct_Output_Packets 48 -#define Acct_Terminate_Cause 49 -#define Acct_Multi_Session_Id 50 -#define Acct_Link_Count 51 +#define NAS_Port_Type_Token_Ring 20 +#define NAS_Port_Type_FDDI 21 + #define Acct_Status_Type_Start 1 #define Acct_Status_Type_Stop 2 #define Acct_Status_Type_Alive 3 #define Acct_Status_Type_Interim_Update 3 #define Acct_Status_Type_Accounting_On 7 #define Acct_Status_Type_Accounting_Off 8 +#define Acct_Status_Type_Tunnel_Start 9 +#define Acct_Status_Type_Tunnel_Stop 10 +#define Acct_Status_Type_Tunnel_Reject 11 +#define Acct_Status_Type_Tunnel_Link_Start 12 +#define Acct_Status_Type_Tunnel_Link_Stop 13 +#define Acct_Status_Type_Tunnel_Link_Reject 14 #define Acct_Status_Type_Failed 15 + #define Acct_Authentic_RADIUS 1 #define Acct_Authentic_Local 2 #define Acct_Authentic_Remote 3 #define Acct_Authentic_Diameter 4 + #define Acct_Terminate_Cause_User_Request 1 #define Acct_Terminate_Cause_Lost_Carrier 2 #define Acct_Terminate_Cause_Lost_Service 3 @@ -138,24 +206,11 @@ #define Acct_Terminate_Cause_Callback 16 #define Acct_Terminate_Cause_User_Error 17 #define Acct_Terminate_Cause_Host_Request 18 -#define Acct_Tunnel_Connection 68 -#define Acct_Tunnel_Packets_Lost 86 -#define Acct_Status_Type_Tunnel_Start 9 -#define Acct_Status_Type_Tunnel_Stop 10 -#define Acct_Status_Type_Tunnel_Reject 11 -#define Acct_Status_Type_Tunnel_Link_Start 12 -#define Acct_Status_Type_Tunnel_Link_Stop 13 -#define Acct_Status_Type_Tunnel_Link_Reject 14 -#define Tunnel_Type 64 -#define Tunnel_Medium_Type 65 -#define Tunnel_Client_Endpoint 66 -#define Tunnel_Server_Endpoint 67 -#define Tunnel_Password 69 -#define Tunnel_Private_Group_Id 81 -#define Tunnel_Assignment_Id 82 -#define Tunnel_Preference 83 -#define Tunnel_Client_Auth_Id 90 -#define Tunnel_Server_Auth_Id 91 +#define Acct_Terminate_Cause_Supplicant_Restart 19 +#define Acct_Terminate_Cause_Reauthentication_Failure 20 +#define Acct_Terminate_Cause_Port_Reinit 21 +#define Acct_Terminate_Cause_Port_Disabled 22 + #define Tunnel_Type_PPTP 1 #define Tunnel_Type_L2F 2 #define Tunnel_Type_L2TP 3 @@ -168,6 +223,8 @@ #define Tunnel_Type_GRE 10 #define Tunnel_Type_DVS 11 #define Tunnel_Type_IP_in_IP 12 +#define Tunnel_Type_VLAN 13 + #define Tunnel_Medium_Type_IP 1 #define Tunnel_Medium_Type_IPv4 1 #define Tunnel_Medium_Type_IPv6 2 @@ -184,31 +241,14 @@ #define Tunnel_Medium_Type_DecNet_IV 13 #define Tunnel_Medium_Type_Banyan_Vines 14 #define Tunnel_Medium_Type_E_164_NSAP 15 -#define Acct_Input_Gigawords 52 -#define Acct_Output_Gigawords 53 -#define Event_Timestamp 55 -#define ARAP_Password 70 -#define ARAP_Features 71 -#define ARAP_Zone_Access 72 -#define ARAP_Security 73 -#define ARAP_Security_Data 74 -#define Password_Retry 75 -#define Prompt 76 -#define Connect_Info 77 -#define Configuration_Token 78 -#define EAP_Message 79 -#define Message_Authenticator 80 -#define ARAP_Challenge_Response 84 -#define Acct_Interim_Interval 85 -#define NAS_Port_Id 87 -#define Framed_Pool 88 + #define ARAP_Zone_Access_Default_Zone 1 #define ARAP_Zone_Access_Zone_Filter_Inclusive 2 #define ARAP_Zone_Access_Zone_Filter_Exclusive 4 + #define Prompt_No_Echo 0 #define Prompt_Echo 1 -#define Error_Cause 101 -#define Service_Type_Authorize_Only 17 + #define Error_Cause_Residual_Context_Removed 201 #define Error_Cause_Invalid_EAP_Packet 202 #define Error_Cause_Unsupported_Attribute 401 @@ -217,6 +257,7 @@ #define Error_Cause_Invalid_Request 404 #define Error_Cause_Unsupported_Service 405 #define Error_Cause_Unsupported_Extension 406 +#define Error_Cause_Invalid_Attribute_Value 407 #define Error_Cause_Administratively_Prohibited 501 #define Error_Cause_Proxy_Request_Not_Routable 502 #define Error_Cause_Session_Context_Not_Found 503 @@ -224,18 +265,8 @@ #define Error_Cause_Proxy_Processing_Error 505 #define Error_Cause_Resources_Unavailable 506 #define Error_Cause_Request_Initiated 507 -#define Acct_Terminate_Cause_Supplicant_Restart 19 -#define Acct_Terminate_Cause_Reauthentication_Failure 20 -#define Acct_Terminate_Cause_Port_Reinit 21 -#define Acct_Terminate_Cause_Port_Disabled 22 -#define NAS_Port_Type_Token_Ring 20 -#define NAS_Port_Type_FDDI 21 -#define Tunnel_Type_VLAN 13 -#define EAP_Key_Name 102 -#define Chargeable_User_Identity 89 -#define Error_Cause_Invalid_Attribute_Value 407 #define Error_Cause_Multiple_Session_Selection_Unsupported 508 -#define Vendor_Microsoft 311 + #define MS_CHAP_Response 1 #define MS_CHAP_Error 2 #define MS_CHAP_CPW_1 3 @@ -284,16 +315,3 @@ #define MS_Acct_EAP_Type_OTP 5 #define MS_Acct_EAP_Type_Generic_Token_Card 6 #define MS_Acct_EAP_Type_TLS 13 -#define Traffic_Shape_in 231 -#define NAS_IPv6_Address 95 -#define Framed_Interface_Id 96 -#define Framed_IPv6_Prefix 97 -#define Login_IPv6_Host 98 -#define Framed_IPv6_Route 99 -#define Framed_IPv6_Pool 100 -#define Delegated_IPv6_Prefix 123 -#define Framed_IPv6_Address 168 -#define DNS_Server_IPv6_Address 169 -#define Route_IPv6_Information 170 -#define Delegated_IPv6_Prefix_Pool 171 -#define Stateful_IPv6_Address_Pool 172 diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c index 4cc5ff7..8665867 100644 --- a/accel-pppd/radius/auth.c +++ b/accel-pppd/radius/auth.c @@ -340,7 +340,7 @@ static void setup_mppe(struct rad_req_t *req, const uint8_t *challenge) return; list_for_each_entry(attr, &req->reply->attrs, entry) { - if (attr->vendor && attr->vendor->id == Vendor_Microsoft) { + if (attr->vendor && attr->vendor->id == VENDOR_Microsoft) { switch (attr->attr->id) { case MS_CHAP_MPPE_Keys: if (decrypt_chap_mppe_keys(req, attr, challenge, mppe_recv_key)) diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index 299fa4a..fd64091 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -282,7 +282,7 @@ int rad_proc_attrs(struct rad_req_t *req) req->rpd->acct_interim_jitter = conf_acct_interim_jitter; list_for_each_entry(attr, &req->reply->attrs, entry) { - if (attr->vendor && attr->vendor->id == Vendor_Microsoft) { + if (attr->vendor && attr->vendor->id == VENDOR_Microsoft) { switch (attr->attr->id) { case MS_Primary_DNS_Server: dns.ses = rpd->ses; -- cgit v1.2.3