From: Amos Jeffries Date: Wed, 8 May 2013 03:02:01 +0000 (-0600) Subject: Polish client-side: make TcpAcceptor fill out EUI details X-Git-Tag: SQUID_3_4_0_1~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83b62d3f9ed575e4f523fd9de917b74878561f53;p=thirdparty%2Fsquid.git Polish client-side: make TcpAcceptor fill out EUI details The scope of TcpAcceptor is to receive new TCP connections and to fill out the state data about the new connectino as much as possible. EUI details about the client come under that state management. This change makes EUI details available about https_port and FTP data connections. --- diff --git a/src/Makefile.am b/src/Makefile.am index 17742fbf49..95bf17430b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -615,7 +615,6 @@ squid_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ $(DISK_LIBS) \ @@ -1583,7 +1582,6 @@ tests_testCacheManager_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -1592,6 +1590,7 @@ tests_testCacheManager_LDADD = \ ip/libip.la \ fs/libfs.la \ comm/libcomm.la \ + eui/libeui.la \ icmp/libicmp.la icmp/libicmp-core.la \ log/liblog.la \ format/libformat.la \ @@ -1725,6 +1724,7 @@ tests_testDiskIO_SOURCES = \ tests/stub_internal.cc \ tests/stub_ipc.cc \ tests/stub_ipcache.cc \ + tests/stub_libeui.cc \ tests/stub_libformat.cc \ tests/stub_libicmp.cc \ tests/stub_MemStore.cc \ @@ -1765,7 +1765,6 @@ tests_testDiskIO_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ libsquid.la \ @@ -1980,6 +1979,7 @@ tests_testEvent_SOURCES = \ tests/testMain.cc \ tests/stub_main_cc.cc \ tests/stub_ipc_Forwarder.cc \ + tests/stub_libeui.cc \ tests/stub_store_stats.cc \ time.cc \ tools.h \ @@ -2006,7 +2006,6 @@ tests_testEvent_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -2226,6 +2225,7 @@ tests_testEventLoop_SOURCES = \ tests/testMain.cc \ tests/stub_main_cc.cc \ tests/stub_ipc_Forwarder.cc \ + tests/stub_libeui.cc \ tests/stub_store_stats.cc \ time.cc \ tools.h \ @@ -2252,7 +2252,6 @@ tests_testEventLoop_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -2465,6 +2464,7 @@ tests_test_http_range_SOURCES = \ SwapDir.cc \ tests/test_http_range.cc \ tests/stub_ipc_Forwarder.cc \ + tests/stub_libeui.cc \ tests/stub_main_cc.cc \ tests/stub_MemStore.cc \ tests/stub_store_stats.cc \ @@ -2492,7 +2492,6 @@ tests_test_http_range_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -2588,6 +2587,7 @@ tests_testHttpRequest_SOURCES = \ tests/stub_DiskIOModule.cc \ tests/stub_main_cc.cc \ tests/stub_ipc_Forwarder.cc \ + tests/stub_libeui.cc \ tests/stub_store_stats.cc \ time.cc \ BodyPipe.cc \ @@ -2770,7 +2770,6 @@ tests_testHttpRequest_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -2903,6 +2902,7 @@ tests_testStore_SOURCES= \ tests/stub_helper.cc \ tests/stub_HelperChildConfig.cc \ tests/stub_http.cc \ + tests/stub_libeui.cc \ tests/stub_libformat.cc \ HttpBody.h \ HttpBody.cc \ @@ -2951,7 +2951,6 @@ tests_testStore_LDADD= \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -3022,7 +3021,6 @@ SWAP_TEST_DS =\ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -3044,6 +3042,7 @@ tests_testUfs_SOURCES = \ tests/stub_HelperChildConfig.cc \ tests/stub_icp.cc \ tests/stub_ipc.cc \ + tests/stub_libeui.cc \ tests/stub_MemStore.cc \ tests/stub_pconn.cc \ tests/stub_Port.cc \ @@ -3177,7 +3176,6 @@ tests_testUfs_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ @@ -3320,6 +3318,7 @@ tests_testRock_SOURCES = \ tests/stub_icp.cc \ tests/stub_ipc.cc \ tests/stub_ipcache.cc \ + tests/stub_libeui.cc \ tests/stub_libformat.cc \ tests/stub_libicmp.cc \ tests/stub_MemStore.cc \ @@ -3362,7 +3361,6 @@ tests_testRock_LDADD = \ acl/libacls.la \ acl/libapi.la \ acl/libstate.la \ - eui/libeui.la \ ipc/libipc.la \ mgr/libmgr.la \ base/libbase.la \ @@ -3391,6 +3389,7 @@ tests_testCoss_SOURCES = \ internal.h \ tests/stub_internal.cc \ tests/stub_ipc.cc \ + tests/stub_libeui.cc \ tests/stub_pconn.cc \ store_rebuild.h \ tests/stub_store_rebuild.cc \ @@ -3514,7 +3513,6 @@ tests_testCoss_LDADD = \ $(AUTH_ACL_LIBS) \ ident/libident.la \ acl/libacls.la \ - eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ diff --git a/src/client_side.cc b/src/client_side.cc index 2d11315498..f9061a3caf 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -98,7 +98,6 @@ #include "comm/Write.h" #include "CommCalls.h" #include "errorpage.h" -#include "eui/Config.h" #include "fd.h" #include "fde.h" #include "forward.h" @@ -3409,16 +3408,6 @@ connStateCreate(const Comm::ConnectionPointer &client, AnyP::PortCfg *port) } #endif -#if USE_SQUID_EUI - if (Eui::TheConfig.euiLookup) { - if (client->remote.IsIPv4()) { - result->clientConnection->remoteEui48.lookup(client->remote); - } else if (client->remote.IsIPv6()) { - result->clientConnection->remoteEui64.lookup(client->remote); - } - } -#endif - clientdbEstablished(client->remote, 1); result->flags.readMore = true; diff --git a/src/comm/TcpAcceptor.cc b/src/comm/TcpAcceptor.cc index 1696e797a9..c95cbac44b 100644 --- a/src/comm/TcpAcceptor.cc +++ b/src/comm/TcpAcceptor.cc @@ -41,6 +41,7 @@ #include "comm/Connection.h" #include "comm/Loops.h" #include "comm/TcpAcceptor.h" +#include "eui/Config.h" #include "fd.h" #include "fde.h" #include "globals.h" @@ -381,6 +382,16 @@ Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details) return COMM_ERROR; } +#if USE_SQUID_EUI + if (Eui::TheConfig.euiLookup) { + if (conn->remote.IsIPv4()) { + conn->remoteEui48.lookup(conn->remote); + } else if (conn->remote.IsIPv6()) { + conn->remoteEui64.lookup(conn->remote); + } + } +#endif + PROF_stop(comm_accept); return COMM_OK; } diff --git a/src/tests/stub_libeui.cc b/src/tests/stub_libeui.cc new file mode 100644 index 0000000000..3bb95848a1 --- /dev/null +++ b/src/tests/stub_libeui.cc @@ -0,0 +1,25 @@ +#include "squid.h" + +#define STUB_API "eui/libeui.la" +#include "STUB.h" + +#include "eui/Config.h" +Eui::EuiConfig Eui::TheConfig; + +#include "eui/Eui48.h" +#if USE_SQUID_EUI + const unsigned char *Eui::Eui48::get(void) STUB_RETVAL(NULL) + bool Eui::Eui48::decode(const char *asc) STUB_RETVAL(false) + bool Eui::Eui48::encode(char *buf, const int len) STUB_RETVAL(false) + bool Eui::Eui48::lookup(const Ip::Address &c) STUB_RETVAL(false) +#endif + +#include "eui/Eui64.h" +#if USE_SQUID_EUI + const unsigned char *Eui::Eui64::get(void) STUB_RETVAL(NULL) + bool Eui::Eui64::decode(const char *asc) STUB_RETVAL(false) + bool Eui::Eui64::encode(char *buf, const int len) STUB_RETVAL(false) + bool Eui::Eui64::lookup(const Ip::Address &c) STUB_RETVAL(false) + bool Eui::Eui64::lookupNdp(const Ip::Address &c) STUB_RETVAL(false) + bool Eui::Eui64::lookupSlaac(const Ip::Address &c) STUB_RETVAL(false) +#endif