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
|
||||||
|
|
|
||||||
42
l2tpns.c
42
l2tpns.c
|
|
@ -5227,18 +5227,18 @@ int sessionsetup(sessionidt s, tunnelidt t)
|
||||||
LOG(3, s, t, "Doing session setup for session\n");
|
LOG(3, s, t, "Doing session setup for session\n");
|
||||||
|
|
||||||
// Join a bundle if the MRRU option is accepted
|
// Join a bundle if the MRRU option is accepted
|
||||||
if(session[s].mrru > 0 && session[s].bundle == 0)
|
if(session[s].mrru > 0 && session[s].bundle == 0)
|
||||||
{
|
{
|
||||||
LOG(3, s, t, "This session can be part of multilink bundle\n");
|
LOG(3, s, t, "This session can be part of multilink bundle\n");
|
||||||
if (join_bundle(s) > 0)
|
if (join_bundle(s) > 0)
|
||||||
cluster_send_bundle(session[s].bundle);
|
cluster_send_bundle(session[s].bundle);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(0, s, t, "MPPP: Mismaching mssf option with other sessions in bundle\n");
|
LOG(0, s, t, "MPPP: Mismaching mssf option with other sessions in bundle\n");
|
||||||
sessionshutdown(s, "Mismaching mssf option.", CDN_NONE, TERM_SERVICE_UNAVAILABLE);
|
sessionshutdown(s, "Mismaching mssf option.", CDN_NONE, TERM_SERVICE_UNAVAILABLE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!session[s].ip)
|
if (!session[s].ip)
|
||||||
{
|
{
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5280,16 +5280,16 @@ int sessionsetup(sessionidt s, tunnelidt t)
|
||||||
if (session[s].walled_garden || session[i].walled_garden) continue;
|
if (session[s].walled_garden || session[i].walled_garden) continue;
|
||||||
// Guest change
|
// Guest change
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int gu;
|
int gu;
|
||||||
for (gu = 0; gu < guest_accounts_num; gu++)
|
for (gu = 0; gu < guest_accounts_num; gu++)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(user, guest_users[gu]))
|
if (!strcasecmp(user, guest_users[gu]))
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) continue;
|
if (found) continue;
|
||||||
|
|
||||||
// Drop the new session in case of duplicate sessionss, not the old one.
|
// Drop the new session in case of duplicate sessionss, not the old one.
|
||||||
if (!strcasecmp(user, session[i].user))
|
if (!strcasecmp(user, session[i].user))
|
||||||
|
|
@ -5300,7 +5300,7 @@ int sessionsetup(sessionidt s, tunnelidt t)
|
||||||
// no need to set a route for the same IP address of the bundle
|
// no need to set a route for the same IP address of the bundle
|
||||||
if (!session[s].bundle || (bundle[session[s].bundle].num_of_links == 1))
|
if (!session[s].bundle || (bundle[session[s].bundle].num_of_links == 1))
|
||||||
{
|
{
|
||||||
int routed = 0;
|
int routed = 0;
|
||||||
|
|
||||||
// Add the route for this session.
|
// Add the route for this session.
|
||||||
for (r = 0; r < MAXROUTE && session[s].route[r].ip; r++)
|
for (r = 0; r < MAXROUTE && session[s].route[r].ip; r++)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue