Fix the inverted "delete/add" of the routes, in cluster mode.
This commit is contained in:
parent
e1412c5ca0
commit
7fd68b1dae
4 changed files with 58 additions and 21 deletions
30
cluster.c
30
cluster.c
|
|
@ -1002,6 +1002,36 @@ static int type_changed(int type, int id)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The deleted session, must be before the new session
|
||||||
|
int cluster_listinvert_session(int sidnew, int sidtodel)
|
||||||
|
{
|
||||||
|
int i, inew = 0;
|
||||||
|
|
||||||
|
for (i = 0 ; i < config->cluster_num_changes ; ++i)
|
||||||
|
{
|
||||||
|
if ( cluster_changes[i].id == sidtodel && cluster_changes[i].type == C_CSESSION)
|
||||||
|
return 0; // Deleted session already before the new session.
|
||||||
|
|
||||||
|
if ( cluster_changes[i].id == sidnew && cluster_changes[i].type == C_CSESSION)
|
||||||
|
{
|
||||||
|
inew = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( ; i < config->cluster_num_changes ; ++i)
|
||||||
|
{
|
||||||
|
if ( cluster_changes[i].id == sidtodel && cluster_changes[i].type == C_CSESSION)
|
||||||
|
{
|
||||||
|
// Reverse position
|
||||||
|
cluster_changes[i].id = sidnew;
|
||||||
|
cluster_changes[inew].id = sidtodel;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// A particular session has been changed!
|
// A particular session has been changed!
|
||||||
int cluster_send_session(int sid)
|
int cluster_send_session(int sid)
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ typedef struct {
|
||||||
|
|
||||||
int cluster_init(void);
|
int cluster_init(void);
|
||||||
int processcluster(uint8_t *buf, int size, in_addr_t addr);
|
int processcluster(uint8_t *buf, int size, in_addr_t addr);
|
||||||
|
int cluster_listinvert_session(int sidnew, int sidtodel);
|
||||||
int cluster_send_session(int sid);
|
int cluster_send_session(int sid);
|
||||||
int cluster_send_bundle(int bid);
|
int cluster_send_bundle(int bid);
|
||||||
int cluster_send_tunnel(int tid);
|
int cluster_send_tunnel(int tid);
|
||||||
|
|
|
||||||
6
debian/changelog
vendored
6
debian/changelog
vendored
|
|
@ -1,3 +1,9 @@
|
||||||
|
l2tpns (2.2.1-2fdn2.1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Fix the inverted "delete/add" of the routes, in cluster mode.
|
||||||
|
|
||||||
|
-- Fernando Alves <fernando.alves@sameswireless.fr> Sun, 18 Nov 2012 15:59:44 +0100
|
||||||
|
|
||||||
l2tpns (2.2.1-2fdn2) unstable; urgency=low
|
l2tpns (2.2.1-2fdn2) unstable; urgency=low
|
||||||
|
|
||||||
* merge from branch fendo-mods, MLPPP developments
|
* merge from branch fendo-mods, MLPPP developments
|
||||||
|
|
|
||||||
8
l2tpns.c
8
l2tpns.c
|
|
@ -5253,7 +5253,6 @@ int sessionsetup(sessionidt s, tunnelidt t)
|
||||||
fmtaddr(htonl(session[s].ip), 0));
|
fmtaddr(htonl(session[s].ip), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make sure this is right
|
// Make sure this is right
|
||||||
session[s].tunnel = t;
|
session[s].tunnel = t;
|
||||||
|
|
||||||
|
|
@ -5266,13 +5265,14 @@ int sessionsetup(sessionidt s, tunnelidt t)
|
||||||
for (i = 1; i <= config->cluster_highest_sessionid; i++)
|
for (i = 1; i <= config->cluster_highest_sessionid; i++)
|
||||||
{
|
{
|
||||||
if (i == s) continue;
|
if (i == s) continue;
|
||||||
if (!session[s].opened) continue;
|
if (!session[s].opened) break;
|
||||||
// Allow duplicate sessions for multilink ones of the same bundle.
|
// Allow duplicate sessions for multilink ones of the same bundle.
|
||||||
if (session[s].bundle && session[i].bundle && session[s].bundle == session[i].bundle)
|
if (session[s].bundle && session[i].bundle && session[s].bundle == session[i].bundle) continue;
|
||||||
continue;
|
|
||||||
if (ip == session[i].ip)
|
if (ip == session[i].ip)
|
||||||
{
|
{
|
||||||
sessionkill(i, "Duplicate IP address");
|
sessionkill(i, "Duplicate IP address");
|
||||||
|
cluster_listinvert_session(s, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue