From ca5e516c84cc2d35b6f6cd29f8ba9e835d3b72ba Mon Sep 17 00:00:00 2001 From: paul Date: Sun, 6 Jun 2004 22:06:33 +0000 Subject: 2004-06-06 Paul Jakma * ripd.h: Add define for the RIPv2 Authentication Data family Move the auth type defines up to where other defines live. Add RIP_AUTH_MD5_COMPAT_SIZE, for backwards compatible md5->auth_len size. Add md5_auth_len field to struct rip_interface: (rip_interface_new) Init md5_auth_len to compatible size. (ip_rip_authentication_mode_cmd) Extended to handle setting md5 auth-length. Appropriate aliases added. (no_ip_rip_authentication_mode_cmd) Reset md5_auth_len to compatible size. (rip_interface_config_write) Teach it about md5_auth_len. _always_ write out the auth-length, so that everyone will get the setting in their config file, and hence allow for a future change of default for md5_auth_len to be less painful - every md5 user will have this setting in their config file. ripd.c: (rip_packet_dump) Change nasty hard coded constants to symbolic defines. Change various tests of 'ntoh.(variable) == constant' to test 'variable == ntoh.(constant)'. Clean up indentation on some long lines. (rip_auth_simple_password) ditto. (rip_auth_md5) ditto, also add length argument and sanity check md5 data offset field. Sanity check md5 auth length, accept RFC or old-ripd/cisco lengths. (rip_auth_md5_set) as per (rip_packet_dump), also write out the configured md5 auth length for the interface (old-ripd or rfc) (rip_read) as per (rip_packet_dump) (rip_write_rte) ditto (rip_response_process) ditto (rip_write_rte) ditto --- ripd/ripd.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'ripd/ripd.h') diff --git a/ripd/ripd.h b/ripd/ripd.h index 13a72a11..5c50c576 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -78,8 +78,18 @@ #define RIP_ROUTE_REDISTRIBUTE 3 #define RIP_ROUTE_INTERFACE 4 -/* RIP MD5 authentication. */ +/* RIPv2 special RTE family types */ +#define RIP_FAMILY_AUTH 0xffff + +/* RIPv2 authentication types, for RIP_FAMILY_AUTH RTE's */ +#define RIP_NO_AUTH 0 +#define RIP_AUTH_DATA 1 +#define RIP_AUTH_SIMPLE_PASSWORD 2 +#define RIP_AUTH_MD5 3 + +/* RIPv2 MD5 authentication. */ #define RIP_AUTH_MD5_SIZE 16 +#define RIP_AUTH_MD5_COMPAT_SIZE RIP_RTE_SIZE /* RIP structure. */ struct rip @@ -237,10 +247,6 @@ struct rip_interface int ri_receive; /* RIPv2 authentication type. */ -#define RIP_NO_AUTH 0 -#define RIP_AUTH_DATA 1 -#define RIP_AUTH_SIMPLE_PASSWORD 2 -#define RIP_AUTH_MD5 3 int auth_type; /* RIPv2 authentication string. */ @@ -249,6 +255,9 @@ struct rip_interface /* RIPv2 authentication key chain. */ char *key_chain; + /* value to use for md5->auth_len */ + u_int8_t md5_auth_len; + /* Split horizon flag. */ split_horizon_policy_t split_horizon; split_horizon_policy_t split_horizon_default; -- cgit v1.2.1