diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2020-09-13 00:51:13 +0500 |
---|---|---|
committer | Vladislav Grishenko <themiron@mail.ru> | 2020-09-13 01:11:49 +0500 |
commit | 6e851767b3074244d01f58da4208c9f2c779fa58 (patch) | |
tree | 6bd6faafef86abaaae8912c6adbc3c049f2783c3 | |
parent | c3629ea6a221455bbc02dde30c8eb8250c19831b (diff) | |
download | accel-ppp-6e851767b3074244d01f58da4208c9f2c779fa58.tar.gz accel-ppp-6e851767b3074244d01f58da4208c9f2c779fa58.zip |
radius: keep vendor & attr numbers in order
-rw-r--r-- | accel-pppd/ctrl/ipoe/dhcp_attr_defs.h | 36 | ||||
-rw-r--r-- | accel-pppd/ctrl/l2tp/attr_defs.h | 41 | ||||
-rw-r--r-- | accel-pppd/extra/ippool.c | 1 | ||||
-rw-r--r-- | accel-pppd/radius/attr_defs.h | 166 | ||||
-rw-r--r-- | accel-pppd/radius/auth.c | 2 | ||||
-rw-r--r-- | accel-pppd/radius/radius.c | 2 | ||||
-rw-r--r-- | accel-pppd/shaper/shaper.c | 4 |
7 files changed, 141 insertions, 111 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcp_attr_defs.h b/accel-pppd/ctrl/ipoe/dhcp_attr_defs.h index c68111c..8f2ae55 100644 --- a/accel-pppd/ctrl/ipoe/dhcp_attr_defs.h +++ b/accel-pppd/ctrl/ipoe/dhcp_attr_defs.h @@ -1,4 +1,5 @@ #define VENDOR_DHCP 54 + #define DHCP_Opcode 256 #define DHCP_Hardware_Type 257 #define DHCP_Hardware_Address_Length 258 @@ -16,7 +17,12 @@ #define DHCP_Relay_To_IP_Address 270 #define DHCP_Relay_Max_Hop_Count 271 #define DHCP_Relay_IP_Address 272 + #define DHCP_Flags_Broadcast 0x8000 + +#define DHCP_Opcode_Client_Message 1 +#define DHCP_Opcode_Server_Message 2 + #define DHCP_Hardware_Type_Ethernet 1 #define DHCP_Hardware_Type_Experiemental_Ethernet 2 #define DHCP_Hardware_Type_AX_25 3 @@ -50,6 +56,7 @@ #define DHCP_Hardware_Type_IPSec_Tunnel 31 #define DHCP_Hardware_Type_Infiniband 32 #define DHCP_Hardware_Type_CAI_TIA_102 33 + #define DHCP_Subnet_Mask 1 #define DHCP_Time_Offset 2 #define DHCP_Router_Address 3 @@ -132,18 +139,6 @@ #define DHCP_Rapid_Commit 80 #define DHCP_Client_FQDN 81 #define DHCP_Relay_Agent_Information 82 -#define DHCP_Agent_Circuit_Id 1 -#define DHCP_Agent_Remote_Id 2 -#define DHCP_Relay_Circuit_Id 1 -#define DHCP_Relay_Remote_Id 2 -#define DHCP_Docsis_Device_Class 4 -#define DHCP_Relay_Link_Selection 5 -#define DHCP_Subscriber_Id 6 -#define DHCP_RADIUS_Attributes 7 -#define DHCP_Authentication_Information 8 -#define DHCP_Vendor_Specific_Information 9 -#define DHCP_Relay_Agent_Flags 10 -#define DHCP_Server_Identifier_Override 11 #define DHCP_iSNS 83 #define DHCP_NDS_Servers 85 #define DHCP_NDS_Tree_Name 86 @@ -181,8 +176,20 @@ #define DHCP_HTTP_Proxy 135 #define DHCP_Cisco_TFTP_Server_IP_Addresses 150 #define DHCP_End_Of_Options 255 -#define DHCP_Opcode_Client_Message 1 -#define DHCP_Opcode_Server_Message 2 + +#define DHCP_Agent_Circuit_Id 1 +#define DHCP_Agent_Remote_Id 2 +#define DHCP_Relay_Circuit_Id 1 +#define DHCP_Relay_Remote_Id 2 +#define DHCP_Docsis_Device_Class 4 +#define DHCP_Relay_Link_Selection 5 +#define DHCP_Subscriber_Id 6 +#define DHCP_RADIUS_Attributes 7 +#define DHCP_Authentication_Information 8 +#define DHCP_Vendor_Specific_Information 9 +#define DHCP_Relay_Agent_Flags 10 +#define DHCP_Server_Identifier_Override 11 + #define DHCP_Message_Type_DHCP_Discover 1 #define DHCP_Message_Type_DHCP_Offer 2 #define DHCP_Message_Type_DHCP_Request 3 @@ -192,6 +199,7 @@ #define DHCP_Message_Type_DHCP_Release 7 #define DHCP_Message_Type_DHCP_Inform 8 #define DHCP_Message_Type_DHCP_Force_Renew 9 + #define DHCP_Parameter_Request_List_DHCP_Subnet_Mask 1 #define DHCP_Parameter_Request_List_DHCP_Time_Offset 2 #define DHCP_Parameter_Request_List_DHCP_Router_Address 3 diff --git a/accel-pppd/ctrl/l2tp/attr_defs.h b/accel-pppd/ctrl/l2tp/attr_defs.h index 3f71376..d6b9d5d 100644 --- a/accel-pppd/ctrl/l2tp/attr_defs.h +++ b/accel-pppd/ctrl/l2tp/attr_defs.h @@ -2,7 +2,6 @@ #define __ATTR_DEFS_H #define Message_Type 0 -#define Random_Vector 36 #define Result_Code 1 #define Protocol_Version 2 #define Framing_Capabilities 3 @@ -26,10 +25,7 @@ #define Calling_Number 22 #define Sub_Address 23 #define TX_Speed 24 -#define RX_Speed 38 #define Physical_Channel_ID 25 -#define Private_Group_ID 37 -#define Sequencing_Required 39 #define Init_Recv_LCP 26 #define Last_Sent_LCP 27 #define Last_Recv_LCP 28 @@ -40,6 +36,27 @@ #define Proxy_Authen_Response 33 #define Call_Errors 34 #define ACCM 35 +#define Random_Vector 36 +#define Private_Group_ID 37 +#define RX_Speed 38 +#define Sequencing_Required 39 +#define Message_Digest 59 +#define Router_ID 60 +#define Assigned_Connection_ID 61 +#define Pseudowire_Capabilities 62 +#define Local_Session_ID 63 +#define Remote_Session_ID 64 +#define Assigned_Cookie 65 +#define Remote_End_ID 66 +#define Pseudowire_Type 68 +#define L2_Specific_Sublayer 69 +#define Data_Sequencing 70 +#define Circuit_Status 71 +#define Prefered_Language 72 +#define Ctrl_Message_Auth_Nonce 73 +#define TX_Connect_Speed 74 +#define RX_Connect_Speed 75 + #define Message_Type_Start_Ctrl_Conn_Request 1 #define Message_Type_Start_Ctrl_Conn_Reply 2 #define Message_Type_Start_Ctrl_Conn_Connected 3 @@ -54,22 +71,6 @@ #define Message_Type_Call_Disconnect_Notify 14 #define Message_Type_WAN_Error_Notify 15 #define Message_Type_Set_Link_Info 16 -#define Message_Digest 59 -#define Ctrl_Message_Auth_Nonce 73 -#define Router_ID 60 -#define Assigned_Connection_ID 61 -#define Pseudowire_Capabilities 62 -#define Prefered_Language 72 -#define Local_Session_ID 63 -#define Remote_Session_ID 64 -#define Assigned_Cookie 65 -#define Remote_End_ID 66 -#define Pseudowire_Type 68 -#define L2_Specific_Sublayer 69 -#define Data_Sequencing 70 -#define TX_Connect_Speed 74 -#define RX_Connect_Speed 75 -#define Circuit_Status 71 #define Message_Type_Explicit_Ack 20 #endif diff --git a/accel-pppd/extra/ippool.c b/accel-pppd/extra/ippool.c index 44f450c..5e0098a 100644 --- a/accel-pppd/extra/ippool.c +++ b/accel-pppd/extra/ippool.c @@ -468,6 +468,7 @@ static struct backup_module backup_mod = { static int parse_attr(struct ap_session *ses, struct rad_attr_t *attr) { if (conf_vendor == 9) { + /* VENDOR_Cisco */ if (attr->len > sizeof("ip:addr-pool=") && memcmp(attr->val.string, "ip:addr-pool=", sizeof("ip:addr-pool=") - 1) == 0) { if (ses->ipv4_pool_name) _free(ses->ipv4_pool_name); 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; diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c index 55bec4f..75b27fb 100644 --- a/accel-pppd/shaper/shaper.c +++ b/accel-pppd/shaper/shaper.c @@ -299,8 +299,10 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int * } #ifdef RADIUS - if (conf_vendor == 9) + if (conf_vendor == 9) { + /* VENDOR_Cisco */ return; + } #endif parse_string_simple(str, dir, speed, burst, tr_id); |