original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,211 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm.c,v $ $Revision: 1.16 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6pm_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_ipd.h>
#include <ipcom_syslog.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <private/ipmip_dhcp.h>
#include <private/ipmip_inet.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_pkt.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6pm.h"
#include "ipmip6pm_h.h"
#include "ipmip6pm_node.h"
#include "ipmip6pm_attr_h.h"
#include "ipmip6pm_ifevent.h"
#include "ipmip6pm_mh.h"
#include "ipmip6pm_icmp.h"
#include "ipmip6pm_if.h"
#include "ipmip6pm_route.h"
#include "ipmip6pm_pktbuf.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
IP_PUBLIC Ip_err ipmip6pm_exit(void);
IP_PUBLIC Ip_err ipmip6pm_init(void);
IP_PUBLIC Ip_err ipmip6pm_start(void);
IP_PUBLIC const char *ipmip6pm_version(void);
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
#ifdef IP_PORT_LAS
extern void ipnet_radvd_main(Ip_bool do_ipd);
extern Ip_err ipnet_radvd_create(void);
IPCOM_PROCESS(ipmip6pm_radvd_proc);
IPCOM_PROCESS(ipmip6pm_radvd_proc)
{
ipnet_radvd_create();
ipnet_radvd_main(IP_FALSE);
}
#endif
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
IP_PUBLIC IPCOM_PROCESS(ipmip6pm_proc);
IP_PUBLIC
IPCOM_PROCESS(ipmip6pm_proc)
{
#ifdef IP_PORT_LAS
ipcom_proc_create("ipmip6pm_radvd", (Ipcom_proc_func)ipmip6pm_radvd_proc,
IPCOM_PROC_STACK_LARGE, IP_NULL);
#endif
ipmip6pm_main();
}
/*
*===========================================================================
* ipmip6pm_start
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err
ipmip6pm_start(void)
{
Ipcom_proc_attr attr;
Ip_err ret;
ipcom_proc_attr_init(&attr);
attr.stacksize = IPCOM_PROC_STACK_LARGE;
ret = ipcom_proc_acreate("ipmip6pmd", ipmip6pm_proc, &attr, IP_NULL);
ip_assert(ret == IPCOM_SUCCESS);
return ret;
}
/*
*===========================================================================
* ipmip6pm_version
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC const char *
ipmip6pm_version(void)
{
return "@(#) IPMIP6PM $Name: VXWORKS_ITER40_2019102207 $ - INTERPEAK_COPYRIGHT_STRING";
}
#if defined (IP_PORT_LAS)
IP_PUBLIC Ip_err ipcom_daemon_configure(void);
IP_PUBLIC Ip_err ipcom_daemon_create(void);
IP_PUBLIC Ip_err
ipcom_daemon_configure(void)
{
return IPCOM_SUCCESS;
}
IP_PUBLIC Ip_err
ipcom_daemon_create(void)
{
return IPCOM_SUCCESS;
}
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,118 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_attr_h.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_attr_h.h,v $
* $Author: jhorteli $ $Date: 2009-02-25 14:34:26 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_ATTR_H_H
#define IPMIP6PM_ATTR_H_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipmip6pm_attr.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6pm_context;
struct Ipmip6pm_node;
struct Ipmip_proc;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip6pm_attr_command - ipmip6pm_attr_command
*
* Process an attribute command
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i request
* Issued command.
* \ie
*
* RETURNS: IPCOM_SUCCESS when successful
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmip6pm_attr_command
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_cli_message *request
);
IP_GLOBAL void ipmip6pm_attr_delete_event(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6pm_attr_status_change(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node,
Ip_u32 status);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,722 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_cli.c,v $ $Revision: 1.11 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_cli.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6pm_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_err.h>
#include <ipcom_inet.h>
#include <ipcom_ipd.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock.h>
#include <ipcom_sock2.h>
#include <ipcom_sysctl.h>
#include <ipcom_syslog.h>
#include <ipcom_route.h>
#include <ipmip.h>
#include <private/ipmip_buffer.h>
#include <private/ipmip_util.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_util.h>
#include <private/ipmip6_address.h>
#include "ipmip6pm.h"
#include "ipmip6pm_attr.h"
#include "ipmip6pm_cli.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
IP_PUBLIC Ip_bool
ipmip6pm_cli_connect(Ipmip_cli_daemon_t *daemon_info)
{
ipmip_cli_daemon_init(daemon_info, "ipmip6pm", IPCOM_IPD_ID_IPMIP6PM);
return ipmip_cli_daemon_connect(daemon_info);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_nai(Ipmip_cli_daemon_req_t *req,
const char *nai)
{
if (nai)
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_MOBILE_NAI, nai);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_handle(Ipmip_cli_daemon_req_t *req,
Ip_u32 handle)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HANDLE, handle);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_ifname(Ipmip_cli_daemon_req_t *req,
const char *ifname)
{
if (ifname)
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_IFNAME, ifname);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_service(Ipmip_cli_daemon_req_t *req,
const char *module,
const char *value)
{
Ip_size_t rta = ipmip_attr_begin(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE, module);
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE, value);
ipmip_attr_end(&req->reqbuf, rta);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_link(Ipmip_cli_daemon_req_t *req,
const char *module,
const char *value)
{
Ip_size_t rta = ipmip_attr_begin(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_LINK);
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE, module);
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE, value);
ipmip_attr_end(&req->reqbuf, rta);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_MAG_configuration(Ipmip_cli_daemon_req_t *req,
const char *ifname)
{
if (ifname)
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_COA_IFNAME, ifname);
}
IP_PUBLIC void
ipmip6pm_cli_request_add_prefix(Ipmip_cli_daemon_req_t *req,
struct Ipmip6_address *prefix)
{
if (prefix)
ipmip_attr_put(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_PREFIX_LIST, sizeof(*prefix), prefix);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC void
ipmip6pm_cli_request_add_home_address_inet(Ipmip_cli_daemon_req_t *req,
struct Ipmip6_inet *prefix)
{
if (prefix)
ipmip_attr_put(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_ADDRESS_INET, sizeof(*prefix), prefix);
}
#endif
IP_PUBLIC void
ipmip6pm_cli_request_set_homeagent(Ipmip_cli_daemon_req_t *req,
const struct Ip_in6_addr *homeagent)
{
if (homeagent)
ipmip_attr_put_inet6(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT, homeagent);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC void
ipmip6pm_cli_request_set_homeagent_inet(Ipmip_cli_daemon_req_t *req,
Ip_u32 homeagent)
{
if (homeagent)
ipmip_attr_put_inet(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT_INET, homeagent);
}
#endif
IP_PUBLIC void
ipmip6pm_cli_request_set_link_layer(Ipmip_cli_daemon_req_t *req,
void *lla,
Ip_size_t lla_size)
{
if (lla != IP_NULL && lla_size > 0)
ipmip_attr_put(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_IFIDENT, lla_size, lla);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_gre_downlink(Ipmip_cli_daemon_req_t *req,
Ip_u32 downlink)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_GRE, downlink);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_tunnel_type(Ipmip_cli_daemon_req_t *req,
Ip_u8 tunnel_type)
{
/**/
if (tunnel_type < IPMIP_TUNNELTYPE_MAX)
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_TYPE, tunnel_type);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_transport_mask(Ipmip_cli_daemon_req_t *req,
Ip_u32 mask)
{
if (mask)
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_TRANSPORT_MASK, mask);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_handoff_indicator(Ipmip_cli_daemon_req_t *req,
Ip_u32 handoff_indicator)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HANDOFF_INDICATOR, handoff_indicator);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_access_type(Ipmip_cli_daemon_req_t *req,
Ip_u32 access_type)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_ACCESS_TYPE, access_type);
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_handle_next(Ipmip_attr_iter_t *iter)
{
/**/
return ipmip_attr_get_u32(ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_BC_P_HANDLE));
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_handle_get(Ipmip_cli_daemon_req_t *req)
{
/**/
return ipmip_attr_get_u32(ipmip_cli_daemon_find_request(req, IPMIP6PM_CLI_ATTR_BC_P_HANDLE));
}
IP_PUBLIC const char *
ipmip6pm_cli_node_get_ifname(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_str(node, IPMIP6PM_CLI_ATTR_BC_P_IFNAME);
}
IP_PUBLIC const char *
ipmip6pm_cli_node_get_tunnel_ifname(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_str(node, IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_IFNAME);
}
IP_PUBLIC struct Ip_in6_addr *
ipmip6pm_cli_node_get_home_agent(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_inet6(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC Ip_u32
ipmip6pm_cli_node_get_home_agent_inet(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_inet(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT_INET);
}
#endif
IP_PUBLIC Ip_u8
ipmip6pm_cli_node_get_tunnel_type(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_TYPE);
}
IP_PUBLIC struct Ipmip_attr *
ipmip6pm_cli_node_get_gre_keys(struct Ipmip_attr *node)
{
return ipmip_attr_payload_find(node, IPMIP6PM_CLI_ATTR_BC_P_GRE);
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_node_get_transport_mask(struct Ipmip_attr *node)
{
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_TRANSPORT_MASK);
}
IP_PUBLIC const char *
ipmip6pm_cli_node_get_nai(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_str(node, IPMIP6PM_CLI_ATTR_BC_P_MOBILE_NAI);
}
IP_PUBLIC struct Ipmip6_mib_mip6MnBLTable *
ipmip6pm_cli_node_get_mip6MnBLTable(struct Ipmip_attr *node)
{
/**/
return (struct Ipmip6_mib_mip6MnBLTable *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MIB_mip6MnBLTable);
}
IP_PUBLIC struct Ipmip6_mib_mip6NodeTrafficEntry *
ipmip6pm_cli_node_get_mip6NodeTrafficEntry(struct Ipmip_attr *node)
{
/**/
return (struct Ipmip6_mib_mip6NodeTrafficEntry *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MIB_mip6NodeTrafficEntry);
}
IP_PUBLIC struct Ipmip_lladdr *
ipmip6pm_cli_node_get_iflla(struct Ipmip_attr *node)
{
return (struct Ipmip_lladdr *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_IFLLA);
}
IP_PUBLIC struct Ipmip_lladdr *
ipmip6pm_cli_node_get_MAG_iflla(struct Ipmip_attr *node)
{
return (struct Ipmip_lladdr *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MAG_Link_Layer);
}
IP_PUBLIC struct Ipmip6_address *
ipmip6pm_cli_node_get_MAG_link_local(struct Ipmip_attr *node)
{
return (struct Ipmip6_address *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MAG_Link_Local);
}
IP_PUBLIC struct Ipmip6_address *
ipmip6pm_cli_node_get_home_prefix_list(struct Ipmip_attr *node,
Ip_u32 *sz)
{
struct Ipmip_attr *rta = ipmip_attr_payload_find(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_PREFIX_LIST);
if (rta)
{
*sz = IPMIP_ATTR_PAYLOAD(rta) / sizeof(Ipmip6_address_t);
return *sz? (Ipmip6_address_t *)IPMIP_ATTR_DATA(rta) : IP_NULL;
}
return IP_NULL;
}
#ifdef IPMIP_USE_INET
IP_PUBLIC struct Ipmip6_inet *
ipmip6pm_cli_node_get_home_address_inet(struct Ipmip_attr *node)
{
return (struct Ipmip6_inet *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_ADDRESS_INET);
}
#endif
IP_PUBLIC Ip_time_t
ipmip6pm_cli_node_get_created(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_time_t(node, IPMIP6PM_CLI_ATTR_BC_P_CREATED);
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_node_get_access_type(struct Ipmip_attr *node)
{
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_ACCESS_TYPE);
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_node_get_handoff_indicator(struct Ipmip_attr *node)
{
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_HANDOFF_INDICATOR);
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_node_get_status(struct Ipmip_attr *node)
{
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_STATUS);
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_node_get_handle(struct Ipmip_attr *node)
{
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_HANDLE);
}
IP_PUBLIC int
ipmip6pm_cli_link_list(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req)
{
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_LIST_LINK);
return ipmip_cli_daemon_request(daemon, req);
}
IP_PUBLIC Ip_bool
ipmip6pm_cli_link_next(Ipmip_attr_iter_t *iter,
char **name,
char **value)
{
/**/
struct Ipmip_attr *srv = ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_BC_P_LINK);
if (srv)
{
*name = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE);
*value = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE);
return IP_TRUE;
}
return IP_FALSE;
}
IP_PUBLIC int
ipmip6pm_cli_service_list(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req)
{
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_LIST_SERVICE);
return ipmip_cli_daemon_request(daemon, req);
}
IP_PUBLIC Ip_bool
ipmip6pm_cli_service_next(Ipmip_attr_iter_t *iter,
char **name,
char **value)
{
/**/
struct Ipmip_attr *srv = ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
if (srv)
{
*name = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE);
*value = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE);
return IP_TRUE;
}
return IP_FALSE;
}
IP_PUBLIC int
ipmip6pm_cli_node_list(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req,
const char *nai,
const char *ifname)
{
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_LIST);
ipmip6pm_cli_request_set_ifname(req, ifname);
ipmip6pm_cli_request_set_nai(req, nai);
return ipmip_cli_daemon_request(daemon, req);
}
IP_PUBLIC struct Ipmip_attr *
ipmip6pm_cli_node_get(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req,
Ip_u32 handle)
{
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_GET);
ipmip6pm_cli_request_set_handle(req, handle);
if (ipmip_cli_daemon_request(daemon, req) == IPCOM_SUCCESS)
return ipmip_cli_daemon_find_request(req, IPMIP6PM_CLI_ATTR_BC_P);
return IP_NULL;
}
IP_PUBLIC void
ipmip6pm_cli_node_delete(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_DELETE);
ipmip6pm_cli_request_set_handle(&req, handle);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
IP_PUBLIC void
ipmip6pm_cli_node_deregister(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle,
Ip_bool ack)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, ack? IPMIP6PM_CLI_BC_P_DEREGISTER : IPMIP6PM_CLI_BC_P_DEREGISTER_DELETE);
ipmip6pm_cli_request_set_handle(&req, handle);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
IP_PUBLIC void
ipmip6pm_cli_handoff_request_init(Ipmip_cli_daemon_req_t *req,
const char *nai,
const char *ifname)
{
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_CREATE);
ipmip6pm_cli_request_set_nai(req, nai);
ipmip6pm_cli_request_set_ifname(req, ifname);
}
IP_PUBLIC void
ipmip6pm_cli_multicast_status(Ipmip_cli_daemon_t *daemon,
Ip_bool enable)
{
if (enable)
ipmip_cli_multicast_add(daemon, IPMIP6PM_CLI_BC_P_STATUS);
else
ipmip_cli_multicast_del(daemon, IPMIP6PM_CLI_BC_P_STATUS);
}
IP_PUBLIC Ip_u32
ipmip6pm_cli_node_retrieve_status(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle)
{
Ipmip_cli_daemon_req_t req;
struct Ipmip_attr *node;
Ip_u32 status = IPMIP6PM_CLI_ATTR_BC_P_STATUS_DELETED;
ipmip_cli_daemon_request_init(&req);
node = ipmip6pm_cli_node_get(daemon, &req, handle);
if (node)
status = ipmip6pm_cli_node_get_status(node);
ipmip_cli_daemon_request_release(&req);
return status;
}
IP_PUBLIC Ip_bool
ipmip6pm_cli_node_wait_status(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle,
Ip_u32 status,
struct Ip_timeval *tv)
{
struct Ipmip_attr *node;
Ip_u32 tmp;
/* Do initial status check */
tmp = ipmip6pm_cli_node_retrieve_status(daemon, handle);
if (tmp == status)
return IP_TRUE;
if (tmp == IPMIP6PM_CLI_ATTR_BC_P_STATUS_DELETED)
return IP_FALSE;
/* Wait for it to be reported */
while (ipmip_cli_daemon_recvmsg(daemon, tv) == 0)
{
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&daemon->message);
if (IPMIP_ATTR_HDR_SEQUENCE(hdr) == 0 && IPMIP_ATTR_HDR_SYSTEM(hdr) == 0 && IPMIP_ATTR_HDR_TYPE(hdr) == IPMIP6PM_CLI_BC_P_STATUS)
{
node = ipmip_attr_hdr_find(hdr, IPMIP6PM_CLI_ATTR_BC_P);
if (node)
{
if (ipmip6pm_cli_node_get_handle(node) == handle)
{
tmp = ipmip6pm_cli_node_get_status(node);
if (tmp == status)
return IP_TRUE;
/* Final state? */
if (tmp == IPMIP6PM_CLI_ATTR_BC_P_STATUS_DELETED)
return IP_FALSE;
}
}
}
}
return IP_FALSE;
}
IP_PUBLIC int
ipmip6pm_cli_lma_list(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req)
{
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_GET_LMA);
return ipmip_cli_daemon_request(daemon, req);
}
IP_PUBLIC struct Ipmip_attr*
ipmip6pm_cli_lma_next(Ipmip_attr_iter_t *iter)
{
/**/
return ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_LMA);
}
IP_PUBLIC struct Ip_in6_addr *
ipmip6pm_cli_lma_get_addr_v6(struct Ipmip_attr *lma)
{
/**/
return ipmip_attr_payload_find_inet6(lma, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC Ip_u32
ipmip6pm_cli_lma_get_addr_v4(struct Ipmip_attr *lma)
{
/**/
return ipmip_attr_payload_find_inet(lma, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT_INET);
}
#endif
IP_PUBLIC const char *
ipmip6pm_cli_lma_get_ifname(struct Ipmip_attr *lma)
{
/**/
return ipmip_attr_payload_find_str(lma, IPMIP6PM_CLI_ATTR_BC_P_IFNAME);
}
IP_PUBLIC void
ipmip6pm_cli_request_set_revoke_reason(Ipmip_cli_daemon_req_t *req,
Ip_u8 reason)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_REVOKE_REASON, reason);
}
IP_PUBLIC void
ipmip6pm_cli_lma_revoke(Ipmip_cli_daemon_t *daemon,
const char *ifname,
const struct Ip_in6_addr *lma,
Ip_u8 reason)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_REVOKE_LMA);
ipmip6pm_cli_request_set_homeagent(&req, lma);
ipmip6pm_cli_request_set_revoke_reason(&req, reason);
ipmip6pm_cli_request_set_ifname(&req, ifname);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
IP_PUBLIC void
ipmip6pm_cli_node_revoke(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle,
Ip_u32 reason)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_REVOKE);
ipmip6pm_cli_request_set_handle(&req, handle);
ipmip6pm_cli_request_set_revoke_reason(&req, reason);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC void
ipmip6pm_cli_node_revoke_inet(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle,
Ip_u32 reason)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_REVOKE_INET);
ipmip6pm_cli_request_set_handle(&req, handle);
ipmip6pm_cli_request_set_revoke_reason(&req, reason);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,238 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_h.h,v $ $Revision: 1.12 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_h.h,v $
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_H_H
#define IPMIP6PM_H_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
IPMIP6PM_SERVICE_PKT_REPLY_VERIFY,
IPMIP6PM_SERVICE_PKT_REPLY_ACCEPT,
IPMIP6PM_SERVICE_PKT_REQUEST
};
enum
{
IPMIP6PM_FUNCTION_LINK = 0,
IPMIP6PM_FUNCTION_SERVICE,
IPMIP6PM_FUNCTION_MAX
};
#define IPMIP6PM_FUNCTION_FUNC(f) ((f) >> 16)
#define IPMIP6PM_FUNCTION_TYPE(f) ((f) & 0xFFFF)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip_cli_message;
struct Ipmip6pm_context;
struct Ipmip6pm_if;
struct Ipmip_proc;
struct Ipmip6pm_node;
struct Ipmip_timer;
struct Ipmip6pm_pktbuf;
struct Ipmip_context_id;
typedef void (*Ipmip6pm_extension_config_global_t)
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
int action,
void *global_config,
struct Ipmip_cli_message *request
);
typedef void (*Ipmip6pm_extension_config_ifp_t)
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmip6pm_if *ifp,
void *global_config,
void *ifp_config,
struct Ipmip_cli_message *request
);
typedef int (*Ipmip6pm_extension_provide_t)
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
int action,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6pm_node *node,
struct Ipmip_timer *service
);
typedef Ip_bool (*Ipmip6pm_extension_setup_t)
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
int action,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6pm_node *node,
const char *value,
struct Ipmip_cli_message *request
);
typedef Ip_bool (*Ipmip6pm_extension_pkt_rep_validate_t)
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6pm_node *node,
struct Ipmip6pm_pktbuf *pbuf,
struct Ipmip_timer *service
);
typedef Ip_bool (*Ipmip6pm_extension_pkt_rep_accept_t)
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6pm_node *node,
struct Ipmip6pm_pktbuf *pbuf,
struct Ipmip_timer *service
);
typedef void (*Ipmip6pm_extension_pkt_req_apply_t)
(
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6pm_node *node,
struct Ipmip6pm_pktbuf *pbuf
);
typedef struct Ipmip6pm_extension
{
const char *name;
const char *syntax;
Ip_u32 global_data_size;
Ip_u32 node_data_size;
Ip_u32 ifp_data_size;
/* Callbacks */
Ipmip6pm_extension_config_global_t config_global;
Ipmip6pm_extension_config_ifp_t config_ifp;
Ipmip6pm_extension_provide_t provide;
Ipmip6pm_extension_setup_t setup;
Ipmip6pm_extension_pkt_rep_validate_t pkt_rep_validate;
Ipmip6pm_extension_pkt_rep_accept_t pkt_rep_accept;
Ipmip6pm_extension_pkt_req_apply_t pkt_req_apply;
/* Set by PMIP */
Ip_u32 unique;
} Ipmip6pm_extension_t;
typedef struct Ipmip6pm_function_context
{
Ipmip6pm_extension_t *functions[32];
Ip_u32 num;
Ip_u32 node_data;
Ip_u32 mask;
Ip_u32 elem;
} Ipmip6pm_function_context_t;
typedef struct Ipmip6pm_context
{
Ipmip6_context_t ipmip6; /* Global context */
Ip_fd fd_ipd; /* ipd */
Ip_u32 iftable_pm_to;
Ip_u32 iftable_pm_from;
#ifdef IPMIP_USE_INET
Ip_u32 iftable_pm_inet;
#endif
/**/
Ipcom_list ifs;
Ipmip_timer_lock_t *ifs_lock;
Ipcom_atomic_t sequence;
struct Ipmip_context_id *idents;
struct Ipmip_context_id *bri;
Ipmip6pm_function_context_t extensions[IPMIP6PM_FUNCTION_MAX];
void *extdata[IPMIP6PM_FUNCTION_MAX][32];
}
Ipmip6pm_context_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL Ip_u32 ipmip6pm_context_register_extension(Ipmip6pm_context_t *ctx,
Ipmip6pm_extension_t *srv,
Ip_u32 type);
IP_GLOBAL void ipmip6pm_main(void);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,148 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_icmp.c,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_icmp.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6pm_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_syslog.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_icmp_pkt.h>
#include "ipmip6pm_h.h"
#include "ipmip6pm_icmp.h"
#include "ipmip6pm_if.h"
#include "ipmip6pm_pktbuf.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6mn_icmp_dispatch
*===========================================================================
* Description: Process an ICMP packet.
* Parameters: context - The context.
* icmp - The ICMP packet
* icmp_len - The length of the ICMP packet.
* pktinfo - Packet info.
* src - The sender
* salist - List of SA's processed
* rthdr2 - Did this ICMP frame contain a RTHDR2.
* Returns: IP_TRUE if successfully processed.
*
*/
IP_GLOBAL Ip_bool
ipmip6pm_icmp_dispatch(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6pm_pktbuf_t *pbuf)
{
Ipmip6_pkt_icmp6_t *icmp = IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
/* Determine what we've got */
switch (icmp->icmp6_type)
{
default:
break;
}
return IP_FALSE;
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,91 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_icmp.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_icmp.h,v $
* $Author: jhorteli $ $Date: 2009-02-09 15:46:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_ICMP_H
#define IPMIP6PM_ICMP_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6_address;
struct Ipmip6pm_context;
struct Ipmip_proc;
struct Ipmip6pm_pktbuf;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6pm_icmp_dispatch
*===========================================================================
* Description: Process an ICMP packet.
* Parameters: context - The context.
* icmp - The ICMP packet
* icmp_len - The length of the ICMP packet.
* pktinfo - Packet info.
* src - The sender
* salist - List of SA's processed
* rthdr2 - Did this ICMP frame contain a RTHDR2.
* Returns: IP_TRUE if successfully processed.
*
*/
IP_GLOBAL Ip_bool ipmip6pm_icmp_dispatch(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_pktbuf *pbuf);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,878 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_if.c,v $ $Revision: 1.19.10.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_if.c,v $
* $Author: svc-cmnet $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_if.c,v $ $Revision: 1.19.10.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_if.c,v $
* $Author: svc-cmnet $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6pm_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_err.h>
#include <ipcom_sysvar.h>
#include <ipcom_syslog.h>
#include <ipcom_shell.h>
#include <ipcom_route.h>
#include <ipnet.h>
#include <ipnet_policy_routing.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <private/ipmip_sysvar.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_util.h>
#include "ipmip6pm_h.h"
#include "ipmip6pm_route.h"
#include "ipmip6pm_attr_h.h"
#include "ipmip6pm_if.h"
#include "ipmip6pm_pktbuf.h"
#include "ipmip6pm_lma.h"
#include "ipmip6pm_node.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
#ifdef IPMIP_USE_INET
IP_STATIC void
ipmip6pm_if_tunnel_cleanup_inet(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6pm_if_t *ife)
{
/* Delete the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_DELRULE,
ctx->iftable_pm_inet,
IPMIP6PM_ROUTE_PRIORITY_BU,
0,
&ife->ifaddr.prefix,
128,
&ip_in6addr_any,
0,
0,
0);
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
}
#endif
IP_STATIC void
ipmip6pm_if_tunnel_cleanup(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6pm_if_t *ife)
{
/* Delete the policy rule */
#if 0
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_DELRULE,
ctx->iftable_pm_to,
IPMIP6PM_ROUTE_PRIORITY_BU,
ife->ipmip6.iff.ifindex,
&ip_in6addr_any,
0,
&ip_in6addr_any,
0);
#endif
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
}
IP_STATIC void
ipmip6pm_if_cleanup(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6pm_if_t *ife)
{
int i;
unsigned int si;
ipmip6pm_lma_unconfigure(ctx, proc, ife);
/* Do destroy any tunnels on this interface */
for (i = 0; i < IPMIP_TUNNELTYPE_MAX + 1; i++)
{
if (ife->iftunnels[i] != IP_NULL)
{
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ife->iftunnels[i]->ipmip6.iff);
ife->iftunnels[i] = IP_NULL;
}
}
/**/
for (i = IPMIP6PM_FUNCTION_MAX - 1; i >= 0; i--)
{
for (si = 0; si < ctx->extensions[i].num; si++)
{
if (ctx->extensions[i].functions[si]->config_ifp != IP_NULL)
{
if (ife->extdata[i][si])
{
(*ctx->extensions[i].functions[si]->config_ifp) (ctx, proc, IPMIP_CALLBACK_CONFIG_FREE, ife, ctx->extdata[i][si], ife->extdata[i][si], IP_NULL);
ipcom_free(ife->extdata[i][si]);
ife->extdata[i][si] = IP_NULL;
}
}
}
}
ipmip6pm_node_context_destroy(ctx, proc, ife);
}
#ifdef IPMIP_USE_INET
/*
*===========================================================================
* ipmip6pm_if_tunnel_create_inet
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC Ipmip6pm_if_t *
ipmip6pm_if_tunnel_create_inet(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
int type,
struct Ip_in6_addr *addr6,
Ip_u32 addr,
Ip_u32 ifindex)
{
Ipmip6pm_if_t *ifp = IP_NULL;
char gifname[IP_IFNAMSIZ];
struct Ip_ip_tunnel_param tun;
int ret;
ipcom_snprintf(gifname, sizeof(gifname), "%s%dpm%x", ipmip_util_tunnel_to_bsdname(type), type, ifindex);
if (ipcom_if_nametoindex(gifname) != 0)
return IP_NULL;
ifp = (Ipmip6pm_if_t *)ipmip6_if_alloc_tunnel(&ctx->ipmip6,
proc,
sizeof(*ifp),
gifname,
0,
type,
IP_FALSE,
(Ipmip_if_cleanup_t)ipmip6pm_if_tunnel_cleanup_inet);
if (ifp == IP_NULL)
return IP_NULL;
/**/
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s created", gifname));
/**/
ipcom_memcpy(&ifp->ifaddr.prefix, addr6, sizeof(struct Ip_in6_addr));
ifp->ifinet = addr;
/* Assign the CoA address */
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET, IP_RTM_NEWADDR, ifp->ipmip6.iff.ifindex, &addr, 32, 0, 0) < 0)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to assign address to tunnel interface %s",
ifp->ipmip6.iff.ifname));
goto fail;
}
/* Assign the CoA address */
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET6, IP_RTM_NEWADDR, ifp->ipmip6.iff.ifindex, addr6, 128, 0, 0) < 0)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to assign address to tunnel interface %s",
ifp->ipmip6.iff.ifname));
goto fail;
}
/* Add the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_NEWRULE,
ctx->iftable_pm_inet,
IPMIP6PM_ROUTE_PRIORITY_BU,
0,
&ifp->ifaddr.prefix,
128,
&ip_in6addr_any,
0,
0,
0);
/* Change tunnel */
ipcom_memset(&tun, 0, sizeof(tun));
ipcom_strncpy(tun.ifr_name, ifp->ipmip6.iff.ifname, sizeof(tun.ifr_name));
tun.local_addr.sin.sin_family = IP_AF_INET;
tun.local_addr.sin.sin_addr.s_addr = ifp->ifinet;
tun.local_addr.sin.sin_port = ctx->ipmip6.pkt->s_udp_nat.sin6_port;
IPCOM_SA_LEN_SET(&tun.local_addr.sin, sizeof(struct Ip_sockaddr_in));
tun.remote_addr.sin.sin_family = IP_AF_INET;
tun.remote_addr.sin.sin_addr.s_addr = 0;
IPCOM_SA_LEN_SET(&tun.remote_addr.sin, sizeof(struct Ip_sockaddr_in));
tun.ttl = 64;
/* Try set the tunnel values */
if (ipmip_util_ioctl(&ctx->ipmip6.ipmip, proc, IP_SIOCCHGTUNNEL, &tun) < 0)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to configure tunnel interface %s",
gifname));
goto fail;
}
/* GO HUGE on MTU */
if ((ret = ipmip_netlink_link(&ctx->ipmip6.ipmip,
proc,
IP_RTM_SETLINK,
ifp->ipmip6.iff.ifindex,
0,
0,
IP_NULL,
IP_NULL,
0xFFFF)) < 0)
{
IPCOM_LOG3(ERR,
"%s: Unable to set large MTU on %s, ret = %d",
ctx->ipmip6.ipmip.name,
gifname,
-ret);
}
/**/
return ifp;
fail:
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ifp->ipmip6.iff);
return IP_NULL;
}
#endif
/*
*===========================================================================
* ipmip6mn_route_tunnel_create
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC Ipmip6pm_if_t *
ipmip6pm_if_tunnel_create(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
int type,
struct Ip_in6_addr *addr,
Ip_u32 ifindex)
{
Ipmip6pm_if_t *ifp = IP_NULL;
char tname[IP_IFNAMSIZ];
struct Ip_ip_tunnel_param tun;
int ret;
ipcom_snprintf(tname, sizeof(tname), "%s%dpm%x", ipmip_util_tunnel_to_bsdname(type), type, ifindex);
if (ipcom_if_nametoindex(tname) != 0)
return IP_NULL;
ifp = (Ipmip6pm_if_t *)ipmip6_if_alloc_tunnel(&ctx->ipmip6,
proc,
sizeof(*ifp),
tname,
0,
type,
IP_FALSE,
(Ipmip_if_cleanup_t)ipmip6pm_if_tunnel_cleanup);
if (ifp == IP_NULL)
return IP_NULL;
/**/
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s created", tname));
/**/
ipcom_memcpy(&ifp->ifaddr.prefix, addr, sizeof(struct Ip_in6_addr));
/* Assign the CoA address */
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET6, IP_RTM_NEWADDR, ifp->ipmip6.iff.ifindex, addr, 128, 0, 0) < 0)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to assign address to tunnel interface %s",
ifp->ipmip6.iff.ifname));
goto fail;
}
#if 0
/* Add the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_NEWRULE,
ctx->iftable_pm_to,
IPMIP6PM_ROUTE_PRIORITY_BU,
ifp->ipmip6.iff.ifindex,
&ip_in6addr_any,
0,
&ip_in6addr_any,
0);
#endif
/* Change tunnel */
ipcom_memset(&tun, 0, sizeof(tun));
ipcom_strncpy(tun.ifr_name, ifp->ipmip6.iff.ifname, sizeof(tun.ifr_name));
tun.local_addr.sin6.sin6_family = IP_AF_INET6;
tun.local_addr.sin6.sin6_addr = ifp->ifaddr.prefix;
IPCOM_SA_LEN_SET(&tun.local_addr.sin6, sizeof(struct Ip_sockaddr_in6));
tun.local_addr.sin6.sin6_port = ctx->ipmip6.pkt->s_udp_nat.sin6_port;
tun.remote_addr.sin6.sin6_family = IP_AF_INET6;
tun.remote_addr.sin6.sin6_addr = ip_in6addr_any;
IPCOM_SA_LEN_SET(&tun.remote_addr.sin6, sizeof(struct Ip_sockaddr_in6));
tun.remote_addr.sin6.sin6_scope_id = 3;
tun.ttl = 64;
/* Try set the tunnel values */
if (ipmip_util_ioctl(&ctx->ipmip6.ipmip, proc, IP_SIOCCHGTUNNEL, &tun) < 0)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to configure tunnel interface %s",
tname));
goto fail;
}
/* GO HUGE on MTU */
if ((ret = ipmip_netlink_link(&ctx->ipmip6.ipmip,
proc,
IP_RTM_SETLINK,
ifp->ipmip6.iff.ifindex,
0,
0,
IP_NULL,
IP_NULL,
0xFFFF)) < 0)
{
IPCOM_LOG3(ERR,
"%s: Unable to set large MTU on %s, ret = %d",
ctx->ipmip6.ipmip.name,
tname,
-ret);
}
/**/
return ifp;
fail:
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ifp->ipmip6.iff);
return IP_NULL;
}
IP_STATIC Ip_bool
ipmip6pm_if_setup(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6pm_if_t *ife)
{
unsigned int si;
int i;
/**/
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s created", ife->ipmip6.iff.ifname));
/* Read some base values */
ife->lifetime = ipmip_sysvar_ushort(ipmip_sysvar_ushort(60, "ipmip6pm.lifetime"), "ipmip6pm.interface.%s.lifetime", ife->ipmip6.iff.ifname);
ife->InitialBindackTimeoutFirstReg = ipmip_sysvar_ulong(ipmip_sysvar_ushort(1500, "ipmip6pm.InitialBindackTimeoutFirstReg"), "ipmip6pm.%s.InitialBindackTimeoutFirstReg", ife->ipmip6.iff.ifname);
ife->TimestampBasedApproachInUse = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.TimestampBasedApproachInUse"), "ipmip6pm.%s.TimestampBasedApproachInUse", ife->ipmip6.iff.ifname);
ife->BRIMaxRetriesNumber = ipmip_sysvar_ulong(ipmip_sysvar_ulong(1, "ipmip6pm.BRIMaxRetriesNumber"), "ipmip6pm.interface.%s.BRIMaxRetriesNumber", ife->ipmip6.iff.ifname);
ife->MINDelayBRIs = ipmip_sysvar_ulong(ipmip_sysvar_ulong(1000, "ipmip6pm.MINDelayBRIs"), "ipmip6pm.interface.%s.MINDelayBRIs", ife->ipmip6.iff.ifname);
#ifdef IPMIP_USE_INET
/* Read the prefix list allowed for this interface */
if (!ipmip_sysvar_inet(0, &ife->ifinet, IP_NULL, "ipmip6pm.interface.%s.inet.care_of_address", ife->ipmip6.iff.ifname))
{
Ipmip6_if_inet_t *ifaddr;
/* No address found; resolve from interface */
ifaddr = IPCOM_LIST_FIRST(&ife->ipmip6.inet);
if (ifaddr)
ife->ifinet = ifaddr->ifa_address;
}
#endif
/* Read the prefix list allowed for this interface */
if (!ipmip_sysvar_inet6(&ip_in6addr_any, &ife->ifaddr.prefix, &ife->ifaddr.len, "ipmip6pm.interface.%s.care_of_address", ife->ipmip6.iff.ifname))
{
Ipmip6_if_inet6_t *ifaddr;
/* No address found; resolve from interface */
for (ifaddr = IPCOM_LIST_FIRST(&ife->ipmip6.inet6); ifaddr != IP_NULL; ifaddr = IPCOM_LIST_NEXT(&ifaddr->ifa_next))
{
/* Only check UNIVERSE scope addresses; and addresses covered by a broadcasted prefix */
if (ifaddr->ifa_scope == IP_RT_SCOPE_UNIVERSE)
break;
}
if (ifaddr)
{
ipcom_memcpy(&ife->ifaddr.prefix, &ifaddr->ifa_address.prefix, sizeof(ife->ifaddr.prefix));
ife->ifaddr.len = ifaddr->ifa_address.len;
}
#ifdef IPMIP_USE_INET
else if (ife->ifinet == 0)
#else
else
#endif
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to locate interface address for interface %s",
ife->ipmip6.iff.ifname));
return IP_FALSE;
}
}
/* Always Try GRE first; if enabled */
ife->GRE_Preferred = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.tunnel.gre.Preferred"), "ipmip6pm.interface.%s.tunnel.gre.Preferred", ife->ipmip6.iff.ifname);
ife->GRE_UseKeys = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.tunnel.gre.UseKeys"), "ipmip6pm.interface.%s.tunnel.gre.UseKeys", ife->ipmip6.iff.ifname);
#ifdef IPMIP_USE_INET
ife->UseIPv4UDPEncapForSignalingMessages = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.inet.UseIPv4UDPEncapForSignalingMessages"), "ipmip6pm.interface.%s.inet.UseIPv4UDPEncapForSignalingMessages", ife->ipmip6.iff.ifname);
ife->ForceIPv4UDPEncapsulationSupport = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.inet.ForceIPv4UDPEncapsulationSupport"), "ipmip6pm.interface.%s.inet.ForceIPv4UDPEncapsulationSupport", ife->ipmip6.iff.ifname);
ife->IPv4UDPEncapsulationNATTimeout = ipmip_sysvar_ulong(ipmip_sysvar_ulong(IPMIP6_NATKATIMEOUT, "ipmip6pm.inet.IPv4UDPEncapsulationNATTimeout"), "ipmip6pm.interface.%s.inet.IPv4UDPEncapsulationNATTimeout", ife->ipmip6.iff.ifname);
#endif
/* GRE allowed? */
if (!IP_IN6_IS_ADDR_UNSPECIFIED(&ife->ifaddr.prefix))
{
if ((ife->ifenabled[IPMIP_TUNNELTYPE_IP6IP6] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.tunnel.ip6ip6"), "ipmip6pm.interface.%s.tunnel.ip6ip6", ife->ipmip6.iff.ifname)))
{
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET6_IP6IP6;
ife->iftunnels[IPMIP_TUNNELTYPE_IP6IP6] = ipmip6pm_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_IP6IP6, &ife->ifaddr.prefix, ife->ipmip6.iff.ifindex);
}
if ((ife->ifenabled[IPMIP_TUNNELTYPE_GRE6] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.tunnel.gre"), "ipmip6pm.interface.%s.tunnel.gre", ife->ipmip6.iff.ifname)))
{
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET6_GRE6;
ife->iftunnels[IPMIP_TUNNELTYPE_GRE6] = ipmip6pm_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_GRE6, &ife->ifaddr.prefix, ife->ipmip6.iff.ifindex);
}
}
#ifdef IPMIP_USE_INET
if (ife->ifinet != 0)
{
ife->ifenabled[IPMIP_TUNNELTYPE_GRE] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.inet.tunnel.gre"), "ipmip6pm.interface.%s.inet.tunnel.gre", ife->ipmip6.iff.ifname);
if ((ife->ifenabled[IPMIP_TUNNELTYPE_IPIP] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.inet.tunnel.ipip"), "ipmip6pm.interface.%s.inet.tunnel.ipip", ife->ipmip6.iff.ifname)) || ife->ifenabled[IPMIP_TUNNELTYPE_GRE])
{
if (ife->ifenabled[IPMIP_TUNNELTYPE_IPIP])
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET_IPIP;
ife->iftunnels[IPMIP_TUNNELTYPE_IPIP] = ipmip6pm_if_tunnel_create_inet(ctx, proc, IPMIP_TUNNELTYPE_IPIP, &ife->ifaddr.prefix, ife->ifinet, ife->ipmip6.iff.ifindex);
}
if (ife->ifenabled[IPMIP_TUNNELTYPE_GRE])
{
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET_GRE;
ife->iftunnels[IPMIP_TUNNELTYPE_GRE] = ipmip6pm_if_tunnel_create_inet(ctx, proc, IPMIP_TUNNELTYPE_GRE, &ife->ifaddr.prefix, ife->ifinet, ife->ipmip6.iff.ifindex);
}
}
#endif
ipmip6pm_node_context_init(ctx, proc, ife);
for (i = 0; i < IPMIP6PM_FUNCTION_MAX; i++)
{
for (si = 0; si < ctx->extensions[i].num; si++)
{
if (ctx->extensions[i].functions[si]->config_ifp != IP_NULL)
{
if (ctx->extensions[i].functions[si]->ifp_data_size)
{
ife->extdata[i][si] = ipcom_calloc(1, ctx->extensions[i].functions[si]->ifp_data_size);
(*ctx->extensions[i].functions[si]->config_ifp) (ctx, proc, IPMIP_CALLBACK_CONFIG_READ, ife, ctx->extdata[i][si], ife->extdata[i][si], IP_NULL);
}
}
}
}
ipmip6pm_lma_configure(ctx, proc, ife);
return IP_TRUE;
}
/*
*===========================================================================
* ipmip6pm_if_create
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC Ip_bool
ipmip6pm_if_create(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_notify_t *notify)
{
Ipmip_timer_lock_t *lock;
/* Attach to the IFP */
ipmip6_if_attach(&ctx->ipmip6,
proc,
sizeof(struct Ipmip6pm_if),
notify,
(Ipmip_if_cleanup_t)ipmip6pm_if_cleanup);
lock = notify->ifp->iff_lock;
/**/
if (notify->ifp->iff_down == IP_TRUE ||
!ipmip6pm_if_setup(ctx, proc, (Ipmip6pm_if_t*)notify->ifp))
{
ipmip6_if_detach_iflocked(&ctx->ipmip6, proc, notify);
notify->ifp = IP_NULL;
}
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
return notify->ifp != IP_NULL;
}
/*
*===========================================================================
* ipmip6pm_if_event_handler
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC int
ipmip6pm_if_event_handler(int event,
Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc,
void *ifn,
void *unused)
{
IPMIP_UNUSED_PARAMETER(unused);
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ifn);
IPMIP_UNUSED_PARAMETER(unused);
/* Event on this particular interface */
if (event == IPMIP_TIMER_EVENT_RUN)
{
}
return IPMIP_TIMER_RET_DONE;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6pm_if_unconfigure
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_GLOBAL void
ipmip6pm_if_unconfigure(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc)
{
Ipmip6pm_if_notify_t *notify;
/* Clear any old interfaces */
while ((notify = IPCOM_LIST_FIRST(&ctx->ifs)) != IP_NULL)
{
Ipmip_timer_lock_t *lock;
lock = ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, notify->ipmip6.ifp->iff_lock);
ipmip6_if_detach_iflocked(&ctx->ipmip6, proc, &notify->ipmip6);
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
ipcom_list_remove(&notify->next);
ipcom_free(notify);
}
}
/*
*===========================================================================
* ipmip6mn_route_tunnel_create
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_GLOBAL void
ipmip6pm_if_configure(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc)
{
Ip_u8 *dptr, *ptr;
ipmip6pm_if_unconfigure(ctx, proc);
/* Find all interfaces */
dptr = ipmip_sysvar_strlist("ipmip6pm.interfaces");
if (dptr == IP_NULL || *dptr == '0')
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Invalid/missing \"ipmip6pm.interfaces\" in configuration"));
goto fail;
}
ptr = dptr + 1;
while (*ptr != 0)
{
Ipmip6pm_if_notify_t *notify = ipcom_calloc(1, sizeof(*notify));
ipcom_strcpy(notify->ipmip6.ifname, (char *)(ptr + 1));
notify->ipmip6.opaque = notify;
notify->ipmip6.func = (Ipmip_timer_func_t)ipmip6pm_if_event_handler;
notify->ipmip6.lock = ctx->ifs_lock;
if (!ipmip6pm_if_create(ctx, proc, &notify->ipmip6))
{
/* Just log for notifications sake */
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to create/configure interface %s - bad configuration or interface is down/does not exist", (char *)(ptr + 1)));
ipcom_free(notify);
}
else
{
/**/
ipcom_list_insert_last(&ctx->ifs, &notify->next);
}
/* Go to next item */
ptr += *ptr;
}
fail:
if (dptr)
ipcom_free(dptr);
}
IP_GLOBAL Ipmip6pm_if_t *
ipmip6pm_if_findbyifindex(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 ifindex)
{
Ipmip6pm_if_notify_t *notify;
IPMIP_UNUSED_PARAMETER(proc);
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6pm_if_t *ifp = (Ipmip6pm_if_t *)notify->ipmip6.ifp;
if (ifp->ipmip6.iff.ifindex == ifindex)
return ifp;
}
return IP_NULL;
}
IP_GLOBAL Ipmip6pm_if_t *
ipmip6pm_if_findbyifname(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
const char *ifname)
{
Ipmip6pm_if_notify_t *notify;
IPMIP_UNUSED_PARAMETER(proc);
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6pm_if_t *ifp = (Ipmip6pm_if_t *)notify->ipmip6.ifp;
if (ipcom_strcasecmp(ifp->ipmip6.iff.ifname, ifname) == 0)
return ifp;
}
return IP_NULL;
}
IP_GLOBAL Ipmip6pm_if_t *
ipmip6pm_if_findbyinet6(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ip_in6_addr *addr)
{
Ipmip6pm_if_notify_t *notify;
IPMIP_UNUSED_PARAMETER(proc);
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6pm_if_t *ifp = (Ipmip6pm_if_t *)notify->ipmip6.ifp;
if (IP_IN6_ARE_ADDR_EQUAL(&ifp->ifaddr.prefix, addr))
return ifp;
}
return IP_NULL;
}
IP_GLOBAL Ipmip6pm_if_t *
ipmip6pm_if_findbypktinfo(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_pktbuf_pktinfo *dst)
{
Ipmip6pm_if_t *ifp;
if ((ifp = ipmip6pm_if_findbyifindex(ctx, proc, dst->ifindex)) == IP_NULL)
ifp = ipmip6pm_if_findbyinet6(ctx, proc, &dst->dst.sin6.sin6_addr);
return ifp;
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,149 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_if.h,v $ $Revision: 1.12 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_if.h,v $
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_IF_H
#define IPMIP6PM_IF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6pm_context;
struct Ipmip_proc;
struct Ipmip6pm_node;
struct Ipmip_pktbuf_pktinfo;
struct Ipmip_cli_message;
struct Ipmip6pm_if;
typedef struct Ipmip6pm_if_notify
{
Ipcom_list next;
Ipmip6_if_notify_t ipmip6;
} Ipmip6pm_if_notify_t;
typedef struct Ipmip6pm_if_priv_notify
{
char handoff[IP_IFNAMSIZ+1];
Ipmip6_if_notify_t ipmip6;
} Ipmip6pm_if_priv_notify_t;
typedef struct Ipmip6pm_if
{
Ipmip6_if_t ipmip6;
/* Home agent specific configuration */
Ipmip6_address_t ifaddr;
#ifdef IPMIP_USE_INET
Ip_u32 ifinet;
#endif
/**/
Ip_bool ifenabled[IPMIP_TUNNELTYPE_MAX + 1];
struct Ipmip6pm_if *iftunnels[IPMIP_TUNNELTYPE_MAX + 1];
Ip_u16 lifetime;
Ip_u32 InitialBindackTimeoutFirstReg; /* Initial timeout */
Ip_bool TimestampBasedApproachInUse;
Ip_u32 BRIMaxRetriesNumber;
Ip_u32 MINDelayBRIs;
Ip_u32 HeartBeatInterval;
Ip_u32 HeartBeatMissAllowed;
Ip_bool HeartBeatEnabled;
Ip_bool GRE_Preferred;
Ip_bool GRE_UseKeys;
Ip_u8 supported_tunnel_types;
#ifdef IPMIP_USE_INET
Ip_bool UseIPv4UDPEncapForSignalingMessages;
Ip_bool ForceIPv4UDPEncapsulationSupport;
Ip_u32 IPv4UDPEncapsulationNATTimeout;
#endif
Ipcom_hash *lma_table;
Ipcom_hash *node_name;
/* Opaque service data */
void *extdata[IPMIP6PM_FUNCTION_MAX][32];
} Ipmip6pm_if_t;
typedef struct Ipmip6pm_if_priv
{
Ipmip6_if_t ipmip6;
} Ipmip6pm_if_priv_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6pm_if_configure(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6pm_if_unconfigure(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbypktinfo(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_pktbuf_pktinfo *dst);
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbyifindex(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 ifindex);
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbyinet6(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ip_in6_addr *addr);
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbyifname(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
const char *ifname);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,225 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_ifevent.c,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_ifevent.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6pm_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_err.h>
#include <ipcom_sysvar.h>
#include <ipcom_syslog.h>
#include <ipcom_shell.h>
#include <ipmip.h>
#include <private/ipmip_timer.h>
#include <ipmip6.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_icmp_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6pm_h.h"
#include "ipmip6pm_if.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
IP_STATIC void ipmip6pm_ifevent_router_new(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router);
IP_STATIC void ipmip6pm_ifevent_router_expire(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router);
IP_STATIC void ipmip6pm_ifevent_prefix_new(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix);
IP_STATIC void ipmip6pm_ifevent_prefix_expire(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix);
IP_STATIC void ipmip6pm_ifevent_prefix_advertise(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix);
IP_STATIC void ipmip6pm_ifevent_prefix_update(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix);
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
Ipmip6_if_event_table_t ipmip6pm_ifevent_table =
{
(Ipmip6_if_event_t)IP_NULL,
(Ipmip6_if_event_t)IP_NULL,
(Ipmip6_if_event_t)ipmip6pm_ifevent_router_new,
(Ipmip6_if_event_t)ipmip6pm_ifevent_router_expire,
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_new,
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_expire,
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_advertise,
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_update
};
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC void
ipmip6pm_ifevent_router_new(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(router);
}
IP_STATIC void
ipmip6pm_ifevent_router_expire(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(router);
}
IP_STATIC void
ipmip6pm_ifevent_prefix_new(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(prefix);
}
IP_STATIC void
ipmip6pm_ifevent_prefix_expire(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(prefix);
}
IP_STATIC void
ipmip6pm_ifevent_prefix_advertise(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(prefix);
/* ipmip6m_coa_advertise_prefix(prefix); */
}
IP_STATIC void
ipmip6pm_ifevent_prefix_update(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(prefix);
/* ipmip6pm_coa_update_validity(prefix); */
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,69 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_ifevent.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_ifevent.h,v $
* $Author: jhorteli $ $Date: 2008-09-16 08:19:45 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_IFEVENT_H
#define IPMIP6PM_IFEVENT_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
extern Ipmip6_if_event_table_t ipmip6pm_ifevent_table;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,159 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_lma.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_lma.h,v $
* $Author: jhorteli $ $Date: 2010-02-15 13:26:01 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_LMA_H
#define IPMIP6PM_LMA_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6PM_LMA_CREATE (1 << 0)
#define IPMIP6PM_LMA_PERMANENT (1 << 1)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6pm_context;
struct Ipmip_proc;
struct Ipmip6pm_if;
struct Ipmip6pm_pktbuf;
struct Ipmip_buffer;
typedef struct Ipmip6pm_lma
{
struct Ip_in6_addr endpoint;
/**/
Ip_u32 references;
Ip_u32 sequence;
Ip_u32 unacked;
Ip_u32 restart_counter;
Ip_bool have_restart_counter;
Ip_bool permanent;
Ip_bool disabled;
struct Ipmip6pm_if *ifp;
Ipmip_timer_t timer;
Ipcom_list bri;
/* If we've got a NAT */
Ip_u32 inet_endpoint;
} Ipmip6pm_lma_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL Ipmip6pm_lma_t *ipmip6pm_lma_get(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp,
struct Ip_in6_addr *endpoint,
Ip_u32 inet_endpoint,
unsigned flags);
IP_GLOBAL void ipmip6pm_lma_release(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_lma_t *mag);
IP_GLOBAL void ipmip6pm_lma_reference(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_lma_t *lma);
IP_GLOBAL void ipmip6pm_lma_configure(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp);
IP_GLOBAL void ipmip6pm_lma_unconfigure(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp);
IP_GLOBAL void ipmip6pm_lma_configure_dump(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ife,
struct Ipmip_buffer *buffer);
IP_GLOBAL Ip_bool ipmip6pm_lma_heartbeat_input(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_pktbuf *pbuf);
IP_GLOBAL Ip_bool ipmip6pm_lma_heartbeat_binding_error_input(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_pktbuf *pbuf);
IP_GLOBAL void ipmip6pm_lma_route_mh(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp,
struct Ip_in6_addr *endpoint,
Ip_u32 inet_address);
IP_GLOBAL void ipmip6pm_lma_route(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_lma *lma);
IP_GLOBAL void ipmip6pm_lma_route_pbuf(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_pktbuf *pbuf);
IP_GLOBAL void ipmip6pm_lma_attr_get(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ife,
struct Ipmip_buffer *buffer);
IP_GLOBAL void ipmip6pm_lma_revoke(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_lma_t *lma,
Ip_u8 reason);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,524 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_main.c,v $ $Revision: 1.7.16.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_main.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6pm_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_ipd.h>
#include <ipcom_syslog.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <private/ipmip_dhcp.h>
#include <private/ipmip_dhcp6.h>
#include <private/ipmip_inet.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_pkt.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6pm.h"
#include "ipmip6pm_h.h"
#include "ipmip6pm_node.h"
#include "ipmip6pm_attr_h.h"
#include "ipmip6pm_ifevent.h"
#include "ipmip6pm_mh.h"
#include "ipmip6pm_icmp.h"
#include "ipmip6pm_if.h"
#include "ipmip6pm_route.h"
#include "ipmip6pm_pktbuf.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
IP_PUBLIC Ip_err ipmip6pm_exit(void);
IP_PUBLIC Ip_err ipmip6pm_init(void);
IP_PUBLIC Ip_err ipmip6pm_start(void);
IP_PUBLIC const char *ipmip6pm_version(void);
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
static int ipmip6pm_instances = 0;
/* Dispatch function callbacks */
static Ipmip6_pkt_context_dispatch_t ipmip6pm_dispatch_table =
{
(Ipmip6_pkt_dispatch_t)ipmip6pm_mh_dispatch,
(Ipmip6_pkt_dispatch_t)IP_NULL
};
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC void
ipmip6pm_services_clear(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc)
{
unsigned si, f;
for (f = 0; f < IPMIP6PM_FUNCTION_MAX; f++)
{
for (si = 0; si < ctx->extensions[f].num; si++)
{
if (ctx->extensions[f].functions[si]->config_global != IP_NULL && ctx->extdata[f][si])
{
(*ctx->extensions[f].functions[si]->config_global) (ctx, proc, IPMIP_CALLBACK_CONFIG_FREE, ctx->extdata[f][si], IP_NULL);
ipcom_free(ctx->extdata[f][si]);
ctx->extdata[f][si] = IP_NULL;
}
}
}
}
IP_STATIC void
ipmip6pm_services_read(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc)
{
unsigned si, f;
for (f = 0; f < IPMIP6PM_FUNCTION_MAX; f++)
{
for (si = 0; si < ctx->extensions[f].num; si++)
{
if (ctx->extensions[f].functions[si]->config_global != IP_NULL && ctx->extensions[f].functions[si]->global_data_size)
{
ctx->extdata[f][si] = ipcom_calloc(1, ctx->extensions[f].functions[si]->global_data_size);;
(*ctx->extensions[f].functions[si]->config_global) (ctx, proc, IPMIP_CALLBACK_CONFIG_READ, ctx->extdata[f][si], IP_NULL);
}
}
}
}
/*
*===========================================================================
* ipmippm_config_init
*===========================================================================
* Description: Initialize the configuration for the specified instance
* Parameters: instance - The PM instance
* Returns: 0 on success
*
*/
IP_STATIC int
ipmip6pm_update_config(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc)
{
/* Stop the CLI context */
ipmip_cli_context_stop(&ctx->ipmip6.ipmip, proc);
/* Stop the packet context */
ipmip6_pkt_context_stop(&ctx->ipmip6, proc);
/* Free all mobile nodes */
ipmip6pm_node_clear(ctx, proc);
/* Stop the current context */
ipmip6_context_stop(&ctx->ipmip6, proc);
ipmip6pm_services_clear(ctx, proc);
#ifdef IPMIP_USE_INET
ipmip_dhcp_context_destroy(&ctx->ipmip6.ipmip, proc);
ipmip_inet_arp_context_destroy(&ctx->ipmip6.ipmip, proc);
#endif
ipmip_dhcp6_context_destroy(&ctx->ipmip6.ipmip, proc);
ipmip6_context_restart_counter_update(&ctx->ipmip6, proc);
ipmip6pm_services_read(ctx, proc);
/* Read configuration */
ipmip6pm_if_configure(ctx, proc);
/**/
ipmip6_context_start(&ctx->ipmip6, proc);
return 0;
}
/*
*===========================================================================
* ipmip6pm_destroy
*===========================================================================
* Description: Shutdown the mobile node portion of the context.
* Parameters: ctx - The MIP6 context.
* Returns:
*
*/
IP_STATIC void
ipmip6pm_context_destroy(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc)
{
/* Only if we actually got a context. */
if (ctx != IP_NULL)
{
/* Stop the packet context; for starters */
ipmip6_pkt_context_stop(&ctx->ipmip6, proc);
/* Destroy the entries that has been removed */
ipmip6pm_node_clear(ctx, proc);
/* Stop the rest */
ipmip6_context_stop(&ctx->ipmip6, proc);
/* Remove configuration */
ipmip6pm_if_unconfigure(ctx, proc);
ipmip6pm_services_clear(ctx, proc);
/* Close the IPD */
if (ctx->fd_ipd == IP_INVALID_SOCKET)
(void)ipcom_ipd_init("ipmip6pm", IPCOM_ERR_FAILED, &ctx->fd_ipd);
/**/
ipcom_ipd_exit("ipmip6pm", ctx->fd_ipd);
/**/
ipmip_timer_lock_destroy(&ctx->ipmip6.ipmip, proc, ctx->ifs_lock);
/* Free the lock */
ipmip6pm_route_context_destroy(ctx, proc);
ipmip_context_id_destroy(ctx->idents);
ipmip_context_id_destroy(ctx->bri);
/* Shutdown the 'mip6' context */
ipmip6_context_destroy(&ctx->ipmip6, proc);
}
}
/*
*===========================================================================
* ipmip6pm_context_allocate
*===========================================================================
* Description: Initialize the proxy mobile node portion of the context.
* Parameters: ctx - The MIP6 context.
* Returns:
*
*/
IP_STATIC Ipmip6pm_context_t *
ipmip6pm_context_allocate(Ipmip_proc_t *proc)
{
Ipmip6pm_context_t *ctx = (Ipmip6pm_context_t *)ipmip_context_alloc(proc, sizeof(*ctx), "ipmip6pm", IPMIP6_SYSTEM_PRIORITY, IPMIP6PM_EVENT_BACKLOG);
int f;
/* */
if (ctx == IP_NULL)
return IP_NULL;
/* Initialize */
ipmip6pm_route_context_init(ctx, proc);
/**/
ipcom_atomic_set(&ctx->sequence, ipcom_random());
ipcom_list_init(&ctx->ifs);
ctx->ifs_lock = ipmip_timer_lock_alloc(&ctx->ipmip6.ipmip, proc, IP_NULL, IP_NULL);
ctx->idents = ipmip_context_id_create(ip_offsetof(Ipmip6pm_node_t, identity), 0xFFFFFFFF);
ctx->bri = ipmip_context_id_create(ip_offsetof(Ipmip6pm_br_t, sequence), 0x0000FFFF);
/* Initialize the global information */
if (ipmip6_context_initialize(&ctx->ipmip6,
proc,
&ipmip6pm_ifevent_table) == IP_FALSE)
goto failure;
/* Server side; don't do solicitations */
ctx->ipmip6.iff.no_solicitation = IP_TRUE;
if (ipmip6_pkt_context_create(&ctx->ipmip6,
proc,
&ipmip6pm_dispatch_table,
IPMIP6_DSMIP_UDP_PORT,
(Ipmip_pkt_buf_alloc_t)ipmip6pm_pktbuf_alloc,
(Ipmip_pkt_buf_free_t)ipmip6pm_pktbuf_free) == IP_FALSE)
{
IPCOM_LOG0(ERR, "Unable to create IPMIP6PM Packet Context");
goto failure;
}
ipmip_cli_context_create(&ctx->ipmip6.ipmip,
proc,
"ipmip6pm",
IPCOM_IPD_ID_IPMIP6PM,
(Ipmip_cli_callback_t)ipmip6pm_attr_command);
/* IPD init */
if (ipcom_ipd_init("ipmip6pm", IPCOM_SUCCESS, &ctx->fd_ipd) != IPCOM_SUCCESS)
{
IPCOM_LOG1(ERR, "Unable to create IPMIP6PM IPD pipe = %d", ipcom_errno);
goto failure;
}
/* Indicate the elements */
for (f = 0; f < IPMIP6PM_FUNCTION_MAX; f++)
ctx->extensions[f].elem = f;
/* Do service init */
for (f = 0; ipmip6pm_service_registrations[f] != IP_NULL; f++)
(*ipmip6pm_service_registrations[f]) (ctx);
for (f = 0; ipmip6pm_link_registrations[f] != IP_NULL; f++)
(*ipmip6pm_link_registrations[f]) (ctx);
/* Install transport */
ipmip6pm_node_service_install(ctx);
/* Update configuration */
ipmip6pm_update_config(ctx, proc);
/* Return the mobile node instance */
return ctx;
failure:
ipmip6pm_context_destroy(ctx, proc);
return IP_NULL;
}
/*
*===========================================================================
* ipmip6pm_ipd_process
*===========================================================================
* Description: Process any file descriptors set by the platform.
* Parameters: data - The data structure
* rset - The read set.
* Returns: IP_FALSE if we should exit the process.
*
*/
IP_STATIC Ip_bool
ipmip6pm_ipd_process(Ipmip6pm_context_t *ctx,
Ipmip_proc_t *proc)
{
/* IPD input. */
int event;
Ip_ssize_t len;
Ipmip6pm_pktbuf_t *pbuf = (Ipmip6pm_pktbuf_t *)ipmip_pktbuf_alloc(&ctx->ipmip6.ipmip, proc, 512);
if (pbuf == IP_NULL)
return IP_TRUE;
len = ipcom_ipd_read(ctx->fd_ipd, IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet), 512, &event);
if (len < 0)
{
IPCOM_LOG2(ERR, "ipcom_socketread(IPD) failed : %s [%d]",
ipcom_strerror(ipcom_errno), ipcom_errno);
ipmip_util_sock_clear(ctx->fd_ipd);
}
else
{
/* Advance past */
ipmip_buffer_append(&pbuf->ipmip6.ipmip.packet, IP_NULL, len);
switch (event)
{
case IPCOM_IPD_EVENT_RECONFIGURE:
IPCOM_LOG0(INFO, "Received IPD reconfigure message");
ipmip6pm_update_config(ctx, proc);
break;
case IPCOM_IPD_EVENT_KILL:
IPCOM_LOG0(INFO, "Received IPD kill message");
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
return IP_FALSE;
default:
/* Ignore all other IPD messages */
break;
}
}
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
return IP_TRUE;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void
ipmip6pm_main(void)
{
int num;
int max_fd;
Ipmip6pm_context_t *ctx = IP_NULL;
Ipmip_proc_t *proc;
ipcom_proc_init();
proc = ipmip_proc_alloc();
IPCOM_LOG0(INFO,
"ipmip6pm: starting");
/* Init the configuration */
if (ipmip6pm_configure() != IPCOM_SUCCESS)
goto done;
/* Init IPMIP6MN */
if ((ctx = ipmip6pm_context_allocate(proc)) == IP_NULL)
goto done;
if (ipmip6pm_instances++ == 0)
if (ipmip6pm_init() != IPCOM_SUCCESS)
goto end;
for (;;)
{
Ip_fd_set read_set;
IP_FD_ZERO(&read_set);
/* Set the IPD */
max_fd = ctx->fd_ipd;
IP_FD_SET(ctx->fd_ipd, &read_set);
/* Select */
num = ipcom_socketselect(max_fd + 1, &read_set, IP_NULL, IP_NULL, IP_NULL);
switch(num)
{
case -1: /* socket error. */
IPCOM_LOG2(WARNING, "ipcom_socketselect() failed : %s [%d]", ipcom_strerror(ipcom_errno), ipcom_errno);
(void)ipcom_sleep(1);
break;
case 0: /* timeout, not used. triggered by bug in linux glibc if compiled with nptl */
(void)ipcom_millisleep(1);
break;
default:
/* Process IPD */
if (IP_FD_ISSET(ctx->fd_ipd, &read_set))
{
if (ipmip6pm_ipd_process(ctx, proc) == IP_FALSE)
goto end;
}
}
}
end:
ipmip6pm_context_destroy(ctx, proc);
/**/
if (--ipmip6pm_instances == 0)
ipmip6pm_exit();
done:
/* Free the context process */
ipmip_proc_destroy(proc);
IPCOM_LOG0(NOTICE,
"ipmip6pm: ending");
ipcom_proc_exit();
}
IP_STATIC Ip_u32
ipmip6pm_context_register_function(Ipmip6pm_context_t *ctx,
Ipmip6pm_extension_t *srv,
Ipmip6pm_function_context_t *func)
{
Ip_u32 type = func->num++;
IPMIP_UNUSED_PARAMETER(ctx);
srv->unique = type;
srv->unique |= func->elem << 16;
func->mask |= (1 << type);
func->functions[type] = srv;
func->node_data += srv->node_data_size;
return srv->unique;
}
IP_GLOBAL Ip_u32
ipmip6pm_context_register_extension(Ipmip6pm_context_t *ctx,
Ipmip6pm_extension_t *srv,
Ip_u32 type)
{
return ipmip6pm_context_register_function(ctx, srv, &ctx->extensions[type]);
}
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,94 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_mh.h,v $ $Revision: 1.7 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_mh.h,v $
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_MH_H
#define IPMIP6PM_MH_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6pm_context;
struct Ipmip_proc;
struct Ipmip6pm_pktbuf;
struct Ipmip6pm_node;
struct Ipmip6pm_br;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL Ip_bool ipmip6pm_mh_ha_send_binding_update(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node,
Ip_bool retransmit,
Ip_bool request_ack);
IP_GLOBAL Ip_bool ipmip6pm_mh_ha_bra_send(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_pktbuf *pbuf,
Ip_u8 status);
IP_GLOBAL Ip_bool ipmip6pm_mh_dispatch(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_pktbuf *pbuf);
IP_GLOBAL Ip_bool ipmip6pm_mh_bri_send(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node,
struct Ipmip6pm_br *br);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,412 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_node.h,v $ $Revision: 1.21 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_node.h,v $
* $Author: jhorteli $ $Date: 2010-10-15 11:30:08 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6PM_NODE_H
#define IPMIP6PM_NODE_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip6_nd_proxy.h>
#include <private/ipmip6_nd_nud.h>
#include <private/ipmip6_util.h>
#include <ipmip6pm_if.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6PM_NODE_FLAG_NAI (1 << 0)
#define IPMIP6PM_NODE_FLAG_TERMINATE (1 << 1)
#define IPMIP6PM_NODE_FLAG_BU (1 << 2)
#define IPMIP6PM_NODE_FLAG_DEREGISTER (1 << 3)
#define IPMIP6PM_NODE_FLAG_UDP_DISABLED (1 << 4)
#define IPMIP6PM_NODE_FLAG_INET6_PREFIX_0 (1 << 5)
#define IPMIP6PM_NODE_FLAG_INET_PREFIX_0 (1 << 6)
#define IPMIP6PM_NODE_FLAG_GRE_DOWNLINK (1 << 7)
#define IPMIP6PM_NODE_FLAG_GRE_UPLINK (1 << 8)
#define IPMIP6PM_NODE_FLAG_GRE_LINK (IPMIP6PM_NODE_FLAG_GRE_DOWNLINK|IPMIP6PM_NODE_FLAG_GRE_UPLINK)
#ifdef IPMIP_USE_INET
#define IPMIP6PM_NODE_HOMEAGENT_INET(n) ((n)->homeagent_inet)
#else
#define IPMIP6PM_NODE_HOMEAGENT_INET(n) 0
#endif
#define IPMIP6PM_NODE_USE_GRE_KEYS(n) (IPMIP_TUNNELTYPE_IS_GRE((n)->transport_tunnel_type) && (((n)->flags & (IPMIP6PM_NODE_FLAG_GRE_LINK)) == IPMIP6PM_NODE_FLAG_GRE_LINK))
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6pm_context;
struct Ipmip_proc;
struct Ipmip6pm_if;
struct Ipmip6pm_pktbuf;
struct Ipmip6pm_lma;
struct Ipmip_attr_header;
struct Ipmip_attr;
struct Ipmip6pm_br;
typedef int (*Ipmip6pm_bri_done_t) (struct Ipmip6pm_context *ctx, struct Ipmip_proc *proc, struct Ipmip6pm_node *node, struct Ipmip6pm_br *bri, Ip_bool timeout, Ip_u8 status);
typedef struct Ipmip6pm_br
{
Ipcom_list next;
Ip_u32 sequence;
Ip_u8 xmits;
Ip_u8 reason;
Ip_u8 state;
Ip_u16 flags;
Ip_bool inet;
Ip_bool add_coa;
Ip_size_t match_len;
Ipmip_timer_t retransmit;
Ipmip_timer_func_t reply;
void *opaque;
Ipmip_timer_lock_t *lock;
struct Ipmip6pm_lma *lma;
Ipmip6pm_bri_done_t completion;
/**/
} Ipmip6pm_br_t;
typedef struct Ipmip6pm_node_service
{
struct Ipmip6pm_node_service *next;
char *value;
char *module;
} Ipmip6pm_node_service_t;
typedef struct Ipmip6pm_node
{
struct Ipmip6pm_node *prev;
struct Ipmip6pm_node *next;
/**/
Ipmip_timer_lock_t *lock;
Ipmip6_mh_mo_nai_t *mo_nai_mn;
Ipmip6_mh_mo_pmipv6_access_technology_type_t *mo_access_type;
Ipmip6_mh_mo_pmipv6_mn_link_layer_id_t *mo_link_layer_id;
Ipmip6_mh_mo_pmipv6_handoff_indicator_t *mo_handoff_indicator;
Ipmip6_mh_mo_pmipv6_home_prefix_t *mo_home_prefix;
Ip_u8 mo_home_prefix_size;
Ipmip6_mh_mo_pmipv6_timstamp_t mo_timestamp;
Ipmip_lladdr_t *lla;
struct Ipmip6pm_lma *lma;
Ipcom_list bri_list;
Ipmip6pm_if_priv_notify_t ifp_private;
struct Ipmip6pm_if *ifp_public;
Ipmip6_util_timediff_t time_diff;
struct Ip_in6_addr homeagent;
#ifdef IPMIP_USE_INET
Ip_u32 homeagent_inet;
Ip_u32 homeagent_nat;
Ipmip6_inet_t mo_dsmipv6_home_prefix;
#endif
/**/
Ipmip_timer_t expire;
Ipmip_timer_t revoke;
Ipmip_timer_t service;
Ipmip_timer_retransmit_t binding_update;
Ip_u32 remaining;
Ip_u8 termstate;
Ip_u8 revokestate;
Ip_u8 handoffstate;
Ip_u8 servicestate;
Ip_u32 enabled[IPMIP6PM_FUNCTION_MAX];
Ip_u32 supported[IPMIP6PM_FUNCTION_MAX];
Ip_time_t created;
Ip_u32 status;
Ip_u32 route_state;
Ip_u32 gre_key[2];
Ip_u32 identity;
Ip_u32 flags;
Ip_u16 sequence;
Ip_u8 bristate;
Ip_u8 transport_tunnel_type;
Ip_u8 supported_tunnel_types;
/* Statistics */
struct Ipmip6_mib_mip6MnBLTable mip6MnBLTable;
struct Ipmip6_mib_mip6MnRegnCounters mip6MnRegnCounters;
struct Ipmip6_mib_mip6NodeTrafficEntry mip6NodeTrafficEntry;
void **extdata[IPMIP6PM_FUNCTION_MAX];
} Ipmip6pm_node_t;
#define IPMIP6PM_NODE_LOOKUP_LLADDR (1 << 0)
#define IPMIP6PM_NODE_LOOKUP_ACCESS_TYPE (1 << 1)
#define IPMIP6PM_NODE_LOOKUP_SEQUENCE (1 << 2)
#define IPMIP6PM_NODE_LOOKUP_IFNAME (1 << 3)
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX (1 << 4)
#define IPMIP6PM_NODE_LOOKUP_TIMESTAMP (1 << 5)
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX_MO (1 << 6)
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX_INET_MO (1 << 7)
typedef struct Ipmip6pm_node_lookup
{
void *nai_mn;
Ip_size_t nai_mn_len;
/* Optional */
Ip_u32 search_params;
struct
{
/* Link Layer */
void *lladdr;
Ip_size_t lladdr_len;
/* Access Type */
Ip_u8 access_type;
/* Sequence Number */
Ip_u16 sequence;
/* Ifindex */
const char *ifname;
/**/
Ipmip6_address_t *home_prefix;
Ip_u8 home_prefix_size;
/**/
Ip_u64 *tstamp;
Ipmip6_mh_option_array_t *home_prefix_mo;
#ifdef IPMIP_USE_INET
Ipmip6_mh_option_array_t *home_prefix_inet_req_mo;
#endif
} args;
} Ipmip6pm_node_lookup_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
extern Ip_u32 ipmip6pm_node_transport_identity;
IP_GLOBAL void ipmip6pm_node_clear(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6pm_node_context_init(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp);
IP_GLOBAL void ipmip6pm_node_context_destroy(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp);
IP_GLOBAL int ipmip6pm_node_terminate(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
const char *reason);
IP_GLOBAL void ipmip6pm_node_silence(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node);
IP_GLOBAL int ipmip6pm_node_handoff(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *head,
Ip_u8 hi,
struct Ipmip_attr **idattr);
IP_GLOBAL int ipmip6pm_node_create(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *head,
Ip_u8 hi,
struct Ipmip_attr_header *hdr,
struct Ipmip_attr **idattr,
Ip_u32 *identity);
IP_GLOBAL void ipmip6pm_node_lookup(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp,
Ipmip6_mh_mo_nai_t *nai,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg);
IP_GLOBAL void ipmip6pm_node_lookup_handle(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 handle,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg);
IP_GLOBAL void ipmip6pm_node_search(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_if *ifp,
Ipmip6pm_node_lookup_t *nargs,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg);
IP_GLOBAL Ip_bool ipmip6pm_node_compare(Ipmip6pm_node_t *node,
Ipmip6pm_node_lookup_t *nargs);
IP_GLOBAL const char *ipmip6pm_node_describe(struct Ipmip_proc *proc,
Ipmip6pm_node_t *node);
IP_GLOBAL int ipmip6pm_node_timeout(int event,
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
const char *reason);
IP_GLOBAL int ipmip6pm_node_registration_timeout(int event,
struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
const char *reason);
IP_GLOBAL Ip_bool ipmip6pm_node_disable(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node);
IP_GLOBAL Ip_bool ipmip6pm_node_enable(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node);
IP_GLOBAL Ip_bool ipmip6pm_node_enable_function(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
int func,
Ip_u32 mask);
IP_GLOBAL Ip_bool ipmip6pm_node_disable_function(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
int func,
Ip_u32 mask);
IP_GLOBAL void ipmip6pm_node_disable_transport(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node);
IP_GLOBAL Ip_bool ipmip6pm_node_service_reply_validate(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
struct Ipmip6pm_pktbuf *pbuf);
IP_GLOBAL Ip_bool ipmip6pm_node_service_reply_accept(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
struct Ipmip6pm_pktbuf *pbuf);
IP_GLOBAL void ipmip6pm_node_update_link(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node);
IP_GLOBAL void ipmip6pm_node_service_install(struct Ipmip6pm_context *ctx);
/**/
IP_GLOBAL int ipmip6pm_node_process_revoke(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node,
struct Ipmip6pm_pktbuf *pbuf);
IP_GLOBAL void ipmip6pm_node_bri_free(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
Ipmip6pm_br_t *bri);
IP_GLOBAL void ipmip6pm_node_bri_cancel(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
Ipmip6pm_bri_done_t completion);
IP_GLOBAL void ipmip6pm_node_bri_cancel_lma(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
Ipmip6pm_bri_done_t completion,
struct Ipmip6pm_lma *lma);
IP_GLOBAL int ipmip6pm_node_bri_accept(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
Ipmip6pm_br_t *bri,
Ip_bool timeout,
Ip_u8 status);
IP_GLOBAL int ipmip6pm_node_revoke(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node,
Ip_bool inet,
Ip_u8 reason,
Ipmip6pm_bri_done_t completion);
IP_GLOBAL Ip_bool ipmip6pm_node_if_link_ready(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
Ipmip6pm_node_t *node);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,139 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_route.h,v $ $Revision: 1.11 $
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_route.h,v $
* $Author: jhorteli $ $Date: 2010-10-15 11:30:08 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_ROUTE_H
#define IPMIP6HA_ROUTE_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV6 = 0,
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV4,
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV6,
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV4,
IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV6,
IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV4,
IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV6,
IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV4,
IPMIP6PM_ROUTE_BIT_MAX
};
#define IPMIP6PM_ROUTE_STATE_BIT(x) (1 << (x))
#define IPMIP6PM_ROUTE_STATE_CHECK(s,i) ((s) & IPMIP6PM_ROUTE_STATE_BIT(i))
#define IPMIP6PM_ROUTE_STATE_ALL 0xFFFFFFFF
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV6_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV6)
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV6_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV6)
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV6_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV4)
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV6_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV4)
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV4_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV6)
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV4_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV4)
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV4_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV6)
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV4_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV4)
#define IPMIP6PM_ROUTE_STATE_TRANSPORT IPMIP6PM_ROUTE_STATE_ALL
#define IPMIP6PM_ROUTE_PRIORITY_BU 97
#define IPMIP6PM_ROUTE_PRIORITY_FORWARD 98
#define IPMIP6PM_ROUTE_PRIORITY_TUNNEL 99
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6pm_context;
struct Ipmip_proc;
struct Ipmip6pm_node;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6pm_route_state_del(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node,
Ip_u32 states);
IP_GLOBAL void ipmip6pm_route_state_add(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node,
Ip_u32 states);
IP_GLOBAL void ipmip6pm_route_add_outbound(struct Ipmip6pm_context *ctx,
struct Ipmip6pm_node *node,
Ip_u64 octets,
Ip_u64 pkts);
IP_GLOBAL void ipmip6pm_route_add_inbound(struct Ipmip6pm_context *ctx,
struct Ipmip6pm_node *node,
Ip_u64 octets,
Ip_u64 pkts);
IP_GLOBAL int ipmip6pm_netlink_new_handle(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node);
IP_GLOBAL int ipmip6pm_netlink_del_handle(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node);
IP_GLOBAL Ip_bool ipmip6pm_netlink_get_handle_stat(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6pm_node *node);
IP_GLOBAL void ipmip6pm_route_context_init(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6pm_route_context_destroy(struct Ipmip6pm_context *ctx,
struct Ipmip_proc *proc);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/