struct cli_session_actions *cli_session_actions = NULL; // Pending session changes requested by CLI
struct cli_tunnel_actions *cli_tunnel_actions = NULL; // Pending tunnel changes required by CLI
-union iphash ip_hash[256]; // Mapping from IP address to session structures.
+union iphash
+{
+ sessionidt sess;
+ union iphash *idx;
+}ip_hash[256]; // Mapping from IP address to session structures.
struct ipv6radix {
sessionidt sess;
int s;
char ipv6addr[INET6_ADDRSTRLEN];
- curnode = &ipv6_hash[ip.s6_addr[0]];
curnode = &ipv6_hash[((ip.s6_addr[0]) & 0xF0)>>4];
i = 1;
s = curnode->sess;
if (s > 0)
LOG(4, s, session[s].tunnel, "Caching ip address %s\n", fmtaddr(nip, 0));
-
else if (s == 0)
LOG(4, 0, 0, "Un-caching ip address %s\n", fmtaddr(nip, 0));
// else a map to an ip pool index.
ip = *(uint32_t *)(buf + 16);
if ((g = grp_groupbyip(ip)))
{
- s = grp_getnextsession(g, ip, ip_src);
+ s = grp_getnextsession(g, &ip, &ip_src, 0);
if (!s)
{
// Is this a packet for a session that doesn't exist?
static void processipv6out(uint8_t * buf, int len)
{
sessionidt s;
+ groupidt g;
sessiont *sp;
tunnelidt t;
- struct in6_addr ip6;
+ struct in6_addr *p_ip6;
+ struct in6_addr *p_ip6_src;
uint8_t *data = buf; // Keep a copy of the originals.
int size = len;
return;
}
- ip6 = *(struct in6_addr *)(buf+24);
- s = sessionbyipv6(ip6);
+ p_ip6_src = (struct in6_addr *)(buf+8);
+ p_ip6 = (struct in6_addr *)(buf+24);
- if (s == 0)
+ if ((g = grp_groupbyipv6(*p_ip6)))
{
- s = sessionbyipv6new(ip6);
+ s = grp_getnextsession(g, p_ip6, p_ip6_src, 1);
+ }
+ else if (!(s = sessionbyipv6(*p_ip6)))
+ {
+ s = sessionbyipv6new(*p_ip6);
}
if (s == 0)
}
// check v6 routing
- for (i = 0; i < MAXROUTE6 && new->route6[i].ipv6prefixlen; i++)
+ if (new->ppp.ipv6cp == Opened && session[s].ppp.ipv6cp != Opened)
{
- route6set(s, new->route6[i].ipv6route, new->route6[i].ipv6prefixlen, 1);
+ for (i = 0; i < MAXROUTE6 && new->route6[i].ipv6prefixlen; i++)
+ {
+ route6set(s, new->route6[i].ipv6route, new->route6[i].ipv6prefixlen, 1);
+ }
}
if (new->ipv6address.s6_addr[0] && new->ppp.ipv6cp == Opened && session[s].ppp.ipv6cp != Opened)