aboutsummaryrefslogtreecommitdiffstats
path: root/main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch')
-rw-r--r--main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch129
1 files changed, 0 insertions, 129 deletions
diff --git a/main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch b/main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
deleted file mode 100644
index 1b11d516dc..0000000000
--- a/main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-From c43e15006ee6f36f74de12928687f16c8338eadf Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Tue, 26 Feb 2013 09:00:20 +0200
-Subject: [PATCH 1/2] auth-snmp: use ifIndex as ifName if that MIB entry is not
- support
-
-E.g. HP ProCurve 1800 does not seem to support ifName.
----
- src/squark-auth-snmp.c | 56 ++++++++++++++++++++++++++++++++++++++------------
- 1 file changed, 43 insertions(+), 13 deletions(-)
-
-diff --git a/src/squark-auth-snmp.c b/src/squark-auth-snmp.c
-index 2ac1a7f..9a35d33 100644
---- a/src/squark-auth-snmp.c
-+++ b/src/squark-auth-snmp.c
-@@ -64,6 +64,7 @@
- #define SWITCHF_NO_LLDP_MIB 0x01
- #define SWITCHF_QBRIDGE_MIB_HAS_VLAN_NUMBER 0x02
- #define SWITCHF_BRIDGE_MIB_HAS_VLAN 0x04
-+#define SWITCHF_NO_IF_MIB_IFNAME 0x08
-
- /* IANA-AddressFamilyNumbers */
- #define IANA_AFN_OTHER 0
-@@ -291,6 +292,17 @@ struct auth_context {
- struct auth_context * next_sleeper;
- };
-
-+void switchinfo_create_ifname(struct auth_context *auth)
-+{
-+ char name[64];
-+
-+ if (auth->info_available & FORMAT_PORT_INDEX) {
-+ sprintf(name, "%d", auth->local_port);
-+ auth->port_name = strdup(name);
-+ auth->info_available |= FORMAT_PORT_NAME;
-+ }
-+}
-+
- static void cache_update_time(void)
- {
- current_time = time(NULL);
-@@ -695,6 +707,13 @@ static void auth_force_reauthentication(struct auth_context *auth)
- snmp_free_pdu(pdu);
- }
-
-+static int auth_need_info(struct auth_context *auth, int needed_flags)
-+{
-+ if ((auth->info_available & needed_flags) == needed_flags)
-+ return 0;
-+ return username_format_flags & needed_flags;
-+}
-+
- static int auth_handle_portinfo_reply(int oper, netsnmp_session *s, int reqid, netsnmp_pdu *resp, void *data)
- {
- struct auth_context *auth = data;
-@@ -704,18 +723,25 @@ static int auth_handle_portinfo_reply(int oper, netsnmp_session *s, int reqid, n
- goto done;
-
- var = resp->variables;
-- if (username_format_flags & FORMAT_PORT_NAME)
-+ if (auth_need_info(auth, FORMAT_PORT_NAME)) {
- auth->port_name = blob_cstr_dup(var_parse_type(&var, ASN_OCTET_STR));
-- if (auth->port_name)
-- auth->info_available |= FORMAT_PORT_NAME;
-- if (username_format_flags & FORMAT_PORT_DESCR)
-+ if (auth->port_name) {
-+ auth->info_available |= FORMAT_PORT_NAME;
-+ } else {
-+ auth->current_switch->flags |= SWITCHF_NO_IF_MIB_IFNAME;
-+ switchinfo_create_ifname(auth);
-+ }
-+ }
-+ if (auth_need_info(auth, FORMAT_PORT_DESCR)) {
- auth->port_descr = blob_cstr_dup(var_parse_type(&var, ASN_OCTET_STR));
-- if (auth->port_descr)
-- auth->info_available |= FORMAT_PORT_DESCR;
-- if (username_format_flags & FORMAT_PORT_WEBAUTH)
-+ if (auth->port_descr)
-+ auth->info_available |= FORMAT_PORT_DESCR;
-+ }
-+ if (auth_need_info(auth, FORMAT_PORT_WEBAUTH)) {
- auth->webauth_name = blob_cstr_dup(var_parse_type(&var, ASN_OCTET_STR));
-- if (auth->webauth_name)
-- auth->info_available |= FORMAT_PORT_WEBAUTH;
-+ if (auth->webauth_name)
-+ auth->info_available |= FORMAT_PORT_WEBAUTH;
-+ }
-
- snprintf(auth->status_msg, sizeof(auth->status_msg)-1,
- "required info missing: info_available=%08x",
-@@ -737,27 +763,31 @@ static void auth_query_port_info(struct auth_context *auth)
- oid query_oids[MAX_OID_LEN];
- blob_t query;
-
-- if (auth_ok(auth)) {
-+ if (si->flags & SWITCHF_NO_IF_MIB_IFNAME)
-+ switchinfo_create_ifname(auth);
-+
-+ if (auth_ok(auth) ||
-+ !auth_need_info(auth, FORMAT_PORT_NAME | FORMAT_PORT_DESCR | FORMAT_PORT_WEBAUTH)) {
- auth_completed(auth);
- return;
- }
-
- pdu = snmp_pdu_create(SNMP_MSG_GET);
-- if (username_format_flags & FORMAT_PORT_NAME) {
-+ if (auth_need_info(auth, FORMAT_PORT_NAME)) {
- query = BLOB_OID(query_oids);
- blob_push(&query, BLOB_OID(IF_MIB_ifName));
- blob_push_oid(&query, auth->local_port);
- query = blob_pushed(BLOB_OID(query_oids), query);
- snmp_add_null_var(pdu, oid_blob(query));
- }
-- if (username_format_flags & FORMAT_PORT_DESCR) {
-+ if (auth_need_info(auth, FORMAT_PORT_DESCR)) {
- query = BLOB_OID(query_oids);
- blob_push(&query, BLOB_OID(IF_MIB_ifDescr));
- blob_push_oid(&query, auth->local_port);
- query = blob_pushed(BLOB_OID(query_oids), query);
- snmp_add_null_var(pdu, oid_blob(query));
- }
-- if (username_format_flags & FORMAT_PORT_WEBAUTH) {
-+ if (auth_need_info(auth, FORMAT_PORT_WEBAUTH)) {
- query = BLOB_OID(query_oids);
- blob_push(&query, BLOB_OID(HP_hpicfUsrAuthWebAuthSessionName));
- blob_push_oid(&query, auth->local_port);
---
-1.8.5.1
-