Clean up dead stuff from OneService and fix build errors.
This commit is contained in:
parent
900ec143a8
commit
5cfbb0a423
25 changed files with 45 additions and 9785 deletions
|
@ -322,8 +322,43 @@ public:
|
|||
* @param mac MAC address of destination
|
||||
* @param addr Bridge this MAC is reachable behind
|
||||
*/
|
||||
void learnBridgeRoute(const MAC &mac,const Address &addr);
|
||||
|
||||
inline void learnBridgeRoute(const MAC &mac,const Address &addr)
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
_remoteBridgeRoutes[mac] = addr;
|
||||
|
||||
// Anti-DOS circuit breaker to prevent nodes from spamming us with absurd numbers of bridge routes
|
||||
while (_remoteBridgeRoutes.size() > ZT_MAX_BRIDGE_ROUTES) {
|
||||
Hashtable< Address,unsigned long > counts;
|
||||
Address maxAddr;
|
||||
unsigned long maxCount = 0;
|
||||
|
||||
MAC *m = (MAC *)0;
|
||||
Address *a = (Address *)0;
|
||||
|
||||
// Find the address responsible for the most entries
|
||||
{
|
||||
Hashtable<MAC,Address>::Iterator i(_remoteBridgeRoutes);
|
||||
while (i.next(m,a)) {
|
||||
const unsigned long c = ++counts[*a];
|
||||
if (c > maxCount) {
|
||||
maxCount = c;
|
||||
maxAddr = *a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Kill this address from our table, since it's most likely spamming us
|
||||
{
|
||||
Hashtable<MAC,Address>::Iterator i(_remoteBridgeRoutes);
|
||||
while (i.next(m,a)) {
|
||||
if (*a == maxAddr)
|
||||
_remoteBridgeRoutes.erase(*m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Learn a multicast group that is bridged to our tap device
|
||||
*
|
||||
|
@ -331,7 +366,11 @@ public:
|
|||
* @param mg Multicast group
|
||||
* @param now Current time
|
||||
*/
|
||||
void learnBridgedMulticastGroup(void *tPtr,const MulticastGroup &mg,int64_t now);
|
||||
inline void learnBridgedMulticastGroup(void *tPtr,const MulticastGroup &mg,int64_t now)
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
_multicastGroupsBehindMe.set(mg,now);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a credential and learn it if it passes certificate and other checks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue