285 lines
10 KiB
C
285 lines
10 KiB
C
|
|
/*
|
|
******************************************************************************
|
|
* INTERPEAK SOURCE FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipfa_pmipv4.c,v $ $Revision: 1.3.16.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmipfa/config/ipmipfa_pmipv4.c,v $
|
|
* $Author: svc-cmnet $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipmipfa_config.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#define IPCOM_USE_CLIB_PROTO
|
|
#include <ipcom_clib.h>
|
|
#include <ipcom_os.h>
|
|
#include <ipcom_sock.h>
|
|
#include <ipcom_sock6.h>
|
|
#include <ipcom_inet.h>
|
|
#include <ipcom_list.h>
|
|
#include <ipcom_hash.h>
|
|
#include <ipcom_err.h>
|
|
#include <ipcom_sysvar.h>
|
|
#include <ipcom_syslog.h>
|
|
#include <ipcom_shell.h>
|
|
#include <ipcom_route.h>
|
|
|
|
#include <ipmip.h>
|
|
#include <private/ipmip_util.h>
|
|
#include <private/ipmip_sysvar.h>
|
|
#include <private/ipmip_inet.h>
|
|
#include <private/ipmip_dhcp.h>
|
|
|
|
#include <ipmip4.h>
|
|
#include <private/ipmip4_context.h>
|
|
#include <private/ipmip4_util.h>
|
|
#include <private/ipmip4_sysext.h>
|
|
#include <private/ipmip4_cli.h>
|
|
#include <private/ipmip4_pkt.h>
|
|
|
|
#include "ipmipfa.h"
|
|
#include "ipmipfa_h.h"
|
|
#include "ipmipfa_attr_h.h"
|
|
#include "ipmipfa_if.h"
|
|
#include "ipmipfa_node.h"
|
|
#include "ipmipfa_reg.h"
|
|
#include "ipmipfa_pktbuf.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
#define IPMIPFA_REGEXT_PMIPV4 "PMIPV4"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
typedef struct Ipmipfa_pmipv4_config_ifp
|
|
{
|
|
Ip_bool enabled;
|
|
} Ipmipfa_pmipv4_config_ifp_t;
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 EXTERN PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 7 LOCAL PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 8 DATA
|
|
****************************************************************************
|
|
*/
|
|
static Ipmipfa_extension_t ipmipfa_pmipv4;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 9 STATIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
IP_STATIC void
|
|
ipmipfa_pmipv4_req_forward(struct Ipmipfa_data *ctx,
|
|
struct Ipmip_proc *proc,
|
|
void *global_config,
|
|
Ipmipfa_pmipv4_config_ifp_t *ifp_config,
|
|
void *node_config,
|
|
struct Ipmipfa_node *node,
|
|
struct Ipmipfa_pktbuf *pbuf)
|
|
{
|
|
IPMIP_UNUSED_PARAMETER(ctx);
|
|
IPMIP_UNUSED_PARAMETER(proc);
|
|
IPMIP_UNUSED_PARAMETER(global_config);
|
|
IPMIP_UNUSED_PARAMETER(ifp_config);
|
|
IPMIP_UNUSED_PARAMETER(node_config);
|
|
IPMIP_UNUSED_PARAMETER(node);
|
|
IPMIP_UNUSED_PARAMETER(pbuf);
|
|
|
|
/* Append the Access Type */
|
|
ipmip4_lla_pmipv4_lladdr_buffer_access_type_append(&pbuf->ipmip4.ipmip.packet, node->reginfo.faVisitorMAC);
|
|
}
|
|
|
|
IP_STATIC void
|
|
ipmipfa_pmipv4_rep_forward(struct Ipmipfa_data *ctx,
|
|
struct Ipmip_proc *proc,
|
|
void *global_config,
|
|
Ipmipfa_pmipv4_config_ifp_t *ifp_config,
|
|
void *node_config,
|
|
struct Ipmipfa_node *node,
|
|
struct Ipmipfa_pktbuf *pbuf)
|
|
{
|
|
IPMIP_UNUSED_PARAMETER(ctx);
|
|
IPMIP_UNUSED_PARAMETER(proc);
|
|
IPMIP_UNUSED_PARAMETER(global_config);
|
|
IPMIP_UNUSED_PARAMETER(ifp_config);
|
|
IPMIP_UNUSED_PARAMETER(node_config);
|
|
IPMIP_UNUSED_PARAMETER(node);
|
|
IPMIP_UNUSED_PARAMETER(pbuf);
|
|
}
|
|
|
|
IP_STATIC void
|
|
ipmipfa_pmipv4_reqrep_accepted(struct Ipmipfa_data *ctx,
|
|
struct Ipmip_proc *proc,
|
|
void *global_config,
|
|
Ipmipfa_pmipv4_config_ifp_t *ifp_config,
|
|
void *node_config,
|
|
struct Ipmipfa_node *node,
|
|
struct Ipmipfa_pktbuf *pbuf)
|
|
{
|
|
IPMIP_UNUSED_PARAMETER(ctx);
|
|
IPMIP_UNUSED_PARAMETER(proc);
|
|
IPMIP_UNUSED_PARAMETER(global_config);
|
|
IPMIP_UNUSED_PARAMETER(ifp_config);
|
|
IPMIP_UNUSED_PARAMETER(node_config);
|
|
IPMIP_UNUSED_PARAMETER(node);
|
|
IPMIP_UNUSED_PARAMETER(pbuf);
|
|
}
|
|
|
|
|
|
IP_STATIC Ip_bool
|
|
ipmipfa_pmipv4_setup(struct Ipmipfa_data *ctx,
|
|
struct Ipmip_proc *proc,
|
|
int action,
|
|
void *global_config,
|
|
Ipmipfa_pmipv4_config_ifp_t *ifp_config,
|
|
void *node_config,
|
|
struct Ipmipfa_node *node,
|
|
Ipmip_cli_message_t *request)
|
|
{
|
|
IPMIP_UNUSED_PARAMETER(ctx);
|
|
IPMIP_UNUSED_PARAMETER(proc);
|
|
IPMIP_UNUSED_PARAMETER(global_config);
|
|
IPMIP_UNUSED_PARAMETER(ifp_config);
|
|
IPMIP_UNUSED_PARAMETER(node_config);
|
|
IPMIP_UNUSED_PARAMETER(node);
|
|
IPMIP_UNUSED_PARAMETER(request);
|
|
|
|
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
|
{
|
|
/* MUST have NAI, MUST be enabled */
|
|
if (ifp_config->enabled)
|
|
return IP_TRUE;
|
|
}
|
|
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
|
{
|
|
/* No dyncamically allocated values */
|
|
}
|
|
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
|
{
|
|
}
|
|
|
|
return IP_FALSE;
|
|
}
|
|
|
|
|
|
IP_STATIC void
|
|
ipmipfa_pmipv4_config(struct Ipmipfa_data *ctx,
|
|
struct Ipmip_proc *proc,
|
|
int action,
|
|
struct Ipmipfa_iff *ifp,
|
|
void *gcfg,
|
|
Ipmipfa_pmipv4_config_ifp_t *cfg,
|
|
Ipmip_cli_message_t *request)
|
|
{
|
|
IPMIP_UNUSED_PARAMETER(ctx);
|
|
IPMIP_UNUSED_PARAMETER(proc);
|
|
IPMIP_UNUSED_PARAMETER(gcfg);
|
|
IPMIP_UNUSED_PARAMETER(request);
|
|
|
|
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
|
{
|
|
cfg->enabled = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmipfa.pmipv4.enable"), "ipmipfa.if.%s.pmipv4.enable", ifp->iff.ipmip.ifname);
|
|
}
|
|
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
|
{
|
|
/* Nothing to free */
|
|
}
|
|
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
|
{
|
|
/* Could dump, but dont bother */
|
|
if (cfg->enabled)
|
|
{
|
|
ipmip_cli_config_printf(&request->message,
|
|
"ipmipfa.if.%s.pmipv4.enable=enabled",
|
|
ifp->iff.ipmip.ifname);
|
|
}
|
|
else
|
|
{
|
|
ipmip_cli_config_printf(&request->message,
|
|
"ipmipfa.if.%s.pmipv4.enable=disabled",
|
|
ifp->iff.ipmip.ifname);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 10 GLOBAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
IP_GLOBAL void ipmipfa_pmipv4_install(void);
|
|
IP_GLOBAL void
|
|
ipmipfa_pmipv4_install(void)
|
|
{
|
|
ipcom_memset(&ipmipfa_pmipv4, 0, sizeof(ipmipfa_pmipv4));
|
|
|
|
ipmipfa_pmipv4.name = IPMIPFA_REGEXT_PMIPV4;
|
|
|
|
ipmipfa_pmipv4.ifp_data_size = sizeof(Ipmipfa_pmipv4_config_ifp_t);
|
|
|
|
ipmipfa_pmipv4.config_ifp = (Ipmipfa_extension_config_ifp_t)ipmipfa_pmipv4_config;
|
|
ipmipfa_pmipv4.setup = (Ipmipfa_extension_setup_t)ipmipfa_pmipv4_setup;
|
|
ipmipfa_pmipv4.pkt_rep_forward = (Ipmipfa_extension_pkt_rep_forward_t)ipmipfa_pmipv4_rep_forward;
|
|
ipmipfa_pmipv4.pkt_req_forward = (Ipmipfa_extension_pkt_req_forward_t)ipmipfa_pmipv4_req_forward;
|
|
ipmipfa_pmipv4.pkt_reqrep_accepted = (Ipmipfa_extension_pkt_reqrep_accepted_t)ipmipfa_pmipv4_reqrep_accepted;
|
|
|
|
ipmipfa_context_register_extension(&ipmipfa_pmipv4, IPMIPFA_FUNCTION_REGEXT);
|
|
}
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 11 PUBLIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|