original files of m241
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn.c,v $ $Revision: 1.123 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Lennart Bang <lob@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
* Implementation of Mobile Node for IPNET.
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmipmn_config.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_shell.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_cli.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include "ipmipmn_h.h"
|
||||
#include "ipmipmn_icmp.h"
|
||||
#include "ipmipmn_node.h"
|
||||
#include "ipmipmn_route.h"
|
||||
#include "ipmipmn_pkt.h"
|
||||
#include "ipmipmn_reg.h"
|
||||
#include "ipmipmn_attr_h.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
#ifdef IPSNMP
|
||||
IP_EXTERN Ip_err ipmipmn_mip_mib_init(void);
|
||||
IP_EXTERN Ip_err ipmip4_mip_mib_init(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_err ipmipmn_create(void);
|
||||
IP_PUBLIC Ip_err ipmipmn_start(void);
|
||||
IP_PUBLIC const char *ipmipmn_version(void);
|
||||
|
||||
IP_PUBLIC IPCOM_PROCESS(ipmipmn_proc);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC IPCOM_PROCESS(ipmipmn_proc);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmnd
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC
|
||||
IPCOM_PROCESS(ipmipmn_proc)
|
||||
{
|
||||
ipmipmn_main();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_create
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err
|
||||
ipmipmn_create(void)
|
||||
{
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_start
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err
|
||||
ipmipmn_start(void)
|
||||
{
|
||||
Ip_err ret;
|
||||
Ipcom_proc_attr attr;
|
||||
#ifdef IPSNMP
|
||||
static int mib_once = 0;
|
||||
#endif
|
||||
|
||||
|
||||
ipcom_proc_attr_init(&attr);
|
||||
attr.stacksize = IPCOM_PROC_STACK_LARGE;
|
||||
|
||||
ret = ipcom_proc_acreate("ipmipmnd", ipmipmn_proc, &attr, IP_NULL);
|
||||
ip_assert(ret == IPCOM_SUCCESS);
|
||||
#ifdef IPSNMP
|
||||
if (mib_once == 0)
|
||||
{
|
||||
mib_once = 1;
|
||||
#if 0
|
||||
if (ipmipmn_mip_mib_init() != IPCOM_SUCCESS)
|
||||
ret = IPCOM_ERR_FAILED;
|
||||
if (ipmip4_mip_mib_init() != IPCOM_SUCCESS)
|
||||
ret = IPCOM_ERR_FAILED;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_version
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC const char *
|
||||
ipmipmn_version(void)
|
||||
{
|
||||
return "@(#) IPMIPMN $Name: VXWORKS_ITER40_2019102207 $ - INTERPEAK_COPYRIGHT_STRING";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api.c,v $ $Revision: 1.6 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_api.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 "ipmipmn_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_syslog.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_buffer.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_msgext.h>
|
||||
#include <private/ipmip4_auth.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmipmn_api_init(struct Ipmipmn_api_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_api_node_functable_t *func,
|
||||
Ipmipmn_api_node_state_functable_t *state_func)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
/**/
|
||||
data->node_func = func;
|
||||
data->node_state_func = state_func;
|
||||
}
|
||||
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmipmn_api_done(struct Ipmipmn_api_context *data,
|
||||
struct Ipmip_proc *proc)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_attr.c,v $ $Revision: 1.12 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_api_attr.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 "ipmipmn_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_syslog.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
#include <private/ipmip_buffer.h>
|
||||
#include <private/ipmip_cli.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_msgext.h>
|
||||
#include <private/ipmip4_auth.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_netlink.h>
|
||||
#include <private/ipmip4_attr.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
#include <private/ipmipmn_api_pktbuf.h>
|
||||
#include <private/ipmipmn_api_attr.h>
|
||||
#include <private/ipmipmn_api_node.h>
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIPMN_ATTR_BUFSIZ 512
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_CONST char *ipmipmn_api_attr_statename[] =
|
||||
{
|
||||
"halted",
|
||||
"booting",
|
||||
"isolated",
|
||||
"pending",
|
||||
"registered",
|
||||
"home"
|
||||
};
|
||||
|
||||
IP_CONST char *ipmipmn_api_attr_coaname[] =
|
||||
{
|
||||
"CCoA",
|
||||
"CCoA-TIA",
|
||||
"CCoA-Prot",
|
||||
"FA",
|
||||
"FA-LLH",
|
||||
"HA",
|
||||
"CCoA-Dead"
|
||||
};
|
||||
|
||||
|
||||
IP_CONST char *ipmipmn_api_attr_peername[] =
|
||||
{
|
||||
"HA",
|
||||
"FA"
|
||||
};
|
||||
|
||||
IP_CONST char *ipmipmn_api_attr_dhaa[] =
|
||||
{
|
||||
"none",
|
||||
"rfc3344",
|
||||
"rfc4433/no preference",
|
||||
"rfc4433/home preference",
|
||||
"rfc4433/automatically disabled"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmipmn_api_attr_node_dump(Ipmipmn_api_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_cli_message_t *request,
|
||||
Ipmipmn_api_node_t *node)
|
||||
{
|
||||
unsigned si;
|
||||
|
||||
if (node->conf)
|
||||
{
|
||||
Ip_u32 tmp;
|
||||
struct Ip_timeval tv;
|
||||
|
||||
/* Begin nested RTA */
|
||||
|
||||
/* HoA attributes */
|
||||
ipmip_attr_put_inet(&request->message,
|
||||
IPMIPMN_CLI_API_ATTR_NODE_HOA,
|
||||
node->params.assigned_home_address);
|
||||
/* HA attributes */
|
||||
|
||||
tmp = IPMIPMN_ATTR_HA_DISCOVERY_NONE;
|
||||
|
||||
if (node->conf->primary.dhaa)
|
||||
{
|
||||
if (node->params.dhaa == IPMIPMN_API_DHAA_DISABLED)
|
||||
tmp = IPMIPMN_ATTR_HA_DISCOVERY_RFC4433_DISABLED;
|
||||
else if (node->params.dhaa == IPMIPMN_API_DHAA_ENABLED)
|
||||
tmp = IPMIPMN_ATTR_HA_DISCOVERY_RFC4433_NO_PREFERENCE;
|
||||
else if (node->params.dhaa == IPMIPMN_API_DHAA_HOME)
|
||||
tmp = IPMIPMN_ATTR_HA_DISCOVERY_RFC4433_HOME_PREFERENCE;
|
||||
}
|
||||
else if (node->params.pending_home_agent != node->conf->primary.home_agent)
|
||||
{
|
||||
tmp = IPMIPMN_ATTR_HA_DISCOVERY_RFC3344;
|
||||
}
|
||||
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_HA_DHAA, tmp);
|
||||
|
||||
if (node->params.assigned_home_agent)
|
||||
ipmip_attr_put_inet(&request->message, IPMIPMN_CLI_API_ATTR_NODE_HA, node->params.assigned_home_agent);
|
||||
if (node->params.pending_home_agent != node->params.assigned_home_agent)
|
||||
ipmip_attr_put_inet(&request->message, IPMIPMN_CLI_API_ATTR_NODE_HA_PENDING, node->params.assigned_home_agent);
|
||||
|
||||
/* DATA PLANE attributes */
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_TUNNEL_REVERSE, node->params.reverse_tunnel);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_TUNNEL_TYPE, node->params.mnRegTunnelType);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_BROADCAST, node->conf->secondary.receive_broadcasts);
|
||||
|
||||
/* Registration attributes */
|
||||
if (ipmip_timer_remaining(&data->ipmip4.ipmip, proc, &node->params.mnRegTimer, &tv))
|
||||
tmp = tv.tv_sec;
|
||||
else
|
||||
tmp = 0;
|
||||
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_REMAINING, tmp);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_LIFETIME, node->params.mnRequestedLifetime);
|
||||
ipmip_attr_put_time_t(&request->message, IPMIPMN_CLI_API_ATTR_NODE_UPDATED, node->params.updated);
|
||||
ipmip_attr_put_time_t(&request->message, IPMIPMN_CLI_API_ATTR_NODE_CREATED, node->params.created);
|
||||
}
|
||||
|
||||
if (node->params.pubIf)
|
||||
ipmip_attr_put_str(&request->message, IPMIPMN_CLI_API_ATTR_NODE_IFNAME, node->params.pubIf->ipmip.ifname);
|
||||
|
||||
if (node->params.nai_aaah != IP_NULL)
|
||||
ipmip_attr_put_strn(&request->message, IPMIPMN_CLI_API_ATTR_NODE_NAI_AAAH, ((char *)IPMIP4_MSGEXT_SHDR_EXT_DATA(node->params.nai_aaah)) + 1, IPMIP4_MSGEXT_SHDR_EXT_SIZE(node->params.nai_aaah) - 1);
|
||||
if (node->params.nai_ha)
|
||||
ipmip_attr_put_strn(&request->message, IPMIPMN_CLI_API_ATTR_NODE_NAI_HA, ((char *)IPMIP4_MSGEXT_SHDR_EXT_DATA(node->params.nai_ha)) + 1, IPMIP4_MSGEXT_SHDR_EXT_SIZE(node->params.nai_ha) - 1);
|
||||
if (node->params.nai_mn)
|
||||
ipmip_attr_put_strn(&request->message, IPMIPMN_CLI_API_ATTR_NODE_NAI, ((char *)IPMIP4_MSGEXT_SHDR_EXT_DATA(node->params.nai_mn)), IPMIP4_MSGEXT_SHDR_EXT_SIZE(node->params.nai_mn));
|
||||
|
||||
if (node->params.mnRegCoA != IP_NULL)
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_STATUS,
|
||||
node->params.mnRegCoA->type == IPMIPMN_ATTR_COA_HA? IPMIPMN_ATTR_STATE_HOME : node->params.mnRegState);
|
||||
else
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_STATUS, node->params.mnRegState);
|
||||
|
||||
if (node->conf)
|
||||
{
|
||||
for (si = 0; si < data->functions->num; si++)
|
||||
{
|
||||
if (data->functions->functions[si]->setup != IP_NULL && (node->supported & (1 << si)) != 0)
|
||||
(*data->functions->functions[si]->setup)(data, proc, IPMIP_CALLBACK_CONFIG_DUMP, node->conf, node->conf->extdata[si], node->extdata[si], node, request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmipmn_api_attr_node_coa_dump(Ipmipmn_api_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_cli_message_t *request,
|
||||
Ipmipmn_api_node_t *node)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
if (node->params.mnRegCoA != IP_NULL)
|
||||
{
|
||||
Ip_size_t rta_coa;
|
||||
/* Begin nested RTA */
|
||||
rta_coa = ipmip_attr_begin(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA);
|
||||
|
||||
ipmip_attr_put_inet(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_INET, node->params.mnRegCoA->addr);
|
||||
ipmip_attr_put_inet(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_PEER, node->params.mnRegCoA->peer);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_TYPE, node->params.mnRegCoA->type);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_DOWN, node->params.mnRegCoA->down);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_MOBIKE, node->params.mnRegCoA->type == IPMIPMN_ATTR_COA_SCOA_TIA? node->params.mnRegCoA->params.tia.mobiked : 0);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_RETRANSMITS, node->params.resends);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_TUNNEL_FLAGS, node->params.mnRegTunnelFlags);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_LLH, node->params.mnRegLowLatency);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_CHALLENGE, node->params.mnRegCoA->peer == IPMIPMN_ATTR_PEER_FOREIGN_AGENT? node->params.mnRegCoA->params.fa.challenge != IP_NULL : 0);
|
||||
|
||||
if (node->params.mnRegSPIMobileForeign)
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_SPI_MF, node->params.mnRegSPIMobileForeign->spi);
|
||||
|
||||
if (node->params.mnRegSPIMobileHome)
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_COA_SPI_MH, node->params.mnRegSPIMobileHome->spi);
|
||||
|
||||
/* RTA end */
|
||||
ipmip_attr_end(&request->message, rta_coa);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmipmn_api_attr_config_dump(Ipmipmn_api_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_cli_message_t *request,
|
||||
Ipmipmn_api_node_conf_t *confp,
|
||||
const char *pre,
|
||||
const char *spec)
|
||||
{
|
||||
unsigned si;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%sdhaa=%s",
|
||||
pre, spec, confp->primary.dhaa == IPMIPMN_API_DHAA_DISABLED? "disabled" : (confp->primary.dhaa == IPMIPMN_API_DHAA_ENABLED? "enabled" : "home"));
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%shomeagent=%s",
|
||||
pre, spec, ipmip_ntop_inet(proc, confp->primary.home_agent));
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%stunneltype=%s",
|
||||
pre, spec, ipmip_util_tunnel_to_name(confp->secondary.tunneltype));
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%sreversetunneling=%s",
|
||||
pre, spec, ipmip_sysvar_mode_desc[confp->secondary.reverse_tunneling]);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%sreg_lifetime=%u",
|
||||
pre, spec, confp->secondary.lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%sreg_lifetime=%u",
|
||||
pre, spec, confp->secondary.lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%sreceivebroadcasts=%s",
|
||||
pre, spec, confp->secondary.receive_broadcasts? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"%s.%ssol_address=%s",
|
||||
pre, spec, ipmip_ntop_inet(proc, confp->secondary.sol_address));
|
||||
|
||||
|
||||
for (si = 0; si < data->functions->num; si++)
|
||||
{
|
||||
if (data->functions->functions[si]->config_instance != IP_NULL)
|
||||
(*data->functions->functions[si]->config_instance)(data, proc, IPMIP_CALLBACK_CONFIG_DUMP, pre, spec, confp, confp->extdata[si], request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,323 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_cli.c,v $ $Revision: 1.4 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_api_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 "ipmipmn_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 <ipmip4.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include <private/ipmipmn_api_attr.h>
|
||||
#include <private/ipmipmn_api_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 void
|
||||
ipmipmn_api_cli_request_set_ifname(Ipmip_cli_daemon_req_t *req,
|
||||
const char *ifname)
|
||||
{
|
||||
if (ifname)
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIPMN_CLI_API_ATTR_NODE_IFNAME, ifname);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmipmn_api_cli_request_set_nai(Ipmip_cli_daemon_req_t *req,
|
||||
const char *nai)
|
||||
{
|
||||
if (nai)
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIPMN_CLI_API_ATTR_NODE_NAI, nai);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmipmn_api_cli_request_set_home_address(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 hoa)
|
||||
{
|
||||
ipmip_attr_put_inet(&req->reqbuf, IPMIPMN_CLI_API_ATTR_NODE_HOA, hoa);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_home_address(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_inet(node, IPMIPMN_CLI_API_ATTR_NODE_HOA);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_api_cli_node_get_home_address_dynamic(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_inet(node, IPMIPMN_CLI_API_ATTR_NODE_HOA_DYNAMIC) != 0;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_home_agent(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_inet(node, IPMIPMN_CLI_API_ATTR_NODE_HA);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_home_agent_pending(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_inet(node, IPMIPMN_CLI_API_ATTR_NODE_HA_PENDING);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_home_agent_dhaa(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPMN_CLI_API_ATTR_NODE_HA_DHAA);
|
||||
}
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmipmn_api_cli_node_get_ifname(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIPMN_CLI_API_ATTR_NODE_IFNAME);
|
||||
}
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmipmn_api_cli_node_get_mipifname(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIPMN_CLI_API_ATTR_NODE_MIPIFNAME);
|
||||
}
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmipmn_api_cli_node_get_nai(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIPMN_CLI_API_ATTR_NODE_NAI);
|
||||
}
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmipmn_api_cli_node_get_nai_ha(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIPMN_CLI_API_ATTR_NODE_NAI_HA);
|
||||
}
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmipmn_api_cli_node_get_nai_aaah(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIPMN_CLI_API_ATTR_NODE_NAI_AAAH);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_api_cli_node_get_tunnel_reverse(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPMN_CLI_API_ATTR_NODE_TUNNEL_REVERSE) != 0;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_api_cli_node_get_receive_broadcast(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPMN_CLI_API_ATTR_NODE_BROADCAST) != 0;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_tunnel_type(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPMN_CLI_API_ATTR_NODE_TUNNEL_TYPE);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_time_requested(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPMN_CLI_API_ATTR_NODE_LIFETIME);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_time_remaining(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPMN_CLI_API_ATTR_NODE_REMAINING);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_time_t
|
||||
ipmipmn_api_cli_node_get_created(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_time_t(node, IPMIPMN_CLI_API_ATTR_NODE_CREATED);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_time_t
|
||||
ipmipmn_api_cli_node_get_last_updated(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_time_t(node, IPMIPMN_CLI_API_ATTR_NODE_UPDATED);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_get_status(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPMN_CLI_API_ATTR_NODE_STATUS);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_attr *
|
||||
ipmipmn_api_cli_node_coa_get(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find(node, IPMIPMN_CLI_API_ATTR_NODE_COA);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_coa_get_address(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_inet(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_INET);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_coa_get_peer(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_inet(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_PEER);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_coa_get_type(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_TYPE);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_api_cli_node_coa_get_down(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_DOWN) != 0;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_api_cli_node_coa_get_mobike(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_MOBIKE) != 0;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_coa_get_retransmits(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_RETRANSMITS);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_coa_get_tunnel_flags(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_TUNNEL_FLAGS);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_api_cli_node_coa_get_challenge(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_CHALLENGE) != 0;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_api_cli_node_coa_get_llh(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_LLH) != 0;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_coa_get_spi_mf(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_SPI_MF);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmipmn_api_cli_node_coa_get_spi_mh(struct Ipmip_attr *coa)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(coa, IPMIPMN_CLI_API_ATTR_NODE_COA_SPI_MH);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,219 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_icmp.c,v $ $Revision: 1.6 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_api_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 "ipmipmn_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_api_icmp_solicit
|
||||
*===========================================================================
|
||||
* Description: Send a solicitation request.
|
||||
* Parameters: data - The context
|
||||
* proc - Current process.
|
||||
* node - Node
|
||||
* iff - Interface
|
||||
* lla - Optional LLA extension.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmipmn_api_icmp_solicit(Ipmipmn_api_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmipmn_api_node_t *node,
|
||||
Ipmip4_if_t *iff,
|
||||
Ipmip_lladdr_t *lladdr,
|
||||
Ipmip_lladdr_t *ulladdr)
|
||||
{
|
||||
Ipmip4_icmp_solicit_t solicit;
|
||||
Ipmip4_icmp_solicit_t *solptr;
|
||||
Ipmip_buffer_t sol;
|
||||
Ip_u32 dst_addr;
|
||||
|
||||
/* Sanity */
|
||||
if (lladdr)
|
||||
{
|
||||
if (node->params.mnRegCoA == IP_NULL)
|
||||
{
|
||||
IPMIP4_EVENT_IF(DEBUG2, proc,
|
||||
ipmip_log_event_add(&data->ipmip4.ipmip,
|
||||
proc,
|
||||
"%s has no current CoA, discard LLH trigger",
|
||||
IPMIPMN_API_NODE_NAME(data, proc, node)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (node->params.mnRegCoA->peer != IPMIPMN_ATTR_PEER_FOREIGN_AGENT)
|
||||
{
|
||||
IPMIP4_EVENT_IF(DEBUG2, proc,
|
||||
ipmip_log_event_add(&data->ipmip4.ipmip,
|
||||
proc,
|
||||
"%s CoA peer is not Foreign Agent, discard LLH trigger",
|
||||
IPMIPMN_API_NODE_NAME(data, proc, node)));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ipmip_buffer_init(&sol);
|
||||
|
||||
ipcom_memset(&solicit, 0, sizeof(solicit));
|
||||
solicit.icmp_type = IPMIP4_ICMP_ROUTER_SOLICITATION;
|
||||
|
||||
ipmip_buffer_append(&sol, &solicit, sizeof(solicit));
|
||||
|
||||
if (lladdr)
|
||||
{
|
||||
ipmip4_lla_llh_lladdr_buffer_icmp_append(&sol, lladdr);
|
||||
dst_addr = node->params.mnRegCoA->addr;
|
||||
}
|
||||
else
|
||||
dst_addr = node->conf->secondary.sol_address;
|
||||
|
||||
IPMIP4_EVENT_IF(DEBUG2, proc,
|
||||
ipmip_log_event_add(&data->ipmip4.ipmip,
|
||||
proc,
|
||||
"%s sending %s to %s on %s",
|
||||
IPMIPMN_API_NODE_NAME(data, proc, node),
|
||||
lladdr? "PrRtSol" : "RtSol",
|
||||
ipmip_ntop_inet(proc, dst_addr),
|
||||
iff->ipmip.ifname));
|
||||
|
||||
|
||||
solptr = IPMIP_BUFFER_PTR(&sol);
|
||||
solptr->icmp_checksum = ipcom_in_checksum(IPMIP_BUFFER_DATA(&sol), IPMIP_BUFFER_SIZE(&sol));
|
||||
|
||||
|
||||
/* Write the request */
|
||||
if (ipmip4_pkt_icmp_write(&data->ipmip4,
|
||||
proc,
|
||||
&sol,
|
||||
node->params.assigned_home_address,
|
||||
dst_addr,
|
||||
iff,
|
||||
ulladdr) != IP_TRUE)
|
||||
{
|
||||
IPMIP4_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&data->ipmip4.ipmip,
|
||||
proc,
|
||||
"%s sending %s to %s on %s - FAILED",
|
||||
IPMIPMN_API_NODE_NAME(data, proc, node),
|
||||
lladdr? "PrRtSol" : "RtSol",
|
||||
ipmip_ntop_inet(proc, dst_addr),
|
||||
iff->ipmip.ifname));
|
||||
|
||||
}
|
||||
|
||||
ipmip_buffer_release(&sol);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,142 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_pktbuf.c,v $ $Revision: 1.2 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_api_pktbuf.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 "ipmipmn_config.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_tmo2.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_if.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_pktbuf.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_auth.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
#include <private/ipmipmn_api_pktbuf.h>
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_pktbuf_free
|
||||
*===========================================================================
|
||||
* Description: Free a packet buffer
|
||||
* Parameters: pbuf - The packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmipmn_api_pktbuf_free(Ipmipmn_api_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmipmn_api_pktbuf_t *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (pbuf->mnRegSPIMobileHome)
|
||||
ipmip4_auth_spi_free(pbuf->mnRegSPIMobileHome);
|
||||
if (pbuf->mnRegSPIMobileForeign)
|
||||
ipmip4_auth_spi_free(pbuf->mnRegSPIMobileForeign);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,468 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_attr.c,v $ $Revision: 1.18 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_attr.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 "ipmipmn_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_syslog.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_buffer.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_msgext.h>
|
||||
#include <private/ipmip4_auth.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_attr.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include "ipmipmn_h.h"
|
||||
#include "ipmipmn_attr_h.h"
|
||||
#include "ipmipmn_attr.h"
|
||||
#include "ipmipmn_route.h"
|
||||
#include "ipmipmn_node.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
Ipmip_sysvar_key_map_t ipmipmn_attr_runmode[] =
|
||||
{
|
||||
{ IPMIPMN_API_RUNMODE_FA, "fa" },
|
||||
{ IPMIPMN_API_RUNMODE_FA, "foreign agent" },
|
||||
{ IPMIPMN_API_RUNMODE_FA, "facoa" },
|
||||
{ IPMIPMN_API_RUNMODE_FA, "facoa" },
|
||||
{ IPMIPMN_API_RUNMODE_COLOCATED, "co" },
|
||||
{ IPMIPMN_API_RUNMODE_COLOCATED, "ccoa" },
|
||||
{ IPMIPMN_API_RUNMODE_COLOCATED, "co-located" },
|
||||
{ IPMIPMN_API_RUNMODE_COLOCATED, "colocated" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Ipmip_sysvar_key_map_t ipmipmn_attr_lookup[] =
|
||||
{
|
||||
{ IPMIPMN_ATTR_COA_CCOA, "ccoa" },
|
||||
{ IPMIPMN_ATTR_COA_SCOA_TIA, "tia" },
|
||||
{ IPMIPMN_ATTR_COA_SCOA_PROTECTED, "protected" },
|
||||
{ IPMIPMN_ATTR_COA_FA, "fa" },
|
||||
{ IPMIPMN_ATTR_COA_FA_LLH, "llh" },
|
||||
{ IPMIPMN_ATTR_COA_HA, "ha" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_attr_api_command
|
||||
*===========================================================================
|
||||
* Description: Dump a node
|
||||
* Parameters: event - Current event
|
||||
* data - Data
|
||||
* proc - Current process
|
||||
* lock - Command locking structure
|
||||
* node - Node.
|
||||
* Returns: IP_FALSE
|
||||
*
|
||||
*/
|
||||
IP_STATIC int
|
||||
ipmipmn_attr_node_command(int event,
|
||||
Ipmipmn_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_cli_message_t *request,
|
||||
Ipmipmn_node_t *node)
|
||||
{
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
|
||||
Ip_size_t rhdr = 0;
|
||||
|
||||
if (node == IP_NULL)
|
||||
rhdr = ipmip_attr_hdr_err(&request->message, hdr, IP_ERRNO_ENOENT, IP_NULL);
|
||||
else
|
||||
{
|
||||
switch (IPMIP_ATTR_HDR_TYPE(hdr))
|
||||
{
|
||||
case IPMIPMN_CLI_NODE_LLH_MT:
|
||||
{
|
||||
Ip_u32 fa = ipmip_attr_hdr_find_inet(hdr, IPMIPMN_CLI_ATTR_NODE_LLH_FA);
|
||||
Ip_u32 ap = ipmip_attr_hdr_find_u32(hdr, IPMIPMN_CLI_ATTR_NODE_LLH_AP);
|
||||
const char *ifname = ipmip_attr_hdr_find_str(hdr, IPMIPMN_CLI_API_ATTR_NODE_IFNAME);
|
||||
if (ifname == IP_NULL)
|
||||
rhdr = ipmip_attr_hdr_err(&request->message, hdr, IP_ERRNO_EINVAL, IP_NULL);
|
||||
else
|
||||
{
|
||||
Ipmipmn_iff_t *ifp = ipmipmn_if_acquire(data, proc, ifname, IP_NULL);
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
|
||||
if (ifp)
|
||||
{
|
||||
ipmip_lladdr_build((Ipmip_lladdr_t *)proc->ntop.ntop_pbuf,
|
||||
fa? IPMIP_LLADDR_TYPE_INET : IPMIP_LLADDR_TYPE_BSSID,
|
||||
fa? IPMIP_LLADDR_SUBTYPE_INET_FA : 0,
|
||||
fa? &fa : &ap,
|
||||
sizeof(Ip_u32));
|
||||
|
||||
if (node->api.params.pubIf == &ifp->iff)
|
||||
ipmipmn_api_icmp_solicit(&data->api, proc, &node->api, &ifp->iff, (Ipmip_lladdr_t *)proc->ntop.ntop_pbuf, IP_NULL);
|
||||
ipmipmn_if_release(data, proc, ifp, IP_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IPMIPMN_CLI_NODE_IF_SET:
|
||||
{
|
||||
const char *ifname = ipmip_attr_hdr_find_str(hdr, IPMIPMN_CLI_API_ATTR_NODE_IFNAME);
|
||||
if (ifname == IP_NULL)
|
||||
rhdr = ipmip_attr_hdr_err(&request->message, hdr, IP_ERRNO_EINVAL, IP_NULL);
|
||||
else
|
||||
{
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
|
||||
ipmipmn_api_node_state_update(&data->api, proc, &node->api, IPMIPMN_ATTR_STATE_BOOTING, "switching interface");
|
||||
if (node->conf->secondary.ifname)
|
||||
ipcom_free(node->conf->secondary.ifname);
|
||||
node->conf->secondary.ifname = ipcom_strdup(ifname);
|
||||
ipmipmn_api_node_state_update(&data->api, proc, &node->api, -1, "verify state");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IPMIPMN_CLI_NODE_GET:
|
||||
{
|
||||
Ip_size_t rta;
|
||||
const char *str;
|
||||
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
|
||||
rta = ipmip_attr_begin(&request->message, IPMIPMN_API_CLI_ATTR_NODE);
|
||||
ipmipmn_api_attr_node_dump(&data->api, proc, request, &node->api);
|
||||
|
||||
ipmip_attr_put_u32(&request->message, IPMIPMN_CLI_API_ATTR_NODE_HOA_DYNAMIC, !!(node->conf->primary.home_address == 0 || node->api.conf->primary.dhaa != IPMIP_SYSVAR_MODE_DISABLED));
|
||||
|
||||
str = ipmipmn_route_node_get_tunnel_ifname(data, proc, node->route);
|
||||
if (str)
|
||||
ipmip_attr_put_str(&request->message, IPMIPMN_CLI_API_ATTR_NODE_MIPIFNAME, str);
|
||||
|
||||
ipmipmn_api_attr_node_coa_dump(&data->api, proc, request, &node->api);
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
break;
|
||||
case IPMIP_CLI_CONFIG_GET:
|
||||
{
|
||||
/* Dump each configuration item we've currently got in human readable form */
|
||||
char *spec = ipmip_util_strdup("%s%s", node->name, ipcom_strlen(node->name)? "." : "");
|
||||
int i;
|
||||
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
|
||||
ipmipmn_api_attr_config_dump(&data->api, proc, request, &node->conf->api, "ipmipmn", spec);
|
||||
|
||||
/* */
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%shomeaddress=%s",
|
||||
spec, ipmip_ntop_inet(proc, node->conf->primary.home_address));
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%shomenetmask=%s",
|
||||
spec, ipmip_ntop_inet(proc, node->conf->primary.home_netmask));
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%shomegateway=%s",
|
||||
spec, ipmip_ntop_inet(proc, node->conf->primary.home_gateway));
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%srevocation=%s",
|
||||
spec, node->conf->secondary.revocation? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%ssimbind=%s",
|
||||
spec, node->conf->secondary.simbind? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%sreordering=%s",
|
||||
spec, node->conf->primary.reordering? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%snat_t.tunneltype=%s",
|
||||
spec, ipmip_util_tunnel_to_desc(node->conf->secondary.nat_t_tunnel));
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%snat_t.enabled=%s",
|
||||
spec, node->conf->secondary.nat_t? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%snat_t.keepalive=%d",
|
||||
spec, node->conf->secondary.nat_t_keepalive);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%snat_t.forced=%s",
|
||||
spec, node->conf->secondary.nat_t_forced? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%sipike.mobility=%s",
|
||||
spec, node->conf->secondary.ipike_mobility? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%sipike.reconfigure=%s",
|
||||
spec, node->conf->secondary.ipike_reconfigure? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%smtu_reduction=%d",
|
||||
spec, node->conf->secondary.mtu);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%ssolicit=%s",
|
||||
spec, ipmip_sysvar_mode_desc[node->conf->secondary.solicitations]);
|
||||
|
||||
if (node->conf->secondary.ifname)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%sinterface=%s",
|
||||
spec, node->conf->secondary.ifname);
|
||||
}
|
||||
|
||||
if (node->conf->primary.nai_mn != IP_NULL)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmipmn.%snai.mn=%s",
|
||||
spec, (char *)IPMIP4_MSGEXT_SHDR_EXT_DATA(node->conf->primary.nai_mn));
|
||||
}
|
||||
|
||||
if (node->conf->excluded != IP_NULL)
|
||||
{
|
||||
ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf), "ipmipmn.%sexcluded=", spec);
|
||||
for (i = 0; node->conf->excluded[i] != IP_NULL; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
ipcom_strncat(proc->ntop.ntop_pbuf, ",", sizeof(proc->ntop.ntop_pbuf));
|
||||
ipcom_strncat(proc->ntop.ntop_pbuf, node->conf->excluded[i], sizeof(proc->ntop.ntop_pbuf));
|
||||
|
||||
}
|
||||
ipmip_cli_config_printf(&request->message, proc->ntop.ntop_pbuf);
|
||||
}
|
||||
|
||||
|
||||
if (node->conf->primary.coa_lookup)
|
||||
{
|
||||
ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf), "ipmipmn.%coa.lookup=", spec);
|
||||
for (i = 0; node->conf->primary.coa_lookup[i] != IPMIPMN_ATTR_COA_NONE; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = 0; ipmipmn_attr_lookup[j].str != IP_NULL; j++)
|
||||
{
|
||||
if (ipmipmn_attr_lookup[j].key == node->conf->primary.coa_lookup[i])
|
||||
{
|
||||
if (i != 0)
|
||||
ipcom_strncat(proc->ntop.ntop_pbuf, ",", sizeof(proc->ntop.ntop_pbuf));
|
||||
ipcom_strncat(proc->ntop.ntop_pbuf, ipmipmn_attr_lookup[j].str, sizeof(proc->ntop.ntop_pbuf));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
ipmip_cli_config_printf(&request->message, proc->ntop.ntop_pbuf);
|
||||
}
|
||||
|
||||
ipcom_free(spec);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have a reply header; terminate it */
|
||||
ipmip_attr_hdr_finalize(&request->message, rhdr);
|
||||
|
||||
/* Commit the reply */
|
||||
ipmip_cli_message_commit(&data->api.ipmip4.ipmip, proc, request);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Free the request */
|
||||
ipmip_cli_message_free(&data->api.ipmip4.ipmip, proc, request);
|
||||
}
|
||||
|
||||
return IPMIP_TIMER_RET_DONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_attr_command
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int
|
||||
ipmipmn_attr_command(struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip_cli_message *request)
|
||||
{
|
||||
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
|
||||
Ip_size_t rhdr = 0;
|
||||
|
||||
switch (IPMIP_ATTR_HDR_TYPE(hdr))
|
||||
{
|
||||
case IPMIP_CLI_NAME_LIST:
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP_CLI_ITEM_NAME,
|
||||
"global");
|
||||
break;
|
||||
|
||||
case IPMIPMN_CLI_NODE_GET:
|
||||
case IPMIPMN_CLI_NODE_IF_SET:
|
||||
case IPMIPMN_CLI_NODE_LLH_MT:
|
||||
case IPMIP_CLI_CONFIG_GET:
|
||||
/**/
|
||||
if (ipmip_timer_lock_try(&data->api.ipmip4.ipmip, proc, data->node->api.lock))
|
||||
{
|
||||
/* Invoke the lock */
|
||||
ipmip_timer_call(&data->api.ipmip4.ipmip, proc, data->node->api.lock, (Ipmip_timer_func_t)ipmipmn_attr_node_command, request, data->node);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Try get the lock as fast as possible */
|
||||
ipmip_timer_request(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
&request->timer,
|
||||
data->node->api.lock,
|
||||
(Ipmip_timer_func_t)ipmipmn_attr_node_command,
|
||||
request,
|
||||
data->node,
|
||||
0);
|
||||
}
|
||||
return IPCOM_SUCCESS;
|
||||
case IPMIPMN_CLI_DAEMON_IF_LU:
|
||||
case IPMIPMN_CLI_DAEMON_IF_LD:
|
||||
{
|
||||
const char *ifname = ipmip_attr_hdr_find_str(hdr, IPMIPMN_CLI_API_ATTR_NODE_IFNAME);
|
||||
Ipmipmn_iff_t *ifp;
|
||||
|
||||
if (ifname == IP_NULL)
|
||||
return -IP_ERRNO_EINVAL;
|
||||
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
ifp = ipmipmn_if_acquire(data, proc, ifname, IP_NULL);
|
||||
if (ifp != IP_NULL)
|
||||
{
|
||||
switch (IPMIP_ATTR_HDR_TYPE(hdr))
|
||||
{
|
||||
case IPMIPMN_CLI_DAEMON_IF_LU:
|
||||
ipmipmn_if_admin_up(data, proc, ifp);
|
||||
break;
|
||||
case IPMIPMN_CLI_DAEMON_IF_LD:
|
||||
ipmipmn_if_admin_down(data, proc, ifp);
|
||||
break;
|
||||
}
|
||||
ipmipmn_if_release(data, proc, ifp, IP_NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return ipmip4_attr_command(&data->api.ipmip4, proc, request);
|
||||
}
|
||||
|
||||
/* If we have a reply header; terminate it */
|
||||
ipmip_attr_hdr_finalize(&request->message, rhdr);
|
||||
|
||||
/* Commit the reply */
|
||||
ipmip_cli_message_commit(&data->api.ipmip4.ipmip, proc, request);
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,105 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_attr_h.h,v $ $Revision: 1.10 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_attr_h.h,v $
|
||||
* $Author: jhorteli $ $Date: 2010-02-15 13:26:28 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPMN_ATTR_H_H
|
||||
#define IPMIPMN_ATTR_H_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmipmn_h.h>
|
||||
#include <private/ipmipmn_api_attr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
extern Ipmip_sysvar_key_map_t ipmipmn_attr_runmode[];
|
||||
extern Ipmip_sysvar_key_map_t ipmipmn_attr_lookup[];
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_attr_command - ipmipmn_attr_command
|
||||
*
|
||||
* Process a mobile node attribute command
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i request
|
||||
* Issued command
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IPCOM_SUCCESS on successful parsing
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL int ipmipmn_attr_command
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip_cli_message *request
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,215 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_cli.c,v $ $Revision: 1.2 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_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 "ipmipmn_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 <ipmip4.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include "ipmipmn_attr.h"
|
||||
#include "ipmipmn_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
|
||||
ipmipmn_cli_connect(Ipmip_cli_daemon_t *daemon_info)
|
||||
{
|
||||
ipmip_cli_daemon_init(daemon_info, "ipmipmn", IPCOM_IPD_ID_IPMIPMN);
|
||||
return ipmip_cli_daemon_connect(daemon_info);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_attr *
|
||||
ipmipmn_cli_node_get(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIPMN_CLI_NODE_GET);
|
||||
|
||||
if (ipmip_cli_daemon_request(daemon, req) == IPCOM_SUCCESS)
|
||||
return ipmip_cli_daemon_find_request(req, IPMIPMN_API_CLI_ATTR_NODE);
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_cli_node_setif(Ipmip_cli_daemon_t *daemon,
|
||||
const char *ifname)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
Ip_bool ret;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIPMN_CLI_NODE_IF_SET);
|
||||
ipmipmn_api_cli_request_set_ifname(&req, ifname);
|
||||
ret = ipmip_cli_daemon_request(daemon, &req) == IPCOM_SUCCESS;
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
return ret;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_cli_node_llh_mt(Ipmip_cli_daemon_t *daemon,
|
||||
const char *ifname,
|
||||
Ip_u32 fa,
|
||||
Ip_u32 ap)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
Ip_bool ret;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIPMN_CLI_NODE_LLH_MT);
|
||||
if (fa)
|
||||
ipmipmn_cli_request_set_foreign_agent(&req, fa);
|
||||
else
|
||||
ipmipmn_cli_request_set_access_point(&req, ap);
|
||||
ipmipmn_api_cli_request_set_ifname(&req, ifname);
|
||||
ret = ipmip_cli_daemon_request(daemon, &req) == IPCOM_SUCCESS;
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmipmn_cli_request_set_access_point(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 ap)
|
||||
{
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIPMN_CLI_ATTR_NODE_LLH_AP, ap);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmipmn_cli_request_set_foreign_agent(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 fa)
|
||||
{
|
||||
ipmip_attr_put_inet(&req->reqbuf, IPMIPMN_CLI_ATTR_NODE_LLH_FA, fa);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_cli_daemon_if_link_up(Ipmip_cli_daemon_t *daemon,
|
||||
const char *ifname)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
Ip_bool ret;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIPMN_CLI_DAEMON_IF_LU);
|
||||
ipmipmn_api_cli_request_set_ifname(&req, ifname);
|
||||
ret = ipmip_cli_daemon_request(daemon, &req) == IPCOM_SUCCESS;
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
return ret;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmipmn_cli_daemon_if_link_down(Ipmip_cli_daemon_t *daemon,
|
||||
const char *ifname)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
Ip_bool ret;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIPMN_CLI_DAEMON_IF_LD);
|
||||
ipmipmn_api_cli_request_set_ifname(&req, ifname);
|
||||
ret = ipmip_cli_daemon_request(daemon, &req) == IPCOM_SUCCESS;
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,450 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_cmd_mn.c,v $ $Revision: 1.29 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_cmd_mn.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Niklas Lundberg <n@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
*******************************************************************************
|
||||
*
|
||||
*/
|
||||
/*
|
||||
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_getopt.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_tmo2.h>
|
||||
#include <ipcom_cmd.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_cli.h>
|
||||
#include <private/ipmip_context.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_msgext.h>
|
||||
#include <private/ipmip4_ntop.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include "ipmipmn_attr.h"
|
||||
#include "ipmipmn_cli.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
IP_PUBLIC int ipmipmn_cmd_mn(int argc, char **argv);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIPMN_CMD_LLH_MT (1)
|
||||
#define IPMIPMN_CMD_OP_SHOW (2)
|
||||
#define IPMIPMN_CMD_OP_SETIF (3)
|
||||
#define IPMIPMN_CMD_OP_LU (4)
|
||||
#define IPMIPMN_CMD_OP_LD (5)
|
||||
|
||||
|
||||
IP_STATIC Ipcom_cmd_int_str_map ipmipmn_cmd_ops[] =
|
||||
{
|
||||
{ IPMIPMN_CMD_LLH_MT, "mt" },
|
||||
{ IPMIPMN_CMD_OP_LU, "lu" },
|
||||
{ IPMIPMN_CMD_OP_LD, "ld" },
|
||||
{ IPMIPMN_CMD_OP_SHOW, "show" },
|
||||
{ IPMIPMN_CMD_OP_SETIF, "setif" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_cmd_show_status
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmipmn_cmd_show_status(Ipmip_proc_t *proc,
|
||||
struct Ipmip_attr *node,
|
||||
Ip_bool verbose)
|
||||
{
|
||||
Ip_u32 tmp;
|
||||
Ip_u32 status;
|
||||
struct Ipmip_attr *coa;
|
||||
const char *str;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(verbose);
|
||||
|
||||
/* parse it */
|
||||
coa = ipmipmn_api_cli_node_coa_get(node);
|
||||
|
||||
ipcom_printf("Mobile Node :"IP_LF);
|
||||
|
||||
status = ipmipmn_api_cli_node_get_status(node);
|
||||
ipcom_printf(" Status : %s%s"IP_LF, ipmipmn_api_attr_statename[status], (coa != IP_NULL && ipmipmn_api_cli_node_coa_get_down(coa))? "*" : "");
|
||||
|
||||
str = ipmipmn_api_cli_node_get_mipifname(node);
|
||||
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" Mobile Interface : %s"IP_LF, str);
|
||||
|
||||
str = ipmipmn_api_cli_node_get_ifname(node);
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" Interface : %s"IP_LF, str);
|
||||
|
||||
tmp = ipmipmn_api_cli_node_get_home_address(node);
|
||||
if (tmp != 0)
|
||||
ipcom_printf(" Home Address : %s"IP_LF, ipmip_ntop_inet(proc, tmp));
|
||||
|
||||
tmp = ipmipmn_api_cli_node_get_home_agent(node);
|
||||
if (tmp != 0)
|
||||
ipcom_printf(" Assigned Home Agent : %s"IP_LF, ipmip_ntop_inet(proc, tmp));
|
||||
|
||||
tmp = ipmipmn_api_cli_node_get_home_agent_pending(node);
|
||||
if (tmp != 0)
|
||||
ipcom_printf(" Pending Home Agent : %s"IP_LF, ipmip_ntop_inet(proc, tmp));
|
||||
|
||||
ipcom_printf(" Reverse Tunnel : %s"IP_LF, ipmipmn_api_cli_node_get_tunnel_reverse(node)? "yes" : "no");
|
||||
ipcom_printf(" Broadcast : %s"IP_LF, ipmipmn_api_cli_node_get_receive_broadcast(node)? "yes" : "no");
|
||||
ipcom_printf(" Home Agent Discovery: %s"IP_LF, ipmipmn_api_attr_dhaa[ipmipmn_api_cli_node_get_home_agent_dhaa(node)]);
|
||||
|
||||
ipcom_printf(" Dynamic Home Address: %s"IP_LF, ipmipmn_api_cli_node_get_home_address_dynamic(node)? "yes" : "no");
|
||||
|
||||
ipcom_printf(" Tunnel type : %s"IP_LF, ipmip_util_tunnel_to_desc(ipmipmn_api_cli_node_get_tunnel_type(node)));
|
||||
|
||||
str = ipmipmn_api_cli_node_get_nai(node);
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" Mobile Node NAI : %s"IP_LF, str);
|
||||
|
||||
if (status != IPMIPMN_ATTR_STATE_HOME &&
|
||||
status >= IPMIPMN_ATTR_STATE_REGISTERED)
|
||||
{
|
||||
ipcom_printf(" Established : %s"IP_LF, ipmip_ntop_tm(proc, ipmipmn_api_cli_node_get_created(node)));;
|
||||
ipcom_printf(" Updated : %s"IP_LF, ipmip_ntop_tm(proc, ipmipmn_api_cli_node_get_last_updated(node)));
|
||||
|
||||
ipcom_printf(" Lifetime : %u/%u"IP_LF, ipmipmn_api_cli_node_get_time_remaining(node), ipmipmn_api_cli_node_get_time_requested(node));
|
||||
|
||||
str = ipmipmn_api_cli_node_get_nai_ha(node);
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" Home Agent NAI : %s"IP_LF, str);
|
||||
str = ipmipmn_api_cli_node_get_nai_aaah(node);
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" AAAH Agent NAI : %s"IP_LF, str);
|
||||
}
|
||||
|
||||
/* Current care of? */
|
||||
if (coa != IP_NULL)
|
||||
{
|
||||
ipcom_printf(" Care Of Address :"IP_LF);
|
||||
ipcom_printf(" CoA Type : %s"IP_LF, ipmipmn_api_attr_coaname[ipmipmn_api_cli_node_coa_get_type(coa)]);
|
||||
ipcom_printf(" CoA Peer : %s"IP_LF, ipmipmn_api_attr_peername[ipmipmn_api_cli_node_coa_get_peer(coa)]);
|
||||
ipcom_printf(" CoA Address : %s"IP_LF, ipmip_ntop_inet(proc, ipmipmn_api_cli_node_coa_get_address(coa)));
|
||||
ipcom_printf(" CoA Mobike : %s"IP_LF, ipmipmn_api_cli_node_coa_get_mobike(coa)? "yes" : "no");
|
||||
ipcom_printf(" Challenge : %s"IP_LF, ipmipmn_api_cli_node_coa_get_challenge(coa)? "yes" : "no");
|
||||
|
||||
tmp = ipmipmn_api_cli_node_coa_get_tunnel_flags(coa);
|
||||
ipcom_printf(" NAT Traversal : %s"IP_LF, IP_BIT_ARESET(tmp, IPMIP4_TUNNELMODE_NAT_T_CONFIRMED)? "yes" : "no");
|
||||
ipcom_printf(" Reg. Revocation : %s"IP_LF, IP_BIT_ARESET(tmp, IPMIP4_TUNNELMODE_REVOCATION_CONFIRMED)? "yes" : "no");
|
||||
ipcom_printf(" Retransmits : %u"IP_LF, ipmipmn_api_cli_node_coa_get_retransmits(coa));
|
||||
ipcom_printf(" Low Latency : %s"IP_LF, ipmipmn_api_cli_node_coa_get_llh(coa)? "yes" : "no");
|
||||
|
||||
tmp = ipmipmn_api_cli_node_coa_get_spi_mf(coa);
|
||||
if (tmp)
|
||||
ipcom_printf(" SPI MF : %u"IP_LF, tmp);
|
||||
tmp = ipmipmn_api_cli_node_coa_get_spi_mh(coa);
|
||||
if (tmp)
|
||||
ipcom_printf(" SPI MH : %u"IP_LF, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_cmd_mn
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters: .
|
||||
* Returns: .
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC int
|
||||
ipmipmn_cmd_mn(int argc, char **argv)
|
||||
{
|
||||
Ipcom_getopt opt;
|
||||
int c;
|
||||
int op_val;
|
||||
char *op;
|
||||
Ipmip_cli_daemon_t daemon;
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
Ipmip_proc_t *proc = IP_NULL;
|
||||
int i;
|
||||
|
||||
daemon.fd = IP_INVALID_SOCKET;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
|
||||
proc = ipmip_proc_alloc();
|
||||
if (proc == IP_NULL)
|
||||
{
|
||||
ipcom_printf("mn: failed to create process context"IP_LF);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc < 2)
|
||||
goto usage;
|
||||
|
||||
|
||||
/* Get a connection to the home agent. */
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (ipmipmn_cli_connect(&daemon))
|
||||
break;
|
||||
ipcom_sleep(1);
|
||||
}
|
||||
|
||||
if (daemon.fd == IP_INVALID_SOCKET)
|
||||
{
|
||||
ipcom_printf("mn: failed to connect to mobile node"IP_LF);
|
||||
ipmip_proc_destroy(proc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ipcom_getopt_clear_r(&opt);
|
||||
|
||||
op = argv[1];
|
||||
op_val = ipcom_cmd_str_to_key(ipmipmn_cmd_ops, op);
|
||||
|
||||
if (op_val == -1)
|
||||
{
|
||||
if (ipmip4_cli_shell_cmd(argc, argv, proc, &daemon) == -1)
|
||||
{
|
||||
ipcom_printf("'%s' is an invalid operation"IP_LF, op);
|
||||
goto usage;
|
||||
}
|
||||
goto exit_out;
|
||||
}
|
||||
|
||||
if (op_val == IPMIPMN_CMD_LLH_MT)
|
||||
{
|
||||
Ip_u32 faip = 0;
|
||||
Ip_u32 faap = 0;
|
||||
const char *ifname = IP_NULL;
|
||||
|
||||
static struct Ip_option long_options[] =
|
||||
{
|
||||
{"fa", 1, 0, 0},
|
||||
{"ap", 1, 0, 0},
|
||||
{"ifname", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
ipcom_getopt_clear_r(&opt);
|
||||
opt.long_only = 1;
|
||||
opt.long_options = long_options;
|
||||
|
||||
while((c = ipcom_getopt_r(argc - 1, argv + 1, "", &opt)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
switch(opt.long_index)
|
||||
{
|
||||
case 0: /* faip */
|
||||
if (ipcom_inet_pton(IP_AF_INET, opt.optarg, &faip) != 1)
|
||||
{
|
||||
ipcom_printf("bad '--fa' IPv4 address."IP_LF);
|
||||
goto usage;
|
||||
}
|
||||
break;
|
||||
case 1: /* faap */
|
||||
faap = ipcom_atoi(opt.optarg);
|
||||
break;
|
||||
case 2: /* mnifname */
|
||||
ifname = opt.optarg;
|
||||
break;
|
||||
default:
|
||||
ipcom_printf("unknown option %s", long_options[opt.long_index].name);
|
||||
if (opt.optarg)
|
||||
ipcom_printf(" with arg %s", opt.optarg);
|
||||
ipcom_printf(IP_LF);
|
||||
goto usage;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ipcom_printf("Unknown option '%c'"IP_LF, i);
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
|
||||
if (ifname == IP_NULL)
|
||||
goto usage;
|
||||
|
||||
/****** Run the command ******/
|
||||
ipmipmn_cli_node_llh_mt(&daemon, ifname, faip, faap);
|
||||
}
|
||||
else
|
||||
{
|
||||
ipcom_getopt_clear_r(&opt);
|
||||
|
||||
if (op_val == IPMIPMN_CMD_OP_SHOW)
|
||||
{
|
||||
struct Ipmip_attr *node;
|
||||
/* joel@interpeak.se
|
||||
* 10.2.3.1:101.1.1.20
|
||||
*/
|
||||
/* Show node information */
|
||||
Ip_bool verbose = IP_FALSE;
|
||||
|
||||
while ((i = ipcom_getopt_r(argc - 1, argv + 1, "v", &opt)) != -1)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 'v':
|
||||
verbose = IP_TRUE;
|
||||
break;
|
||||
default:
|
||||
ipcom_printf("mn: invalid option '%c'"IP_LF, i);
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
|
||||
if ((node = ipmipmn_cli_node_get(&daemon, &req)) != IP_NULL)
|
||||
ipmipmn_cmd_show_status(proc, node, verbose);
|
||||
}
|
||||
else if (op_val == IPMIPMN_CMD_OP_SETIF)
|
||||
{
|
||||
if (argc < 3)
|
||||
goto usage;
|
||||
|
||||
/**/
|
||||
ipmipmn_cli_node_setif(&daemon, argv[2]);
|
||||
}
|
||||
else if (op_val == IPMIPMN_CMD_OP_LD)
|
||||
{
|
||||
if (argc < 3)
|
||||
goto usage;
|
||||
|
||||
/**/
|
||||
ipmipmn_cli_daemon_if_link_down(&daemon, argv[2]);
|
||||
}
|
||||
else if (op_val == IPMIPMN_CMD_OP_LU)
|
||||
{
|
||||
if (argc < 3)
|
||||
goto usage;
|
||||
|
||||
/**/
|
||||
ipmipmn_cli_daemon_if_link_up(&daemon, argv[2]);
|
||||
}
|
||||
|
||||
exit_out:
|
||||
ipmip_cli_daemon_disconnect(&daemon);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
ipmip_proc_destroy(proc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****** Usage ******/
|
||||
usage:
|
||||
ipmip_util_identprintf(proc, 0, "NAME"IP_LF);
|
||||
ipmip_util_identprintf(proc, 1, "mn - Displays Mobile Node bindings, statistics and status" IP_LF);
|
||||
ipmip_util_identprintf(proc, 0, "SYNOPSIS"IP_LF);
|
||||
ipmip_util_identprintf(proc, 1, "mn <command> [arguments]"IP_LF);
|
||||
ipmip_util_identprintf(proc, 0, "DESCRIPTION"IP_LF);
|
||||
ipmip_util_identprintf(proc, 1,
|
||||
"The mn command version %u.%u.%u is used to display current Mobile Node MIPv4"IP_LF
|
||||
"bindings, statistics and status."IP_LF,
|
||||
(IPMIPMN_RELEASE / 10000) % 100, (IPMIPMN_RELEASE / 100) % 100, IPMIPMN_RELEASE % 100);
|
||||
ipmip_util_identprintf(proc, 0, "COMMANDS"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "show [-v]", "Show the mobile node status");
|
||||
ipmip_util_identprintf(proc, 2, "-v Verbose mode"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "setif <ifname>", "Set the interface to be used by the mobile node");
|
||||
ipmip_util_identprintf(proc, 2, "<ifname> Interface name"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "lu <ifname>", "Bring a particular interface administratively up");
|
||||
ipmip_util_identprintf(proc, 2, "<ifname> Interface name"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "ld <ifname>", "Bring a particular interface administratively down");
|
||||
ipmip_util_identprintf(proc, 2, "<ifname> Interface name"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "mt --ifname=<ifname> [--fa=<foreign agent>] [--ap=<access point>]", "Send a mobile trigger");
|
||||
ipmip_util_identprintf(proc, 2, "<ifname> Interface name"IP_LF);
|
||||
ipmip4_cli_shell_usage(proc);
|
||||
|
||||
ipmip_cli_daemon_disconnect(&daemon);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
ipmip_proc_destroy(proc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_h.h,v $ $Revision: 1.20 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_h.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-01 18:34:39 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IP_H
|
||||
#define IP_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmipmn_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
#include <private/ipmip_cli.h>
|
||||
#include <private/ipmip4_msgext.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
struct Ipmipmn_node;
|
||||
struct Ipmipmn_route_context;
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Configuration IPMIPMN data
|
||||
*===========================================================================
|
||||
*/
|
||||
#define IPMIPMN_SECRET_LENGTH_MAX 16
|
||||
|
||||
typedef struct Ipmipmn_context
|
||||
{
|
||||
Ipmipmn_api_context_t api;
|
||||
|
||||
/* Contexts */
|
||||
struct Ipmipmn_route_context *route;
|
||||
|
||||
/* Lock to protect interface values */
|
||||
Ipmip_timer_lock_t *iflock;
|
||||
Ipcom_list ifhead;
|
||||
Ip_u32 ifstamp;
|
||||
int ifalloc;
|
||||
|
||||
/* Lock to protect nodes */
|
||||
struct Ipmipmn_node *node;
|
||||
}
|
||||
Ipmipmn_context_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_api_extension;
|
||||
IP_GLOBAL Ip_u32 ipmipmn_context_register_function(struct Ipmipmn_api_extension *srv);
|
||||
IP_GLOBAL void ipmipmn_msgext_vendor_parse_ext_register(struct Ipmip4_msgext_vendor_parse_ext *pext);
|
||||
IP_GLOBAL void ipmipmn_main(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,276 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_icmp.c,v $ $Revision: 1.6 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_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 "ipmipmn_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
#include "ipmipmn_h.h"
|
||||
#include "ipmipmn_if.h"
|
||||
#include "ipmipmn_pktbuf.h"
|
||||
#include "ipmipmn_icmp.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_icmp_input
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmipmn_icmp_input(Ipmipmn_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmipmn_pktbuf_t *pbuf)
|
||||
{
|
||||
Ipmip4_icmp_advert_t *pkt;
|
||||
int ret;
|
||||
Ipmip4_icmp_ext_advert_t *extadv;
|
||||
|
||||
/* Too short packet */
|
||||
if (IPMIP_BUFFER_SIZE(&pbuf->api.ipmip4.ipmip.packet) < sizeof(Ipmip4_icmp_advert_t))
|
||||
{
|
||||
IPCOM_LOG2(WARNING, "ADV ipcom_recvmsg() failed from '%s', short packet [length = %d]",
|
||||
ipmip_ntop_sa(proc, pbuf->api.ipmip4.ipmip.srcinfo.src),
|
||||
IPMIP_BUFFER_SIZE(&pbuf->api.ipmip4.ipmip.packet));
|
||||
return;
|
||||
}
|
||||
|
||||
/* We only listen on ICMP agent advertisements */
|
||||
pkt = IPMIP_BUFFER_PTR(&pbuf->api.ipmip4.ipmip.packet);
|
||||
|
||||
/* Sanity */
|
||||
if (pkt->adv_num_addrs > 0 && pkt->adv_addr_entry_size < 2)
|
||||
{
|
||||
IPCOM_LOG2(WARNING, "ADV ipcom_recvmsg() failed from '%s', short addr/pref [length = %d]",
|
||||
ipmip_ntop_sa(proc, pbuf->api.ipmip4.ipmip.srcinfo.src),
|
||||
pkt->adv_addr_entry_size);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = sizeof(Ipmip4_icmp_advert_t) + (pkt->adv_num_addrs * pkt->adv_addr_entry_size * 4);
|
||||
|
||||
/* Too short packet */
|
||||
if (IPMIP_BUFFER_SIZE(&pbuf->api.ipmip4.ipmip.packet) < (unsigned)ret)
|
||||
{
|
||||
IPCOM_LOG2(WARNING, "ADV ipcom_recvmsg() failed from '%s', short packet [length = %d]",
|
||||
ipmip_ntop_sa(proc, pbuf->api.ipmip4.ipmip.srcinfo.src),
|
||||
IPMIP_BUFFER_SIZE(&pbuf->api.ipmip4.ipmip.packet));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parse the message block */
|
||||
ret = ipmip4_msgext_icmp_parse(proc,
|
||||
pbuf->api.iff.pub->ipmip.ifname,
|
||||
pbuf->api.ipmip4.ipmip.srcinfo.src->sin.sin_addr.s_addr,
|
||||
&pbuf->api.ipmip4.ext.icmp,
|
||||
ipmip_buffer_offset(&pbuf->api.ipmip4.ipmip.packet, ret),
|
||||
IPMIP_BUFFER_SIZE(&pbuf->api.ipmip4.ipmip.packet) - ret);
|
||||
|
||||
/* Did the parse succeed? */
|
||||
if (ret != IPMIP4_REG_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
/* Is it a mobility advertisement? */
|
||||
if (pbuf->api.ipmip4.ext.icmp.agent == IP_NULL)
|
||||
return;
|
||||
|
||||
/* Retrieve the mobility advertisement */
|
||||
extadv = (Ipmip4_icmp_ext_advert_t *) pbuf->api.ipmip4.ext.icmp.agent;
|
||||
|
||||
/* Extract the advertised lifetime and flags */
|
||||
pbuf->api.advinfo.lifetime = IP_GET_NTOHS(&extadv->reg_lifetime);
|
||||
pbuf->api.advinfo.flags = IP_GET_NTOHS(&extadv->flags);
|
||||
pbuf->api.advinfo.adv_seq = IP_GET_NTOHS(&extadv->seq);
|
||||
|
||||
/*********** FOREIGN AGENT ADVERTISEMENT ***********/
|
||||
if (IP_BIT_ISTRUE(pbuf->api.advinfo.flags, IPMIP4_ICMP_ADVEXT_FLAG_FOREIGN_AGENT))
|
||||
{
|
||||
/* An FA agent adv is required to include at least one c/o-address */
|
||||
if (IPMIP4_MSGEXT_SHDR_EXT_SIZE(extadv) < 10)
|
||||
{
|
||||
IPCOM_LOG1(WARNING, "missing c/o address from '%s' FA",
|
||||
ipmip_ntop_sa(proc, pbuf->api.ipmip4.ipmip.srcinfo.src));
|
||||
return;
|
||||
}
|
||||
|
||||
pbuf->api.advinfo.coa = IP_GET_32ON8(&extadv->coa[0]);
|
||||
|
||||
IPCOM_LOG4(DEBUG, "received FA %sRtAdv #%d from '%s' [c/o=%s]",
|
||||
pbuf->api.ipmip4.ext.icmp.lla.found > 0? "Pr" : "",
|
||||
pbuf->api.advinfo.adv_seq,
|
||||
ipmip_ntop_sa(proc, pbuf->api.ipmip4.ipmip.srcinfo.src),
|
||||
ipmip_ntop_inet(proc, pbuf->api.advinfo.coa));
|
||||
|
||||
/* Lookup and init FA */
|
||||
ipmipmn_if_fa_adv(data, proc, pbuf);
|
||||
}
|
||||
/*********** HOME AGENT ADVERTISEMENT ***********/
|
||||
else if (IP_BIT_ISTRUE(pbuf->api.advinfo.flags, IPMIP4_ICMP_ADVEXT_FLAG_HOME_AGENT))
|
||||
{
|
||||
IPCOM_LOG2(DEBUG, "received HA RtAdv #%d from '%s'",
|
||||
pbuf->api.advinfo.adv_seq,
|
||||
ipmip_ntop_sa(proc, pbuf->api.ipmip4.ipmip.srcinfo.src));
|
||||
|
||||
/* Lookup and init FA */
|
||||
ipmipmn_if_ha_adv(data, proc, pbuf);
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_icmp_recv
|
||||
*===========================================================================
|
||||
* Description: Handles incoming advertisements or solicitations
|
||||
* Parameters: data - Context
|
||||
* proc - Current process.
|
||||
* pbuf - Packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmipmn_icmp_recv(struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_pktbuf_t *pbuf)
|
||||
{
|
||||
if (pbuf->api.ipmip4.ipmip.srcinfo.lladdr != IP_NULL)
|
||||
{
|
||||
Ipcom_icmp_header *icmph = IPMIP_BUFFER_PTR(&pbuf->api.ipmip4.ipmip.packet);
|
||||
|
||||
/* Truncated packet? */
|
||||
if (IPMIP_BUFFER_SIZE(&pbuf->api.ipmip4.ipmip.packet) < IPCOM_ICMP_HEADER_LENGTH)
|
||||
goto done_out;
|
||||
|
||||
if ((pbuf->api.iff.priv = ipmipmn_if_findbyindex(data, proc, pbuf->api.ipmip4.ipmip.srcinfo.dst->ifindex)) == IP_NULL)
|
||||
goto done_out;
|
||||
|
||||
switch (icmph->type)
|
||||
{
|
||||
case IPMIP4_ICMP_AGENT_ADVERTISEMENT:
|
||||
ipmipmn_icmp_input(data, proc, pbuf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Failure */
|
||||
IPCOM_LOG0(ERR,
|
||||
"NO MAC");
|
||||
}
|
||||
|
||||
done_out:
|
||||
/* Free the packet buffer */
|
||||
ipmip_pktbuf_release(&data->api.ipmip4.ipmip, proc, &pbuf->api.ipmip4.ipmip);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,107 @@
|
||||
/* ipmipmn_adv.h - ipmipmn_adv.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_icmp.h,v $ $Revision: 1.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_icmp.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-01 18:34:39 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPMN_ADV_H
|
||||
#define IPMIPMN_ADV_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmipmn_node;
|
||||
struct Ipmipmn_pktbuf;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_icmp_recv - ipmipmn_icmp_recv
|
||||
*
|
||||
* Handles incoming advertisements or solicitations
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Current process.
|
||||
* \i pbuf
|
||||
* Packet buffer
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_icmp_recv
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_pktbuf *pbuf
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,684 @@
|
||||
/* ipmipmn_if.h - ipmipmn_if.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_if.h,v $ $Revision: 1.12 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_if.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-01 18:34:39 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPMN_IF_H
|
||||
#define IPMIPMN_IF_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmip4_if.h>
|
||||
|
||||
#include <private/ipmipmn_api_coa.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIPMN_IFF_IDENTITY_MIP,
|
||||
IPMIPMN_IFF_IDENTITY_IFF
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIPMN_IFF_COA_HA_VERIFY_NONE,
|
||||
IPMIPMN_IFF_COA_HA_VERIFY_REQUEST,
|
||||
IPMIPMN_IFF_COA_HA_VERIFY_PENDING
|
||||
};
|
||||
|
||||
|
||||
#define ipmipmn_if_coa_valid(x) ((x)->next.head != IP_NULL)
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_context;
|
||||
struct Ipmipmn_pktbuf;
|
||||
struct Ipmip_proc;
|
||||
|
||||
typedef struct Ipmipmn_iff_notify
|
||||
{
|
||||
Ipcom_list if_next; /* Next notifier */
|
||||
|
||||
/* Info */
|
||||
Ipmip_timer_t timer;
|
||||
Ipmip_timer_func_t func;
|
||||
Ipmip_timer_lock_t *lock;
|
||||
void *obj;
|
||||
}
|
||||
Ipmipmn_iff_notify_t;
|
||||
|
||||
typedef struct Ipmipmn_api_iff
|
||||
{
|
||||
Ipmip4_if_t iff;
|
||||
|
||||
/**/
|
||||
Ip_bool down;
|
||||
Ip_bool admin_down;
|
||||
Ip_bool link_down;
|
||||
|
||||
/* CoA's currently available on this interface */
|
||||
Ipcom_list coa;
|
||||
int allocated;
|
||||
|
||||
/* Base for this interface */
|
||||
int sync_count;
|
||||
Ip_u32 references;
|
||||
Ipcom_list notifiers;
|
||||
|
||||
Ip_u32 timestamp;
|
||||
} Ipmipmn_iff_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_acquire - ipmipmn_if_acquire
|
||||
*
|
||||
* Acquire an instantiation of a interface
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Node context
|
||||
* \i proc
|
||||
* Current process
|
||||
* \i name
|
||||
* The name of the interface
|
||||
* \i notifier
|
||||
* Notifier callback structure.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: The pointer to the interface structure on success.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmipmn_iff_t * ipmipmn_if_acquire
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
const char *name,
|
||||
Ipmipmn_iff_notify_t *notifier
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_reference - ipmipmn_if_reference
|
||||
*
|
||||
* Reference an interface pointer
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Node context
|
||||
* \i proc
|
||||
* Current process
|
||||
* \i ifp
|
||||
* The interface
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: The pointer to the interface structure on success.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmipmn_iff_t * ipmipmn_if_reference
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_release - ipmipmn_if_release
|
||||
*
|
||||
* Release a previously acquired interface reference.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* The process
|
||||
* \i iff
|
||||
* Interface pointer.
|
||||
* \i notifier
|
||||
* Notifier callback structure
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE if the interface was destroyed; IP_FALSE otherwise.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmipmn_if_release
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *iff,
|
||||
Ipmipmn_iff_notify_t *notifier
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_update_coa - ipmipmn_if_update_coa
|
||||
*
|
||||
* Retrieve a secure address
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Mobile node data
|
||||
* \i proc
|
||||
* Process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: 0
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL int ipmipmn_if_update_coa
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_coa_get - ipmipmn_if_coa_get
|
||||
*
|
||||
* Retrieve a CoA of a specific type.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* Interface
|
||||
* \i addr
|
||||
* Address (may be 0)
|
||||
* \i type
|
||||
* Type of CoA
|
||||
* \i reason
|
||||
* Why are we looking for this CoA
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: The coa, it it exists.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmipmn_api_coa_t * ipmipmn_if_coa_get
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp,
|
||||
Ip_u32 addr,
|
||||
Ip_u32 type,
|
||||
const char *reason
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_coa_reference - ipmipmn_if_coa_reference
|
||||
*
|
||||
* Reference the CoA
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i coa
|
||||
* CoA
|
||||
* \i reason
|
||||
* Why do we reference this CoA
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: The CoA
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmipmn_api_coa_t * ipmipmn_if_coa_reference
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_api_coa_t *coa,
|
||||
const char *reason
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_coa_put - ipmipmn_if_coa_put
|
||||
*
|
||||
* Return a previously retrieved CoA
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* Interface
|
||||
* \i coa
|
||||
* CoA
|
||||
* \i reason
|
||||
* Reason
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE if the CoA was deleted.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmipmn_if_coa_put
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp,
|
||||
Ipmipmn_api_coa_t *coa,
|
||||
const char *reason
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_findbyindex - ipmipmn_if_findbyindex
|
||||
*
|
||||
* Find an existing interface by locating its index.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifindex
|
||||
* Interface index.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: A referenced handle to the interface. Must be returned by
|
||||
* release.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmipmn_iff_t * ipmipmn_if_findbyindex
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
int ifindex
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_fa_adv - ipmipmn_if_fa_adv
|
||||
*
|
||||
* Process a foreign agent advertisement and update any
|
||||
* foreign agent values.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i pbuf
|
||||
* Packet buffer.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_if_fa_adv
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_pktbuf *pbuf
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_ha_adv_verify - ipmipmn_if_ha_adv_verify
|
||||
*
|
||||
* Do home agent verification; if there's been a 'silent' roam
|
||||
* we need to discover it.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* The interface
|
||||
* \i ha
|
||||
* The home agent.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE if it should be verified
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmipmn_if_ha_adv_verify
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp,
|
||||
Ipmipmn_api_coa_t *ha
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_ha_adv - ipmipmn_if_ha_adv
|
||||
*
|
||||
* Process a home agent advertisement and update any
|
||||
* home agent values.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i pbuf
|
||||
* Packet buffer.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_if_ha_adv
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_pktbuf *pbuf
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_fa_arp - ipmipmn_if_fa_arp
|
||||
*
|
||||
* Process an ARP reply and update any
|
||||
* foreign agent values.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i pbuf
|
||||
* Packet buffer.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_if_fa_arp
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_pktbuf *pbuf
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_coa_fa_llh - ipmipmn_if_coa_fa_llh
|
||||
*
|
||||
* Turn a LLH coa into a usable directly connected one.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* The interface
|
||||
* \i llh_coa
|
||||
* LLH CoA
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: A new freshly allocated direct CoA
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmipmn_api_coa_t * ipmipmn_if_coa_fa_llh
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp,
|
||||
Ipmipmn_api_coa_t *llh_coa
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_coa_ike_reconfigure - ipmipmn_if_coa_ike_reconfigure
|
||||
*
|
||||
* Request a re-configuration of IKE if required.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* Interface
|
||||
* \i coa
|
||||
* Care of Address.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE if we've send a reconfig signal
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmipmn_if_coa_ike_reconfigure
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp,
|
||||
Ipmipmn_api_coa_t *coa
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_coa_ike_mobility - ipmipmn_if_coa_ike_mobility
|
||||
*
|
||||
* Request an IKE mobility movement
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* Interface
|
||||
* \i coa
|
||||
* Care of Address.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE if we found something to move.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmipmn_if_coa_ike_mobility
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp,
|
||||
Ipmipmn_api_coa_t *coa
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_admin_down - ipmipmn_if_admin_down
|
||||
*
|
||||
* Bring an interface administratively down.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* The interface
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_if_admin_down
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_if_admin_up - ipmipmn_if_admin_up
|
||||
*
|
||||
* Bring an interface administratively up
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i ifp
|
||||
* The interface
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_if_admin_up
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_iff_t *ifp
|
||||
);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,489 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_main.c,v $ $Revision: 1.7.10.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_main.c,v $
|
||||
* $Author: jsheng $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Lennart Bang <lob@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
* Implementation of Mobile Node for IPNET.
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmipmn_config.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_shell.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_cli.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include "ipmipmn_h.h"
|
||||
#include "ipmipmn_icmp.h"
|
||||
#include "ipmipmn_node.h"
|
||||
#include "ipmipmn_route.h"
|
||||
#include "ipmipmn_pkt.h"
|
||||
#include "ipmipmn_reg.h"
|
||||
#include "ipmipmn_pktbuf.h"
|
||||
#include "ipmipmn_attr_h.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_err ipmipmn_init(void);
|
||||
IP_PUBLIC Ip_err ipmipmn_exit(void);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Global IPMIPMN data
|
||||
*===========================================================================
|
||||
* All global IPMIPMN data is located in this structure.
|
||||
*/
|
||||
|
||||
IP_STATIC Ip_u32 ipmipmn_instances = 0;
|
||||
static Ipcom_once_t ipmipmn_extensions_once = IPCOM_ONCE_INIT;
|
||||
static Ipmipmn_api_function_context_t ipmipmn_extensions;
|
||||
static Ipcom_list ipmipmn_msgext_vendor_extensions;
|
||||
static Ipmip_pktbuf_pktaux_t ipmipmn_pktaux;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC Ip_err
|
||||
ipmipmn_main_once_init(void *unused)
|
||||
{
|
||||
int f;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(unused);
|
||||
|
||||
/* Clear */
|
||||
ipcom_memset(&ipmipmn_extensions, 0, sizeof(ipmipmn_extensions));
|
||||
ipcom_memset(&ipmipmn_pktaux, 0, sizeof(ipmipmn_pktaux));
|
||||
ipcom_list_init(&ipmipmn_msgext_vendor_extensions);
|
||||
|
||||
/* Must be first */
|
||||
ipmipmn_reg_register_service();
|
||||
|
||||
/* Indicate the elements */
|
||||
/* Do service init */
|
||||
for (f = 0; ipmipmn_function_registrations[f] != IP_NULL; f++)
|
||||
(*ipmipmn_function_registrations[f]) ();
|
||||
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_ipd_input
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmipmn_ipd_input(Ipmipmn_context_t *data,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
Ipmipmn_pktbuf_t *pbuf = (Ipmipmn_pktbuf_t *)ipmip_pktbuf_alloc(&data->api.ipmip4.ipmip, proc, 512);
|
||||
int event;
|
||||
Ip_ssize_t len;
|
||||
|
||||
if (pbuf == IP_NULL)
|
||||
return IP_TRUE;
|
||||
|
||||
len = ipcom_ipd_read(data->api.fd_ipd, IPMIP_BUFFER_PTR(&pbuf->api.ipmip4.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(data->api.fd_ipd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Advance past */
|
||||
ipmip_buffer_append(&pbuf->api.ipmip4.ipmip.packet, IP_NULL, len);
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case IPCOM_IPD_EVENT_RECONFIGURE:
|
||||
IPCOM_LOG0(INFO, "Received IPD reconfigure message");
|
||||
ipmipmn_node_reconfigure(data, proc);
|
||||
break;
|
||||
|
||||
case IPCOM_IPD_EVENT_KILL:
|
||||
IPCOM_LOG0(INFO, "Received IPD kill message");
|
||||
ipmip_pktbuf_release(&data->api.ipmip4.ipmip, proc, &pbuf->api.ipmip4.ipmip);
|
||||
return IP_FALSE;
|
||||
|
||||
case IPCOM_IPD_EVENT_NONE:
|
||||
break;
|
||||
default:
|
||||
/* Ignore all other IPD messages */
|
||||
IPCOM_LOG1(DEBUG, "Received unknown IPD message %d", event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ipmip_pktbuf_release(&data->api.ipmip4.ipmip, proc, &pbuf->api.ipmip4.ipmip);
|
||||
return IP_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_exit_data
|
||||
*===========================================================================
|
||||
* Description: Exit IPMIPMN.
|
||||
* Parameters: .
|
||||
* Returns: .
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmipmn_exit_data(Ipmipmn_context_t *data,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
Ipmipmn_iff_t *iff;
|
||||
|
||||
/* Stop the route context */
|
||||
ipmipmn_route_context_stop(data, proc);
|
||||
|
||||
/* Stop the context */
|
||||
ipmip4_context_stop(&data->api.ipmip4, proc);
|
||||
|
||||
/* Destroy the route context */
|
||||
ipmipmn_route_context_destroy(data, proc);
|
||||
|
||||
/**/
|
||||
if (data->node)
|
||||
ipmipmn_api_node_destroy(&data->api, proc, &data->node->api);
|
||||
|
||||
/* Delete interface list */
|
||||
while ((iff = IPCOM_LIST_FIRST(&data->ifhead)) != IP_NULL)
|
||||
ipmipmn_if_release(data, proc, iff, IP_NULL);
|
||||
|
||||
if (data->api.fd_ipd == IP_INVALID_SOCKET)
|
||||
(void)ipcom_ipd_init("ipmipmn", IPCOM_ERR_FAILED, &data->api.fd_ipd);
|
||||
|
||||
ipcom_ipd_exit("ipmipmn", data->api.fd_ipd);
|
||||
|
||||
/* REMOVE ROUTE */
|
||||
/**/
|
||||
ipmip_timer_lock_destroy(&data->api.ipmip4.ipmip, proc, data->iflock);
|
||||
|
||||
/* Free the context */
|
||||
ipmip4_context_destroy(&data->api.ipmip4, proc);
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_init
|
||||
*===========================================================================
|
||||
* Description: Initialize IPMIPMN.
|
||||
* Parameters: .
|
||||
* Returns: .
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ipmipmn_context_t *
|
||||
ipmipmn_init_data(Ipmip_proc_t *proc)
|
||||
{
|
||||
Ipmipmn_context_t *data;
|
||||
|
||||
(void)IPMIP_ONCE(&ipmipmn_extensions_once, ipmipmn_main_once_init, IP_NULL);
|
||||
|
||||
data = (Ipmipmn_context_t*)ipmip_context_alloc(proc, sizeof(*data), "ipmipmn", IPMIP4_SYSTEM_PRIORITY, IPMIPMN_EVENT_BACKLOG);
|
||||
|
||||
/* Failed to allocate, exit */
|
||||
if (data == IP_NULL)
|
||||
return IP_NULL;
|
||||
|
||||
/* Add */
|
||||
data->api.functions = &ipmipmn_extensions;
|
||||
data->api.ipmip4.vendor_extensions = &ipmipmn_msgext_vendor_extensions;
|
||||
data->api.ipmip4.ipmip.pktaux = &ipmipmn_pktaux;
|
||||
|
||||
ipmip4_context_init(&data->api.ipmip4, proc);
|
||||
|
||||
ipcom_list_init(&data->ifhead);
|
||||
|
||||
/**/
|
||||
data->iflock = ipmip_timer_lock_alloc(&data->api.ipmip4.ipmip, proc, IP_NULL, IP_NULL);
|
||||
if(IP_NULL == data->iflock)
|
||||
goto fail;
|
||||
|
||||
/* IPD init */
|
||||
if (ipcom_ipd_init("ipmipmn", IPCOM_SUCCESS, &data->api.fd_ipd) != IPCOM_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
|
||||
ipmipmn_api_init(&data->api,
|
||||
proc,
|
||||
&ipmipmn_node_func,
|
||||
&ipmipmn_node_state_func);
|
||||
|
||||
|
||||
/**/
|
||||
ipmip_cli_context_create(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"ipmipmn",
|
||||
IPCOM_IPD_ID_IPMIPMN,
|
||||
(Ipmip_cli_callback_t)ipmipmn_attr_command);
|
||||
|
||||
/* Create the packet buffer context */
|
||||
ipmip_pktbuf_context_create(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
(Ipmip_pkt_buf_alloc_t)ipmipmn_pktbuf_alloc,
|
||||
(Ipmip_pkt_buf_free_t)ipmipmn_pktbuf_free);
|
||||
|
||||
/**/
|
||||
if (!ipmip4_pkt_context_create(&data->api.ipmip4,
|
||||
proc,
|
||||
IPMIP4_PKT_PKT_IN|IPMIP4_PKT_PKT_OUT|IPMIP4_PKT_ICMP_IN,
|
||||
(Ipmip4_pkt_udp_cb_t)ipmipmn_reg_recv,
|
||||
(Ipmip4_pkt_icmp_cb_t)ipmipmn_icmp_recv,
|
||||
(Ipmip4_pkt_packet_cb_t)ipmipmn_pkt_recv))
|
||||
goto fail;
|
||||
|
||||
ipmipmn_route_context_alloc(data, proc);
|
||||
|
||||
/* Create the node */
|
||||
data->node = ipmipmn_node_alloc(data, proc, "");
|
||||
|
||||
ipmip_netlink_context_create(&data->api.ipmip4.ipmip, proc, (Ipmip_netlink_callback_t)ipmipmn_netlink_process);
|
||||
|
||||
/**/
|
||||
ipmip4_context_start(&data->api.ipmip4, proc);
|
||||
|
||||
/* */
|
||||
ipmipmn_route_context_start(data, proc);
|
||||
return data;
|
||||
|
||||
fail:
|
||||
ipmipmn_exit_data(data, proc);
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmnd
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmipmn_main(void)
|
||||
{
|
||||
int num;
|
||||
int max_fd;
|
||||
Ip_fd_set read_set;
|
||||
Ipmipmn_context_t *data;
|
||||
char icmp_redirect[8];
|
||||
Ip_size_t size = sizeof(icmp_redirect);
|
||||
Ipmip_proc_t *proc;
|
||||
|
||||
ipcom_proc_init();
|
||||
|
||||
proc = ipmip_proc_alloc();
|
||||
if(IP_NULL == proc)
|
||||
{
|
||||
ipcom_proc_exit();
|
||||
return;
|
||||
}
|
||||
|
||||
IPCOM_LOG0(INFO, "IPMIPMND starting");
|
||||
|
||||
|
||||
/* Is this the first instance? */
|
||||
if (ipmipmn_instances++ == 0)
|
||||
ipmipmn_init();
|
||||
|
||||
ipcom_sysvar_get("ipnet.inet.IcmpRedirectSend",
|
||||
icmp_redirect,
|
||||
&size);
|
||||
|
||||
/**/
|
||||
if (ipcom_sysvar_set("ipnet.inet.IcmpRedirectSend", "0", IPCOM_SYSVAR_FLAG_OVERWRITE) != IPCOM_SUCCESS)
|
||||
goto ending;
|
||||
|
||||
|
||||
/* Create and initialize this instance's data structure */
|
||||
if ((data = ipmipmn_init_data(proc)) == IP_NULL)
|
||||
goto ending;
|
||||
|
||||
ipmipmn_node_reconfigure(data, proc);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
IP_FD_ZERO(&read_set);
|
||||
IP_FD_SET(data->api.fd_ipd, &read_set);
|
||||
max_fd = data->api.fd_ipd;
|
||||
|
||||
num = ipcom_socketselect(max_fd + 1, &read_set, IP_NULL, IP_NULL, IP_NULL);
|
||||
switch(num)
|
||||
{
|
||||
case -1:
|
||||
/* socket error */
|
||||
IPCOM_LOG1(WARNING, "ipcom_socketselect() failed, errno = %d", 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;
|
||||
|
||||
/* got packet */
|
||||
default:
|
||||
/* IPD input */
|
||||
if (IP_FD_ISSET(data->api.fd_ipd, &read_set))
|
||||
if (ipmipmn_ipd_input(data, proc) == IP_FALSE)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
/* Free the data structure */
|
||||
ipmipmn_exit_data(data, proc);
|
||||
|
||||
ending:
|
||||
/* Last instance? */
|
||||
if (--ipmipmn_instances == 0)
|
||||
ipmipmn_exit();
|
||||
|
||||
ipcom_sysvar_set("ipnet.inet.IcmpRedirectSend",
|
||||
icmp_redirect,
|
||||
IPCOM_SYSVAR_FLAG_OVERWRITE);
|
||||
|
||||
/* Free the context process */
|
||||
ipmip_proc_destroy(proc);
|
||||
|
||||
IPCOM_LOG0(INFO, "IPMIPMND ending");
|
||||
ipcom_proc_exit();
|
||||
}
|
||||
|
||||
|
||||
/* INIT FUNCTIONS */
|
||||
IP_GLOBAL Ip_u32
|
||||
ipmipmn_context_register_function(Ipmipmn_api_extension_t *srv)
|
||||
{
|
||||
Ip_u32 type = ipmipmn_extensions.num++;
|
||||
|
||||
/* Store values */
|
||||
srv->type = type;
|
||||
|
||||
ipmipmn_extensions.mask |= (1 << type);
|
||||
|
||||
ipmipmn_extensions.functions[type] = srv;
|
||||
ipmipmn_extensions.node_data += srv->node_data_size;
|
||||
|
||||
/* Register payload, if requested */
|
||||
if (srv->pktaux.pktbuf_data_size != 0)
|
||||
ipmip_pktbuf_pktaux_add(&ipmipmn_pktaux, &srv->pktaux);
|
||||
|
||||
/* Return the type */
|
||||
return type;
|
||||
}
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmipmn_msgext_vendor_parse_ext_register(struct Ipmip4_msgext_vendor_parse_ext *pext)
|
||||
{
|
||||
/**/
|
||||
ipmip4_msgext_vendor_parse_ext_register(&ipmipmn_msgext_vendor_extensions, &ipmipmn_pktaux, pext);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,240 @@
|
||||
/* ipmipmn_node.h - ipmipmn_node.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_node.h,v $ $Revision: 1.21 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_node.h,v $
|
||||
* $Author: ulf $ $Date: 2009-06-08 11:05:54 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPMN_NODE_H
|
||||
#define IPMIPMN_NODE_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmipmn_api_node.h>
|
||||
#include "ipmipmn_if.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIPMN_NODE_IFP_SOLICIT_DONE = 0,
|
||||
IPMIPMN_NODE_IFP_SOLICIT_MAY = 1,
|
||||
IPMIPMN_NODE_IFP_SOLICIT_REQUIRED = 2
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/* Changing the config data below requires a complete reboot */
|
||||
typedef struct Ipmipmn_node_conf_primary
|
||||
{
|
||||
Ip_u32 home_address; /* home address */
|
||||
Ip_u32 home_netmask; /* home network mask */
|
||||
Ip_u32 home_gateway; /* home network mask */
|
||||
Ip_bool reordering;
|
||||
|
||||
/* Dynamically allocated data below this line */
|
||||
Ipmip4_msgext_uhdr_t *nai_mn;
|
||||
int *coa_lookup;
|
||||
}
|
||||
Ipmipmn_node_conf_primary_t;
|
||||
|
||||
|
||||
/* Changing this config data allows current connections to survive */
|
||||
typedef struct Ipmipmn_node_conf_secondary
|
||||
{
|
||||
Ip_bool nat_t;
|
||||
Ip_bool nat_t_forced;
|
||||
Ip_bool ipike_reconfigure;
|
||||
Ip_bool ipike_mobility;
|
||||
Ip_bool revocation;
|
||||
Ip_bool simbind;
|
||||
Ip_u16 nat_t_keepalive;
|
||||
Ip_s8 nat_t_tunnel;
|
||||
Ip_s8 tunneltype;
|
||||
int mtu;
|
||||
int solicitations;
|
||||
|
||||
/* Dynamically allocated data below this line */
|
||||
char *ifname;
|
||||
}
|
||||
Ipmipmn_node_conf_secondary_t;
|
||||
|
||||
typedef struct Ipmipmn_node_conf
|
||||
{
|
||||
Ipmipmn_api_node_conf_t api;
|
||||
|
||||
Ipmipmn_node_conf_primary_t primary;
|
||||
Ipmipmn_node_conf_secondary_t secondary;
|
||||
|
||||
char **excluded;
|
||||
|
||||
} Ipmipmn_node_conf_t;
|
||||
|
||||
|
||||
struct Ipmipmn_route_node;
|
||||
typedef struct Ipmipmn_node
|
||||
{
|
||||
/* Generic Node */
|
||||
Ipmipmn_api_node_t api;
|
||||
Ipmipmn_node_conf_t *conf;
|
||||
|
||||
|
||||
/* Configuration name */
|
||||
char *name;
|
||||
|
||||
/* Policy, tunnel and routes */
|
||||
struct Ipmipmn_route_node *route;
|
||||
|
||||
Ipmipmn_iff_notify_t mnRegIFPNotifier;
|
||||
int mnRegIFPSyncCounter;
|
||||
Ip_u8 mnRegIFPSolicit;
|
||||
Ipmipmn_api_coa_t *mnRegLastCoA;
|
||||
Ipmip_timer_t mnProbeTimer;
|
||||
} Ipmipmn_node_t;
|
||||
|
||||
|
||||
extern Ipmipmn_api_node_functable_t ipmipmn_node_func;
|
||||
extern Ipmipmn_api_node_state_functable_t ipmipmn_node_state_func;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_node_reconfigure - ipmipmn_node_reconfigure
|
||||
*
|
||||
* Reconfigure the nodes in the context
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The context
|
||||
* \i proc
|
||||
* The process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_node_reconfigure
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_node_alloc - ipmipmn_node_alloc
|
||||
*
|
||||
* Create a node.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i name
|
||||
* Node name
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: The allocated node.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmipmn_node_t * ipmipmn_node_alloc
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
const char *name
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_node_init_coa - ipmipmn_node_init_coa
|
||||
*
|
||||
* Init parameters for a new CoA
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i node
|
||||
* The Node
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_node_init_coa
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_node_t *node
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,174 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_pkt.c,v $ $Revision: 1.7 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_pkt.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 "ipmipmn_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipnet_routesock.h>
|
||||
#include <ipnet_eth.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include "ipmipmn_h.h"
|
||||
#include "ipmipmn_pktbuf.h"
|
||||
#include "ipmipmn_pkt.h"
|
||||
#include "ipmipmn_if.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_pkt_recv
|
||||
*===========================================================================
|
||||
* Description: Handles incoming ARP's
|
||||
* Parameters: data - Context
|
||||
* proc - Current process.
|
||||
* pbuf - Packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmipmn_pkt_recv(struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_pktbuf_t *pbuf)
|
||||
{
|
||||
if (pbuf->api.ipmip4.ipmip.srcinfo.ll != IP_NULL)
|
||||
{
|
||||
Ipnet_pkt_arp *arp;
|
||||
|
||||
if ((pbuf->api.iff.priv = ipmipmn_if_findbyindex(data, proc, pbuf->api.ipmip4.ipmip.srcinfo.ll->sll_ifindex)) == IP_NULL)
|
||||
goto done_out;
|
||||
|
||||
/* Do not accept packets less than 'arp' size */
|
||||
if (IPMIP_BUFFER_SIZE(&pbuf->api.ipmip4.ipmip.packet) < sizeof(*arp))
|
||||
goto done_out;
|
||||
|
||||
/* */
|
||||
arp = (Ipnet_pkt_arp *) IPMIP_BUFFER_DATA(&pbuf->api.ipmip4.ipmip.packet);
|
||||
|
||||
/* Only bother with the reply */
|
||||
if (arp->op == IPNET_ARP_OP_REPLY)
|
||||
{
|
||||
pbuf->api.advinfo.coa = IP_GET_32ON16(arp->ip_src);
|
||||
|
||||
ipmip_lladdr_build((Ipmip_lladdr_t *)proc->ntop.ntop_pbuf,
|
||||
IPMIP_LLADDR_TYPE_MAC,
|
||||
0,
|
||||
arp->eth_src,
|
||||
IPMIP_ETH_ADDR_SIZE);
|
||||
|
||||
ipmip_util_dup(&pbuf->api.ipmip4.ipmip.srcinfo.lladdr,
|
||||
proc->ntop.ntop_pbuf,
|
||||
IPMIP_LLADDR_LEN(proc->ntop.ntop_pbuf));
|
||||
ipmipmn_if_fa_arp(data, proc, pbuf);
|
||||
}
|
||||
}
|
||||
|
||||
done_out:
|
||||
/* Free the packet buffer */
|
||||
ipmip_pktbuf_release(&data->api.ipmip4.ipmip, proc, &pbuf->api.ipmip4.ipmip);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,104 @@
|
||||
/* ipmipmn_pkt.h - ipmipmn_pkt.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_pkt.h,v $ $Revision: 1.6 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_pkt.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-01 18:34:39 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPMN_PKT_H
|
||||
#define IPMIPMN_PKT_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_data;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmipmn_pktbuf;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_pkt_recv - ipmipmn_pkt_recv
|
||||
*
|
||||
* Handles incoming ARP's
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Current process.
|
||||
* \i pbuf
|
||||
* Packet buffer
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_pkt_recv
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_pktbuf *pbuf
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,403 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_reg.c,v $ $Revision: 1.29.16.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_reg.c,v $
|
||||
* $Author: jsheng $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmipmn_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include "ipmipmn.h"
|
||||
#include "ipmipmn_h.h"
|
||||
#include "ipmipmn_attr.h"
|
||||
#include "ipmipmn_route.h"
|
||||
#include "ipmipmn_node.h"
|
||||
#include "ipmipmn_reg.h"
|
||||
#include "ipmipmn_icmp.h"
|
||||
#include "ipmipmn_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC void
|
||||
ipmipmn_reg_output_mobile_home(struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_node_conf *conf,
|
||||
void *inst_config,
|
||||
void *node_config,
|
||||
struct Ipmipmn_node *node,
|
||||
Ip_bool deregister,
|
||||
struct Ipmipmn_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(inst_config);
|
||||
IPMIP_UNUSED_PARAMETER(node_config);
|
||||
|
||||
pbuf->api.iff.priv = ipmipmn_if_reference(data, proc, (Ipmipmn_iff_t *)node->api.params.pubIf);
|
||||
if (node->api.params.mnRegCoA->peer != IPMIPMN_ATTR_PEER_FOREIGN_AGENT && !deregister)
|
||||
{
|
||||
if (conf->secondary.nat_t)
|
||||
{
|
||||
Ipmip4_reg_ext_udp_tunnel_req_t udpreq;
|
||||
ipcom_memset(&udpreq, 0, sizeof(udpreq));
|
||||
|
||||
udpreq.type = IPMIP4_EXT_TYPE_UDP_TUNNEL_REQ;
|
||||
udpreq.length = 6;
|
||||
udpreq.encap = ipmip_util_tunnel_to_proto(conf->secondary.nat_t_tunnel);
|
||||
|
||||
/* Do we want to force NAT-T? */
|
||||
if (conf->secondary.nat_t_forced)
|
||||
udpreq.flags = IPMIP4_REG_EXT_UDP_FLAG_FORCED;
|
||||
|
||||
IP_BIT_SET(pbuf->api.reginfo.mnRegTunnelFlags, IPMIP4_TUNNELMODE_NAT_T_REQUESTED);
|
||||
ipmip4_msgext_buffer_append_shdr(&pbuf->api.ipmip4.ipmip.packet, (Ipmip4_msgext_uhdr_t *)&udpreq);
|
||||
}
|
||||
|
||||
if (conf->secondary.revocation)
|
||||
{
|
||||
Ipmip4_reg_ext_revocation_t rev_req;
|
||||
ipcom_memset(&rev_req, 0, sizeof(rev_req));
|
||||
|
||||
rev_req.type = IPMIP4_EXT_TYPE_REVOCATION;
|
||||
rev_req.length = sizeof(rev_req) - 2;
|
||||
rev_req.timestamp = ipmip4_util_now();
|
||||
rev_req.timestamp = ip_htonl(rev_req.timestamp);
|
||||
|
||||
/* */
|
||||
rev_req.flags |= ip_htons(IPMIP4_REG_EXT_REVOCATION_INFORM);
|
||||
|
||||
IP_BIT_SET(pbuf->api.reginfo.mnRegTunnelFlags, IPMIP4_TUNNELMODE_REVOCATION_REQUESTED);
|
||||
ipmip4_msgext_buffer_append_shdr(&pbuf->api.ipmip4.ipmip.packet, (void *)&rev_req);
|
||||
}
|
||||
}
|
||||
|
||||
if (conf->secondary.simbind)
|
||||
{
|
||||
Ipmip4_regreq_t *reqhdr;
|
||||
|
||||
reqhdr = IPMIP_BUFFER_PTR(&pbuf->api.ipmip4.ipmip.packet);
|
||||
reqhdr->code |= IPMIP4_CODE_REQ_SIM_BINDINGS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmipmn_reg_input_verify(struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_node_conf *conf,
|
||||
void *inst_config,
|
||||
void *node_config,
|
||||
struct Ipmipmn_node *node,
|
||||
struct Ipmipmn_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(inst_config);
|
||||
IPMIP_UNUSED_PARAMETER(conf);
|
||||
IPMIP_UNUSED_PARAMETER(node_config);
|
||||
|
||||
if (pbuf->api.iff.priv == IP_NULL)
|
||||
{
|
||||
if (pbuf->api.ipmip4.ipmip.srcinfo.dst->ifindex != ipmipmn_route_node_get_tunnel_index(data, proc, node->route))
|
||||
{
|
||||
ipmip_pktbuf_error(&pbuf->api.ipmip4.ipmip,
|
||||
0,
|
||||
"Interface doesn't match current tunnel interface; received on unknown interface %s(%u)",
|
||||
ipcom_if_indextoname(pbuf->api.ipmip4.ipmip.srcinfo.dst->ifindex, proc->ntop.ntop_pbuf), pbuf->api.ipmip4.ipmip.srcinfo.dst->ifindex);
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
pbuf->api.iff.priv = ipmipmn_if_reference(data, proc, (Ipmipmn_iff_t *)node->api.params.pubIf);
|
||||
}
|
||||
|
||||
if (node->api.params.mnRegCoA->peer == IPMIPMN_ATTR_PEER_HOME_AGENT)
|
||||
{
|
||||
if (pbuf->api.ipmip4.ext.mobile.udp_tunnel_rep && IPMIP4_MSGEXT_AUTHENTICATED(pbuf->api.ipmip4.ext.mobile.udp_tunnel_rep, pbuf->api.ipmip4.ext.mobile.mobile_home))
|
||||
{
|
||||
/* Process a UDP tunnel reply */
|
||||
Ipmip4_reg_ext_udp_tunnel_rep_t *udprep = (Ipmip4_reg_ext_udp_tunnel_rep_t *)pbuf->api.ipmip4.ext.mobile.udp_tunnel_rep;
|
||||
|
||||
/* Only valid in COLOCATED mode */
|
||||
if (udprep->code < 64)
|
||||
{
|
||||
/* Need to flag that we're about to use UDP tunneling; */
|
||||
IPMIP4_EVENT_IF(DEBUG2, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"%s UDP NAT-T request accept received from '%s' HA",
|
||||
IPMIPMN_API_NODE_NAME(&data->api, proc, &node->api),
|
||||
ipmip_ntop_inet(proc, pbuf->api.pktinfo.mnRegHomeAgentAddress)));
|
||||
|
||||
/* Store the values */
|
||||
pbuf->api.pktinfo.mnRegNATTraversalKeepAlive = IP_GET_NTOHS(&udprep->keep_alive);
|
||||
|
||||
/* Switch to NAT-T tunnel type if set */
|
||||
if (conf->secondary.nat_t_tunnel != IPMIP_TUNNELTYPE_NONE)
|
||||
pbuf->api.reginfo.mnRegTunnelType = conf->secondary.nat_t_tunnel;
|
||||
|
||||
IP_BIT_SET(pbuf->api.reginfo.mnRegTunnelFlags, IPMIP4_TUNNELMODE_NAT_T_RECEIVED);
|
||||
|
||||
/* Sanity */
|
||||
if (pbuf->api.pktinfo.mnRegNATTraversalKeepAlive == 0)
|
||||
pbuf->api.pktinfo.mnRegNATTraversalKeepAlive = node->conf->secondary.nat_t_keepalive;
|
||||
if (pbuf->api.pktinfo.mnRegNATTraversalKeepAlive < 10)
|
||||
pbuf->api.pktinfo.mnRegNATTraversalKeepAlive = 10;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmipmn_reg_input_success(struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_node_conf *conf,
|
||||
void *inst_config,
|
||||
void *node_config,
|
||||
struct Ipmipmn_node *node,
|
||||
struct Ipmipmn_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(inst_config);
|
||||
IPMIP_UNUSED_PARAMETER(conf);
|
||||
IPMIP_UNUSED_PARAMETER(node_config);
|
||||
|
||||
/* Successful registration */
|
||||
if (node->api.params.mnRegCoA->type == IPMIPMN_ATTR_COA_FA_LLH)
|
||||
{
|
||||
/**/
|
||||
node->api.params.mnRegCoA = ipmipmn_if_coa_fa_llh(data, proc, (Ipmipmn_iff_t *)node->api.params.pubIf, node->api.params.mnRegCoA);
|
||||
if(IP_NULL == node->api.params.mnRegCoA)
|
||||
return;
|
||||
|
||||
/* MUST UPDATE THE ROUTING PARAMETERS */
|
||||
ipmipmn_route_node_lla(data, proc, node->route, node->api.params.mnRegCoA->params.fa.lladdr);
|
||||
|
||||
/**/
|
||||
node->api.params.mnRegLowLatency = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/**/
|
||||
node->api.params.mnRegLowLatency = 0;
|
||||
}
|
||||
|
||||
/* Set the tunnel type */
|
||||
ipmipmn_route_node_tunnel_type(data, proc, node->route, pbuf->api.reginfo.mnRegTunnelType, node->conf->primary.reordering, node->conf->secondary.mtu);
|
||||
ipmipmn_route_node_tunnel_nat(data,
|
||||
proc,
|
||||
node->route,
|
||||
IP_BIT_ARESET(pbuf->api.reginfo.mnRegTunnelFlags, IPMIP4_TUNNELMODE_NAT_T_CONFIRMED),
|
||||
pbuf->api.pktinfo.mnRegNATTraversalKeepAlive);
|
||||
|
||||
node->api.params.mnRegTunnelType = pbuf->api.reginfo.mnRegTunnelType;
|
||||
|
||||
/* Assign our home agent */
|
||||
if (node->api.params.assigned_home_agent == 0)
|
||||
{
|
||||
/**/
|
||||
node->api.params.pending_home_agent = pbuf->api.pktinfo.mnRegHomeAgentAddress;
|
||||
node->api.params.assigned_home_agent = node->api.params.pending_home_agent;
|
||||
ipmipmn_route_node_home_agent(data,
|
||||
proc,
|
||||
node->route,
|
||||
node->api.params.assigned_home_agent);
|
||||
|
||||
|
||||
IPMIP4_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"%s home agent assigned to '%s'",
|
||||
IPMIPMN_API_NODE_NAME(&data->api, proc, &node->api),
|
||||
ipmip_ntop_inet(proc, node->api.params.assigned_home_agent)));
|
||||
}
|
||||
|
||||
/* Accepted */
|
||||
if (node->api.params.assigned_home_address == 0)
|
||||
{
|
||||
/* OK; ADDRESS located, store it and configure our interface */
|
||||
node->api.params.assigned_home_address = pbuf->api.pktinfo.mnRegHomeAddress;
|
||||
node->api.params.pending_home_address = pbuf->api.pktinfo.mnRegHomeAddress;
|
||||
|
||||
IPMIP4_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"%s configured with home address '%s' from '%s' HA",
|
||||
IPMIPMN_API_NODE_NAME(&data->api, proc, &node->api),
|
||||
ipmip_ntop_inet(proc, pbuf->api.pktinfo.mnRegHomeAddress),
|
||||
ipmip_ntop_inet(proc, node->api.params.assigned_home_agent)));
|
||||
|
||||
/**/
|
||||
ipmipmn_route_node_home_address(data, proc, node->route, node->api.params.assigned_home_address, node->conf->primary.home_netmask, node->conf->primary.home_gateway);
|
||||
|
||||
ipmip_timer_cancel(&data->api.ipmip4.ipmip, proc, &node->mnRegIFPNotifier.timer);
|
||||
ipmip_timer_request(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
&node->mnRegIFPNotifier.timer,
|
||||
node->mnRegIFPNotifier.lock,
|
||||
node->mnRegIFPNotifier.func,
|
||||
node->mnRegIFPNotifier.obj,
|
||||
IP_NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
/* Store last registered CoA */
|
||||
if (node->mnRegLastCoA && node->mnRegLastCoA != node->api.params.mnRegCoA)
|
||||
{
|
||||
ipmipmn_if_coa_put(data, proc, (Ipmipmn_iff_t *)node->api.params.pubIf, node->mnRegLastCoA, "New CoA Successfully Registered");
|
||||
node->mnRegLastCoA = IP_NULL;
|
||||
}
|
||||
|
||||
if (node->mnRegLastCoA == IP_NULL)
|
||||
node->mnRegLastCoA = ipmipmn_if_coa_reference(data, proc, node->api.params.mnRegCoA, "Successful Registration");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmipmn_reg_register_service(void)
|
||||
{
|
||||
static Ipmipmn_api_extension_t ipmipmn_node_ext;
|
||||
|
||||
ipcom_memset(&ipmipmn_node_ext, 0, sizeof(ipmipmn_node_ext));
|
||||
|
||||
ipmipmn_node_ext.name = "REGISTER";
|
||||
ipmipmn_node_ext.pkt_req_mobile_home = (Ipmipmn_api_extension_pkt_req_mobile_home_t)ipmipmn_reg_output_mobile_home;
|
||||
ipmipmn_node_ext.pkt_rep_validate = (Ipmipmn_api_extension_pkt_rep_validate_t)ipmipmn_reg_input_verify;
|
||||
ipmipmn_node_ext.pkt_rep_accepted = (Ipmipmn_api_extension_pkt_rep_accepted_t)ipmipmn_reg_input_success;
|
||||
ipmipmn_context_register_function(&ipmipmn_node_ext);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipmn_reg_recv
|
||||
*===========================================================================
|
||||
* Description: Handles registration request and reply packages.
|
||||
* Parameters: data - Context
|
||||
* proc - Current process.
|
||||
* pbuf - Packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmipmn_reg_recv(struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmipmn_pktbuf_t *pbuf,
|
||||
void *arg)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(arg);
|
||||
if (pbuf->api.ipmip4.ipmip.srcinfo.lladdr == IP_NULL)
|
||||
goto error_out;
|
||||
|
||||
/* Find the interface */
|
||||
pbuf->api.iff.priv = ipmipmn_if_findbyindex(data, proc, pbuf->api.ipmip4.ipmip.srcinfo.dst->ifindex);
|
||||
|
||||
ipmipmn_api_reg_recv(&data->api, proc, &pbuf->api);
|
||||
return;
|
||||
|
||||
error_out:
|
||||
ipmip_pktbuf_release(&data->api.ipmip4.ipmip, proc, &pbuf->api.ipmip4.ipmip);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,108 @@
|
||||
/* ipmipmn_reg.h - ipmipmn_reg.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_reg.h,v $ $Revision: 1.9 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_reg.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-23 14:13:51 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPMN_REG_H
|
||||
#define IPMIPMN_REG_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmipmn_api_reg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_pktbuf;
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_reg_recv - ipmipmn_reg_recv
|
||||
*
|
||||
* Handles registration request and reply packages.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Current process.
|
||||
* \i pbuf
|
||||
* Packet buffer
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_reg_recv
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_pktbuf *pbuf,
|
||||
void *arg
|
||||
);
|
||||
|
||||
IP_GLOBAL void ipmipmn_reg_register_service
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,644 @@
|
||||
/* ipmipmn_route.h - ipmipmn_route.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_route.h,v $ $Revision: 1.12 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_route.h,v $
|
||||
* $Author: jhorteli $ $Date: 2010-10-15 11:28:41 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPMN_ROUTE_H
|
||||
#define IPMIPMN_ROUTE_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIPMN_ROUTE_TYPE_NONE 0
|
||||
#define IPMIPMN_ROUTE_TYPE_BLACKHOLE 1
|
||||
#define IPMIPMN_ROUTE_TYPE_SKIP 2
|
||||
#define IPMIPMN_ROUTE_TYPE_TUNNEL 3
|
||||
#define IPMIPMN_ROUTE_TYPE_FA 4
|
||||
#define IPMIPMN_ROUTE_TYPE_HOME 5
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmipmn_route_node;
|
||||
struct Ipmipmn_node;
|
||||
struct Ip_nlmsghdr;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_context_alloc - ipmipmn_route_context_alloc
|
||||
*
|
||||
* Allocate a route context
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The FA context
|
||||
* \i proc
|
||||
* Current process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE on success
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmipmn_route_context_alloc
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_context_destroy - ipmipmn_route_context_destroy
|
||||
*
|
||||
* Destroy a route context
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_context_destroy
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_context_start - ipmipmn_route_context_start
|
||||
*
|
||||
* Start the route context
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The mobile node context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE on success.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmipmn_route_context_start
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_context_stop - ipmipmn_route_context_stop
|
||||
*
|
||||
* Stops the route thread.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The mobile node context
|
||||
* \i proc
|
||||
* The process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_context_stop
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_alloc - ipmipmn_route_node_alloc
|
||||
*
|
||||
* Allocate an opaque route node context for this node.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Current process
|
||||
* \i lock
|
||||
* The node's lock
|
||||
* \i name
|
||||
* Name of this node.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: The node context
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL struct Ipmipmn_route_node * ipmipmn_route_node_alloc
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip_timer_lock_t *lock,
|
||||
struct Ipmipmn_node *node
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_destroy - ipmipmn_route_node_destroy
|
||||
*
|
||||
* Destroy a previously allocated route node
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Current process
|
||||
* \i rt
|
||||
* Route node
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_destroy
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rt
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_tunnel_type - ipmipmn_route_node_tunnel_type
|
||||
*
|
||||
* Set tunnel type of the mobile node.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i route
|
||||
* Route
|
||||
* \i tunnel_type
|
||||
* Type of tunnel
|
||||
* \i reorder
|
||||
* Enable reordering (if supported)
|
||||
* \i mtu
|
||||
* MTU reduction
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_tunnel_type
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *route,
|
||||
Ip_u8 tunnel_type,
|
||||
Ip_u8 reorder,
|
||||
Ip_u16 mtu
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_tunnel_nat - ipmipmn_route_node_tunnel_nat
|
||||
*
|
||||
* Set tunnel NAT of the mobile node.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i route
|
||||
* Route
|
||||
* \i tunnel_type
|
||||
* \i nat_t
|
||||
* NAT-T Enabled or not.
|
||||
* \i nat_t_alive
|
||||
* NAT-T Keep Alive.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_tunnel_nat
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *route,
|
||||
Ip_bool nat_t,
|
||||
Ip_u16 nat_t_alive
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_home_address - ipmipmn_route_node_home_address
|
||||
*
|
||||
* Set new home address of mobile node
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i route
|
||||
* Route
|
||||
* \i hoa
|
||||
* Home Address
|
||||
* \i netmask
|
||||
* Netmask
|
||||
* \i gw
|
||||
* Gateway
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_home_address
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *route,
|
||||
Ip_u32 hoa,
|
||||
Ip_u32 netmask,
|
||||
Ip_u32 gw
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_home_agent - ipmipmn_route_node_home_agent
|
||||
*
|
||||
* Set new home agent of mobile node
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i rtn
|
||||
* Route node context
|
||||
* \i ha
|
||||
* Home Agent
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_home_agent
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn,
|
||||
Ip_u32 ha
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_local_address - ipmipmn_route_node_local_address
|
||||
*
|
||||
* Set local address
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i rtn
|
||||
* Route node context
|
||||
* \i local
|
||||
* Local Address
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_local_address
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn,
|
||||
Ip_u32 local
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_ifindex - ipmipmn_route_node_ifindex
|
||||
*
|
||||
* Set current interface index
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i rtn
|
||||
* Route node context
|
||||
* \i ifindex
|
||||
* Current ifindex
|
||||
* \i group
|
||||
* Mobile Agent group
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_ifindex
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn,
|
||||
Ip_u32 ifindex,
|
||||
Ip_u32 group
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_lla - ipmipmn_route_node_lla
|
||||
*
|
||||
* Set lla
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i rtn
|
||||
* Route node context
|
||||
* \i lladdr
|
||||
* Link Local Nexthop
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_lla
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn,
|
||||
Ipmip_lladdr_t *lladdr
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_kickstart - ipmipmn_route_node_kickstart
|
||||
*
|
||||
* Kickstart any paused connections
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process context
|
||||
* \i rtn
|
||||
* Route node context
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_kickstart
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_upgrade - ipmipmn_route_node_upgrade
|
||||
*
|
||||
* Upgrade the route to a more explicit route type.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The context
|
||||
* \i proc
|
||||
* The process
|
||||
* \i rtn
|
||||
* Route information
|
||||
* \i type
|
||||
* Type of route.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_upgrade
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn,
|
||||
int type
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_downgrade - ipmipmn_route_node_downgrade
|
||||
*
|
||||
* Downgrade the current type of route.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The context
|
||||
* \i proc
|
||||
* The process
|
||||
* \i rtn
|
||||
* The route
|
||||
* \i type
|
||||
* Type of route.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmipmn_route_node_downgrade
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn,
|
||||
int type
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmipmn_route_node_get_tunnel_index - ipmipmn_route_node_get_tunnel_index
|
||||
*
|
||||
* Return the currently used MIP index.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i rtn
|
||||
* Node Route context
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: index of the current MIP.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_u32 ipmipmn_route_node_get_tunnel_index
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn
|
||||
);
|
||||
|
||||
IP_GLOBAL const char *ipmipmn_route_node_get_tunnel_ifname
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_route_node *rtn
|
||||
);
|
||||
|
||||
IP_GLOBAL void ipmipmn_netlink_process
|
||||
(
|
||||
struct Ipmipmn_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ip_nlmsghdr *hdr
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
Reference in New Issue
Block a user