--------------------- PatchSet 5517 Date: 2007/08/28 03:02:27 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: SNMP now enabled in HEAD. - fix some of teh compile errors in this branch. Members: NOTES-IPv6:1.1.2.63->1.1.2.64 src/client_db.cc:1.5.4.15->1.5.4.16 src/snmp_core.cc:1.10.8.14->1.10.8.15 Index: squid3/NOTES-IPv6 =================================================================== RCS file: /cvsroot/squid-sf//squid3/Attic/NOTES-IPv6,v retrieving revision 1.1.2.63 retrieving revision 1.1.2.64 diff -u -r1.1.2.63 -r1.1.2.64 --- squid3/NOTES-IPv6 23 Aug 2007 04:28:12 -0000 1.1.2.63 +++ squid3/NOTES-IPv6 28 Aug 2007 03:02:27 -0000 1.1.2.64 @@ -1,4 +1,4 @@ -$Id: NOTES-IPv6,v 1.1.2.63 2007/08/23 04:28:12 amosjeffries Exp $ +$Id: NOTES-IPv6,v 1.1.2.64 2007/08/28 03:02:27 amosjeffries Exp $ NP: Any problems with this version of squid please contact squid3@treenet.co.nz for assistance. @@ -7,6 +7,13 @@ Any volunteers welcome. For the rest cache_dir's should be built from an empty state in the usual manner. +NP: Aug 28th, 2007 + 3.0-HEAD now enables SNMP internal by default for PRE7 release. + The IPv6 code for SNMP still contains compile errors so for + now testers pulling CVS code for this branch will need to add + --disable-snmp to their configure options. + This note will disappear when that is no longer needed. + IPv6 NEW FEATURES: Index: squid3/src/client_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_db.cc,v retrieving revision 1.5.4.15 retrieving revision 1.5.4.16 diff -u -r1.5.4.15 -r1.5.4.16 --- squid3/src/client_db.cc 10 Aug 2007 10:41:09 -0000 1.5.4.15 +++ squid3/src/client_db.cc 28 Aug 2007 03:02:27 -0000 1.5.4.16 @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.5.4.15 2007/08/10 10:41:09 amosjeffries Exp $ + * $Id: client_db.cc,v 1.5.4.16 2007/08/28 03:02:27 amosjeffries Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -425,6 +425,8 @@ static char key[16]; ClientInfo *c = NULL; int aggr = 0; + struct in_addr saddr4; + log_type l; *ErrP = SNMP_ERR_NOERROR; debugs(49, 6, "snmp_meshCtblFn: Current : "); @@ -443,8 +445,10 @@ switch (Var->name[LEN_SQ_NET + 2]) { case MESH_CTBL_ADDR: + /* FIXME INET6 : what can we send IFF addr is IPv6-only? */ + c->addr.GetInAddr(saddr4); Answer = snmp_var_new_integer(Var->name, Var->name_length, - (snint) c->addr.s_addr, + (snint) saddr4.s_addr, SMI_IPADDRESS); break; Index: squid3/src/snmp_core.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/snmp_core.cc,v retrieving revision 1.10.8.14 retrieving revision 1.10.8.15 diff -u -r1.10.8.14 -r1.10.8.15 --- squid3/src/snmp_core.cc 30 Jul 2007 11:09:09 -0000 1.10.8.14 +++ squid3/src/snmp_core.cc 28 Aug 2007 03:02:27 -0000 1.10.8.15 @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.10.8.14 2007/07/30 11:09:09 amosjeffries Exp $ + * $Id: snmp_core.cc,v 1.10.8.15 2007/08/28 03:02:27 amosjeffries Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -503,8 +503,7 @@ snmp_rq->len = len; snmp_rq->sock = sock; snmp_rq->outbuf = (unsigned char *)xmalloc(snmp_rq->outlen = SNMP_REQUEST_SIZE); - - from.GetSockAddr(snmp_rq->from); + snmp_rq->from = from; snmpDecodePacket(snmp_rq); xfree(snmp_rq->outbuf); xfree(snmp_rq); @@ -525,7 +524,7 @@ int len = rq->len; int allow = 0; - debugs(49, 5, "snmpDecodePacket: Called."); + debugs(49, 5, HERE << "Called."); /* Now that we have the data, turn it into a PDU */ PDU = snmp_pdu_create(0); rq->session.Version = SNMP_VERSION_1; @@ -534,7 +533,7 @@ if (Community) { ACLChecklist checklist; checklist.accessList = cbdataReference(Config.accessList.snmp); - checklist.src_addr = rq->from.sin_addr; + checklist.src_addr = rq->from; checklist.snmp_community = (char *) Community; /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ allow = checklist.fastCheck(); @@ -546,7 +545,7 @@ debugs(49, 5, "snmpAgentParse: reqid=[" << PDU->reqid << "]"); snmpConstructReponse(rq); } else { - debugs(49, 1, "Failed SNMP agent query from : " << inet_ntoa(rq->from.sin_addr) << "."); + debugs(49, 1, HERE << "Failed SNMP agent query from : " << rq->from); snmp_free_pdu(PDU); } @@ -569,7 +568,7 @@ if (RespPDU != NULL) { snmp_build(&rq->session, RespPDU, rq->outbuf, &rq->outlen); - comm_udp_sendto(rq->sock, &rq->from, sizeof(rq->from), rq->outbuf, rq->outlen); + comm_udp_sendto(rq->sock, rq->from, sizeof(rq->from), rq->outbuf, rq->outlen); snmp_free_pdu(RespPDU); } } @@ -841,7 +840,10 @@ peer *peers = Config.peers; struct IN_ADDR *laddr = NULL; - char *host_addr = NULL, *current_addr = NULL, *last_addr = NULL; + char *host_addr = NULL; + char *last_addr = NULL; + char current_addr[MAX_IPSTRLEN]; + current_addr[0] = '\0'; if (peers == NULL) { current = current->parent->parent->parent->leaves[1]; @@ -864,7 +866,7 @@ host_addr = inet_ntoa(*laddr); last_addr = (char *)xmalloc(strlen(host_addr)); strncpy(last_addr, host_addr, strlen(host_addr)); - current_addr = inet_ntoa(peers->in_addr.sin_addr); + peers->in_addr.NtoA(current_addr,MAX_IPSTRLEN); while ((peers) && (strncmp(last_addr, current_addr, strlen(current_addr)))) { if (peers->next) { @@ -905,7 +907,8 @@ oid *instance = NULL; u_char *cp = NULL; - struct IN_ADDR *laddr = NULL; + IPAddress *laddr = NULL; + struct in_addr iaddr; if (*len <= current->len) { instance = (oid *)xmalloc(sizeof(name) * (*len + 4)); @@ -913,7 +916,12 @@ laddr = client_entry(NULL); if (laddr) { - cp = (u_char *) & (laddr->s_addr); + laddr.GetInAddr(iaddr); + /* AYJ: the below seems to be a plain byte-wise mapping. + * of in_addr to uchar[4] + * may as well do : laddr.GetInAddr( *((struct in_addr*)&instance[*len]) ); + */ + cp = (u_char *) & (iaddr.s_addr); instance[*len] = *cp++; instance[*len + 1] = *cp++; instance[*len + 2] = *cp++; @@ -921,12 +929,15 @@ *len += 4; } } else { - laddr = oid2addr(&name[*len - 4]); - laddr = client_entry(laddr); + /* AYJ: what to do here in light of new laddr/iaddr types (in_addr iaddr WAS in_addr* laddr ) */ + laddr = (struct in_addr)oid2addr(&name[*len - 4]); + laddr = *client_entry(laddr); if (laddr) { instance = (oid *)xmalloc(sizeof(name) * (*len)); xmemcpy(instance, name, (sizeof(name) * *len)); + laddr.GetInAddr(iaddr); + /* AYJ: see above about mappings. */ cp = (u_char *) & (laddr->s_addr); instance[*len - 4] = *cp++; instance[*len - 3] = *cp++;