original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,557 @@
/* 00comp_ipnet_mobility.cdf - IPNet Mobility configuration file */
/*
* Copyright (c) 2006-2007 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01i,11oct07,jho Fixed defect 106455; confusing naming and synopsis updated.
01h,19sep07,rme Added missing backslash (line:137, 304)
01f,27feb07,kch Added MIPMN_IPSEC_PROTECTED configuration parameter for
mobile node. Also renamed MIPMN_IFNAME_LIST to MIPMN_IFNAME
since only one interface can be configured at any time in
the mobile node (WIND00089286).
01e,23jan06,tlu Fix MIP CDF defects (85299, 85297, 85290)
01d,25nov06,kch Added MIPHA_IF_NAT_T_KEEPALIVE_LIST configuration parameter.
01c,23sep06,kch Fixed IPCOM shell commands description.
01b,26aug06,kch Added support for configuration parameters.
01a,22may06,kch created.
*/
#ifdef _WRS_CONFIG_COMPONENT_IPMIPMN
Component INCLUDE_IPMIPMN {
NAME IPv4 Mobile Node
SYNOPSIS IPv4 Mobile Node
MODULES ipmipmn.o
REQUIRES INCLUDE_IPCOM INCLUDE_IPNET INCLUDE_IPMIP4
_CHILDREN FOLDER_MOBILITY_MN
CONFIGLETTES ipmipmn_config.c
CFG_PARAMS MIPMN_IFNAME \
MIPMN_HOME_AGENT \
MIPMN_MTU_REDUCTION \
MIPMN_HOME_ADDRESS \
MIPMN_HOME_MASK \
MIPMN_HOME_GATEWAY \
MIPMN_SOL_ADDRESS \
MIPMN_HA_AUTH_SECRET \
MIPMN_HA_AUTH_SPI \
MIPMN_HA_AUTH_METHOD \
MIPMN_RUN_MODE \
MIPMN_FA_AUTH_SECRET \
MIPMN_FA_AUTH_SPI \
MIPMN_FA_AUTH_METHOD \
MIPMN_REG_LIFETIME \
MIPMN_RECV_BROADCASTS \
MIPMN_TUNNEL_TYPE \
MIPMN_REVERSE_TUNNELING \
MIPMN_NAI \
MIPMN_DYNAMIC_HOME_AGENT_ASSIGNMENT \
MIPMN_SOLICIT \
MIPMN_IPSEC_PROTECTED \
MIPMN_IPIKE_RECONFIGURE \
MIPMN_IPIKE_SECURE \
MIPMN_NAT_T_ENABLED \
MIPMN_NAT_T_FORCED \
MIPMN_NAT_T_KEEPALIVE \
MIPMN_NAT_T_TUNNEL_TYPE \
MIPMN_FA_SPI_SECRET_LIST \
MIPMN_FA_SPI_METHOD_LIST \
MIPMN_HA_SPI_SECRET_LIST \
MIPMN_HA_SPI_METHOD_LIST \
MIPMN_FA_SA_ADDRESS_LIST \
MIPMN_HA_SA_ADDRESS_LIST \
MIPMN_AAA_SECRET \
MIPMN_AAA_SPI \
MIPMN_AAA_METHOD \
MIPMN_SIMBIND \
MIPMN_TUNNEL_REORDERING \
MIPMN_REVOCATION \
MIPMN_IPIKE_MOBIKE
}
Component INCLUDE_IPMIPMN_FEATURE_EXTENSION {
NAME IPv4 Mobile Node Feature Extension Registration Hook
SYNOPSIS IPv4 Mobile Node Feature Extension allows you provide \
an additional registration hook for registration of \
external functions.
REQUIRES INCLUDE_IPMIPMN
_CHILDREN FOLDER_MOBILITY_HA
CFG_PARAMS MIPMN_FEATURE_INITIALIZATION_HOOK
}
Parameter MIPMN_FEATURE_INITIALIZATION_HOOK {
NAME Mobile Node Feature Initialization Hook
SYNOPSIS This is the function hook that you may define in order to \
register extra functional extensions to the Mobile Node
TYPE FUNCPTR
DEFAULT your_function_here
}
/* INCLUDE_IPMIPMN configuration parameters */
Parameter MIPMN_IFNAME {
NAME Mobile Node Interface
SYNOPSIS Specifies network interface that should be managed by the \
mobile IP node implementation, e.g. "eth0".
TYPE char *
DEFAULT ""
}
Parameter MIPMN_HOME_AGENT {
NAME Home Agent IPv4 Address
SYNOPSIS The IPv4 address of the mobile node home agent, \
e.g. "10.1.2.42".
TYPE char *
DEFAULT ""
}
Parameter MIPMN_MTU_REDUCTION {
NAME Mtu Reduction
SYNOPSIS Set to "1" to reserve MTU for headers beyond the mobile \
nodes control, such as IPSEC or other security releated \
protocols. This is useful to avoid needless fragmentation.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_HOME_ADDRESS {
NAME Home Address
SYNOPSIS The mobile node IPv4 address on the home network. By \
choosing the IP address any (i.e. "0.0.0.0"), the mobile \
node will read the IP address and netmask from the \
configured interface (set by MIPMN_IFNAME) at start and \
use as mobile node home address and netmask.
TYPE char *
DEFAULT "0.0.0.0"
}
Parameter MIPMN_HOME_MASK {
NAME Home Netmask
SYNOPSIS The mobile node home network (sub)netmask in "a.b.c.d" \
format, e.g."255.255.0.0".
TYPE char *
DEFAULT ""
}
Parameter MIPMN_DYNAMIC_HOME_AGENT_ASSIGNMENT {
NAME Dynamic Home Agent Assignment
SYNOPSIS Enables Dynamic Home Agent Assignment (DHAA) as per RFC4433. \
When DHAA is used, if an address is specified in the \
MIPMN_HOME_AGENT configuration parameter, it will be used \
as a 'initial' home agent to query. If the mobile node is \
run in co-located mode, the MIPMN_HOME_AGENT must still \
be specified, since there's no way for the mobile node to \
resolve the home agent. If foreign agent's are being used, \
depending on the configuration of the foreign agent, the \
mobile node may actually not specify a home agent at all, \
since the foreign agent may resolve the proper one, or assign \
one depending on the type home agent assignment. Values for \
this configuration item are: 'disabled', 'enabled' or 'home'. \
When 'enabled', the mobile node may be assigned a home agent \
either in its home domain, or in the foreign domain depending \
on the policy of the foreign agent. When 'home' the mobile \
node requires a home agent in its own domain.
TYPE char *
DEFAULT "disabled"
}
Parameter MIPMN_HOME_GATEWAY {
NAME Home Gateway
SYNOPSIS If set, the mobile node will update the default gateway upon \
reaching the home network. If not set, it is outside the \
scope of IPMIPMN how to update the default gateway upon \
returning home with a possibly unreachable default gateway. \
E.g. "10.1.1.1".
TYPE char *
DEFAULT ""
}
Parameter MIPMN_SOL_ADDRESS {
NAME Router Solicitation Address
SYNOPSIS Configures the destination address of outgoing router \
solicitation messages from the mobile node. If not set, \
set to invalid IP address or 0.0.0.0 IP address, the mobile \
node will not send ICMP router solicitations. \
E.g. "224.0.0.11".
TYPE char *
DEFAULT ""
}
Parameter MIPMN_HA_AUTH_SECRET {
NAME Default Home Agent Shared Secret
SYNOPSIS This parameter specifies the default secret to be used when \
authenticating towards home agents. If you need to configure \
secrets on a per home agent basis, you must use the \
MIPMN_HA_SPI_METHOD_LIST, MIPMN_HA_SPI_SECRET_LIST and \
MIPMN_HA_SA_ADDRESS_LIST parameters. An example configuration \
is "test0"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_HA_AUTH_SPI {
NAME Default Home Agent SPI
SYNOPSIS This is the default home agent SPI parameter when \
authenticating towards home agents. If you need to configure \
SPI's on a per home agent basis, you must use the \
MIPMN_HA_SPI_METHOD_LIST, MIPMN_HA_SPI_SECRET_LIST and \
MIPMN_HA_SA_ADDRESS_LIST parameters. An example configuration \
is "1000"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_HA_AUTH_METHOD {
NAME Default Home Agent Security Method
SYNOPSIS The default home agent authentication method, which specifies \
what type of security verification mechanism should be used. \
There are two different values available, md5-hmac and keygen, \
where md5-hmac is the default MIPv4 authentication method, \
and keygen will tell the mobile node to generate keys using \
RFC3957. Note that you MUST configure MIPMN_AAA_SPI, \
MIPMN_AAA_SECRET and MIPMN_AAA_METHOD when using keygen. If \
you need to configure auth methods on a per home agent basis, \
you must use the MIPMN_HA_SPI_METHOD_LIST, \
MIPMN_HA_SPI_SECRET_LIST and MIPMN_HA_SA_ADDRESS_LIST
TYPE char *
DEFAULT ""
}
Parameter MIPMN_RUN_MODE {
NAME Mobile Node Run Mode
SYNOPSIS Whether to use a foreign agent ("fa") or a co-located \
("co") address.
TYPE char *
DEFAULT "fa"
}
Parameter MIPMN_FA_AUTH_SECRET {
NAME Default Foreign Agent Shared Secret
SYNOPSIS This parameter specifies the default secret to be used when \
authenticating towards foreign agents. If you need to configure \
secrets on a per foreign agent basis, you must use the \
MIPMN_FA_SPI_METHOD_LIST, MIPMN_FA_SPI_SECRET_LIST and \
MIPMN_FA_SA_ADDRESS_LIST parameters. An example configuration \
is "test1"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_FA_AUTH_SPI {
NAME Default Foreign Agent SPI
SYNOPSIS This is the default foreign agent SPI parameter when \
authenticating towards foreign agents. If you need to configure \
SPI's on a per foreign agent basis, you must use the \
MIPMN_FA_SPI_METHOD_LIST, MIPMN_FA_SPI_SECRET_LIST and \
MIPMN_FA_SA_ADDRESS_LIST parameters. An example configuration \
is "1001"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_FA_AUTH_METHOD {
NAME Default Foreign Agent Security Method
SYNOPSIS The default foreign agent authentication method, which \
specifies what type of security verification mechanism should \
be used. There are two different values available, md5-hmac \
and keygen, where md5-hmac is the default MIPv4 authentication \
method, and keygen will tell the mobile node to generate keys \
using RFC3957. Note that you MUST configure MIPMN_AAA_SPI, \
MIPMN_AAA_SECRET and MIPMN_AAA_METHOD when using keygen. If \
you need to configure auth methods on a per foreign agent basis, \
you must use the MIPMN_FA_SPI_METHOD_LIST, \
MIPMN_FA_SPI_SECRET_LIST and MIPMN_FA_SA_ADDRESS_LIST
TYPE char *
DEFAULT ""
}
Parameter MIPMN_REG_LIFETIME {
NAME Registration Lifetime
SYNOPSIS Registration lifetime in seconds where 0 means infinite \
lifetime. When on foreign networks, the mobile node will \
attempt to reregister after half the lifetime.
TYPE char *
DEFAULT "30"
}
Parameter MIPMN_RECV_BROADCASTS {
NAME Receive Broadcasts
SYNOPSIS Setting this configuration option to "1" enables the \
reception of broadcast packets from the home network \
(assuming the home agent supports forwarding of such \
packets). "0" means disable.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_TUNNEL_TYPE {
NAME Tunnel Type
SYNOPSIS The type of tunnel negotiated between the mobile node and \
foreign agent is chosen by setting this configuration \
option to "ipip", "gre" or "min" for IPIP, GRE or Minimal \
Encapsulation respectively. If the home agent does not \
support GRE or MIN, IPIP will be tried. If IPIP is not \
supported as well, the registration operation will fail and \
the mobile node must be reconfigured.
TYPE char *
DEFAULT "ipip"
}
Parameter MIPMN_REVERSE_TUNNELING {
NAME Reverse Tunneling
SYNOPSIS By setting this configuration option to "required" the mobile node \
will require the use of reverse tunneling. "optional" will enable \
the node to try to negotiate the use of reverse tunnelling, i.e. \
the mobile node will tunnel all outgoing packets to the \
home agent. If the home agent does not support reverse \
tunnelling, the mobile node will automatically retry the \
registration request without the use of reverse tunnelling \
(i.e. use normal triangular routing).
TYPE char *
DEFAULT "optional"
}
Parameter MIPMN_NAI {
NAME Network Access Identifier
SYNOPSIS Specify the network access identity as according to RFC 2794.
TYPE char *
DEFAULT ""
}
Parameter MIPMN_SOLICIT {
NAME Solicitations
SYNOPSIS Set to "required" to force the mobile node to always solicit \
routers on L2-LU. This is the default behaviour but it may \
be unset in order to allow transparent POST Low Latency \
Handovers without the mobile node re-registering until the \
registration time out occurs, or the FA forces the \
re-registration. Other values are "optional", which \
will try to keep solicitations to a minimum, and "disabled" \
which do not solicit at all.
TYPE char *
DEFAULT "required"
}
Parameter MIPMN_IPSEC_PROTECTED {
NAME IPSEC Protected CoA Only
SYNOPSIS This configuration parameter defines whether or not the \
mobile node should only use addresses which has SPD's \
specified which covers them. It requires that IPIPSEC or \
IPIKE has set up the required security policies and \
associations prior to any mobile IP registration. If \
MIPMN_IPIKE_SECURE is set, it takes precedense, and this \
configuration variable will be ignored.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_IPIKE_RECONFIGURE {
NAME IPIKE Reconfiguration On Movement
SYNOPSIS Specifies whether or not the mobile node should send a \
reconfiguration request to the IPIKE process when it moves. \
This is so that the IPIKE daemon may re-read its \
configuration file, re-acquire any primary addresses on the \
selected interface and renegotiate security associations.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_IPIKE_SECURE {
NAME IPIKE Secure Address Only
SYNOPSIS Specifies whether or not the mobile node should only use \
addresses allocated by IPIKE during its negotiation process. \
If set, the mobile node will scan its configured interface \
for addresses which IPIKE has reported are secure, and use \
them.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_IPIKE_MOBIKE {
NAME IPIKE Mobike On Movement
SYNOPSIS Specifies whether or not the mobile node should use \
mobike when roaming, in order to re-establish the encrypted \
channel previously created by IPIKE. Only addresses allocated \
by IPIKE are subjected to mobike, and therefore \
MIPMN_IPIKE_SECURE should usually also be enabled when this \
option is used.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_NAT_T_ENABLED {
NAME NAT Traversal
SYNOPSIS Enables or disables NAT Traversal according to RFC 3519.
TYPE char *
DEFAULT "1"
}
Parameter MIPMN_NAT_T_FORCED {
NAME Forced NAT Traversal
SYNOPSIS Enables forcing of NAT traversal (RFC 3519), regardless \
what the home agent NAT detection decides.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_NAT_T_KEEPALIVE {
NAME NAT Traversal Keepalive
SYNOPSIS Decides the keepalive timeout to use for NAT Traversal \
ICMP keepalive messages in order to maintain a NAT device \
UDP port mapping.
TYPE char *
DEFAULT "120"
}
Parameter MIPMN_NAT_T_TUNNEL_TYPE {
NAME NAT Traversal Tunnel Type
SYNOPSIS Allows for specifying a different tunnel type if NAT \
traversal is used. Ordinarily, the tunnel type specified \
by the mobile node base configuration is used, it may be \
overriden for NAT Traversal tunneling, if for example only \
IPIP is specified to work. Allowed values are "min", "gre" \
and "ipip". If not specified or empty, the mobile node \
base configuration will take precedence.
TYPE char *
DEFAULT ""
}
Parameter MIPMN_HA_SPI_SECRET_LIST {
NAME Home Agent Security Association Secrets
SYNOPSIS These keys specify the secrets associated with specific SPI's \
for use when communicating with home agents. The syntax is \
"<spi value>=<secret>" and multiple entries are separated \
by a semicolon. E.g. "1003=firstsecret;1004=secondsecret"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_HA_SPI_METHOD_LIST {
NAME Home Agent Security Association Methods
SYNOPSIS These keys specify the security method associated with specific \
SPI's for use when communicating with home agents. The syntax \
is "<spi value>=<method>" and multiple entries are separated \
by a semicolon. Valid methods are: \
md5-hmac - The default MIPv4 hash mechanism. \
keygen - AAA key generation. If this method has been \
specified, keys will be generated according to \
RFC3957. You must configure MIPMN_AAA_SPI, \
MIPMN_AAA_SECRET and MIPMN_AAA_METHOD as well.
TYPE char *
DEFAULT ""
}
Parameter MIPMN_FA_SPI_SECRET_LIST {
NAME Foreign Agent Security Association Secrets
SYNOPSIS These keys specify the secrets associated with specific SPI's \
for use when communicating with foreign agents. The syntax is \
"<spi value>=<secret>" and multiple entries are separated\
by a semicolon. E.g. "1003=firstsecret;1004=secondsecret"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_FA_SPI_METHOD_LIST {
NAME Foreign Agent Security Association Methods
SYNOPSIS These keys specify the security method associated with specific \
SPI's for use when communicating with foreign agents. The syntax \
is "<spi value>=<method>" and multiple entries are separated\
by a semicolon. Valid methods are: \
md5-hmac - The default MIPv4 hash mechanism. \
keygen - AAA key generation. If this method has been\
specified, keys will be generated according to\
RFC3957. You must configure MIPMN_AAA_SPI,\
MIPMN_AAA_SECRET and MIPMN_AAA_METHOD as well.
TYPE char *
DEFAULT ""
}
Parameter MIPMN_FA_SA_ADDRESS_LIST {
NAME Foreign Agent Security Association Selection
SYNOPSIS These keys specify what security association should be used \
when communicating with foreign agents. There may be multiple \
selection directives specified, each separated by a semicolon. \
The syntax for the directives is "<network[/prefix]>=<spi>".\
E.g. "10.1.2.3=1004;10.2.0.0/16=1005"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_HA_SA_ADDRESS_LIST {
NAME Home Agent Security Association Selection
SYNOPSIS These keys specify what security association should be used \
when communicating with home agents. There may be multiple \
selection directives specified, each separated by a semicolon. \
The syntax for the directives is "<network[/prefix]>=<spi>". \
E.g. "10.1.2.3=1004;10.2.0.0/16=1005"
TYPE char *
DEFAULT ""
}
Parameter MIPMN_AAA_SECRET {
NAME AAA Shared Secret
SYNOPSIS The shared secret used when authenticating towards a AAA \
infrastructure. E.g. "myaaasecret".
TYPE char *
DEFAULT ""
}
Parameter MIPMN_AAA_SPI {
NAME AAA SPI
SYNOPSIS The Security Parameter Index (SPI) used when authenticating \
towards a AAA infrastructure. If set to the pre-defined \
value of "2", will indicate that RADIUS CHAP authentication \
should be used.
TYPE char *
DEFAULT ""
}
Parameter MIPMN_AAA_METHOD {
NAME AAA Security Association Method
SYNOPSIS Indicates what kind of HASH or authentication method should \
be used when calculating the authentication extensions. May \
be set to either md5-hmac or chap.
TYPE char *
DEFAULT ""
}
Parameter MIPMN_SIMBIND {
NAME Simultaneous Bindings
SYNOPSIS Enables or disables simultaneous bindings.
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_TUNNEL_REORDERING {
NAME Tunnel Reordering
SYNOPSIS Disabled(0)/Enabled(1) tunnel reordering. When enabled, any \
tunneltype such as GRE that supports it will guarantee in-order \
packet delivery
TYPE char *
DEFAULT "0"
}
Parameter MIPMN_REVOCATION {
NAME Registration Revocation
SYNOPSIS Disabled(0)/Enabled(1) registration revocation. When enabled \
the mobile node will indicate to the home agent that it \
supports the usage of registration revocation.
TYPE char *
DEFAULT "1"
}
#endif
@@ -0,0 +1,11 @@
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: common.vxconfig,v $ $Revision: 1.9 $
# $Source: /home/interpeak/CVSRoot/ipmipmn/config/common.vxconfig,v $
# $Author: myakan $
# $State: Exp $ $Locker: $
#
# INTERPEAK_COPYRIGHT_STRING
#hidden option that enables IPMIPMN
config SUPPORTS_MIPMN
bool
default y
@@ -0,0 +1,323 @@
/*
******************************************************************************
* INTERPEAK CONFIGURATION SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_config.c,v $ $Revision: 1.27 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/config/ipmipmn_config.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Lennart Bang <lob@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_cstyle.h>
#include <ipcom_err.h>
#include <ipcom_sysvar.h>
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define INCLUDE_IPMIPMN_CMD 1
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
IP_PUBLIC int ipmipmn_cmd_mn(int argc, char **argv);
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
IP_PUBLIC Ip_err ipmipmn_configure(void);
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
*===========================================================================
* Mobile Node sysvar Configuration
*===========================================================================
*/
#if defined(INCLUDE_IPMIPMN)
IP_STATIC IP_CONST Ipcom_sysvar ipmipmn_conf_sysvar[] =
{
/*
* Active MIP interface. There's only one interface configured at
* any time in the mobile node.
*/
{ "ipmipmn.interface", MIPMN_IFNAME},
/* Home agent IP address */
{ "ipmipmn.homeagent", MIPMN_HOME_AGENT},
/* Reduce the MTU of tunneled routes; incase of VPN tunneling to
* reduce fragmentation
*/
{ "ipmipmn.mtu_reduction", MIPMN_MTU_REDUCTION },
/* Home address and netmask. 0.0.0.0 -> read IP address/netmask at start. */
{ "ipmipmn.homeaddress", MIPMN_HOME_ADDRESS},
{ "ipmipmn.homenetmask", MIPMN_HOME_MASK},
/* Set default gateway on home network if this sysvar is set. */
{ "ipmipmn.homegateway", MIPMN_HOME_GATEWAY},
/* Destination address for outgoing router solicitation messages. Set to 0 to disable. */
{ "ipmipmn.sol_address", MIPMN_SOL_ADDRESS},
/* Home agent shared secret and Security Parameter Index (SPI). */
{ "ipmipmn.haauthsecret", MIPMN_HA_AUTH_SECRET},
{ "ipmipmn.haauthspi", MIPMN_HA_AUTH_SPI},
{ "ipmipmn.haauthmethod", MIPMN_HA_AUTH_METHOD},
/* Whether to use a foreign agent ("fa") or a co-located ("co") address. */
{ "ipmipmn.runmode", MIPMN_RUN_MODE},
/* Foreign agent shared secret and Security Parameter Index (SPI).
* This is only needed if ipmipmn.runmode is set to "fa".
* Note: not setting "ipmipmn.faauthsecret" means mobile-foreign
* authentication is disabled.
*/
{ "ipmipmn.faauthsecret", MIPMN_FA_AUTH_SECRET},
{ "ipmipmn.faauthspi", MIPMN_FA_AUTH_SPI},
{ "ipmipmn.faauthmethod", MIPMN_FA_AUTH_METHOD},
/* AAA */
{ "ipmipmn.aaa.secret", MIPMN_AAA_SECRET},
{ "ipmipmn.aaa.spi", MIPMN_AAA_SPI},
{ "ipmipmn.aaa.method", MIPMN_AAA_METHOD},
/* Registration lifetime in seconds. 0 = infinite. */
{ "ipmipmn.reg_lifetime", MIPMN_REG_LIFETIME},
/* Receive broadcast packets from home network. */
{ "ipmipmn.receivebroadcasts",MIPMN_RECV_BROADCASTS},
/* "ipip" = IP over IP (gif), "gre" = GRE, "min" = minimal encapsulation. */
{ "ipmipmn.simbind", MIPMN_SIMBIND},
/* Tunnel reordering */
{ "ipmipmn.reordering", MIPMN_TUNNEL_REORDERING},
/* Revocation support */
{ "ipmipmn.revocation", MIPMN_REVOCATION},
/* "ipip" = IP over IP (gif), "gre" = GRE, "min" = minimal encapsulation. */
{ "ipmipmn.tunneltype", MIPMN_TUNNEL_TYPE},
/* Enable(1)/disable(0) reverse tunneling. */
{ "ipmipmn.reversetunneling", MIPMN_REVERSE_TUNNELING},
/* NAI. Network Access identifiers */
{ "ipmipmn.nai.mn", MIPMN_NAI},
/* DHAA */
{ "ipmipmn.dhaa", MIPMN_DYNAMIC_HOME_AGENT_ASSIGNMENT },
/*
* Movement and solicitations; Always solicit on L2-LU (wont work
* well with POST LLH)
*/
{ "ipmipmn.solicit", MIPMN_SOLICIT},
/* ipsec protected CoA's only */
{ "ipmipmn.ipipsec.protected", MIPMN_IPSEC_PROTECTED},
/* Force reconfiguration on move */
{ "ipmipmn.ipike.reconfigure", MIPMN_IPIKE_RECONFIGURE },
/* only use secure addresses (IKE allocated) */
{ "ipmipmn.ipike.secure", MIPMN_IPIKE_SECURE},
/* enable mobike on movement (IKE allocated) */
{ "ipmipmn.ipike.mobike", MIPMN_IPIKE_MOBIKE },
/* NAT-T enabled on this interface */
{ "ipmipmn.nat_t.enabled", MIPMN_NAT_T_ENABLED},
/* NAT-T enabled on this interface */
{ "ipmipmn.nat_t.forced", MIPMN_NAT_T_FORCED},
/* NAT-T keepalive; In seconds */
{ "ipmipmn.nat_t.keepalive", MIPMN_NAT_T_KEEPALIVE},
/* NAT-T forced tunnel type; ipip, gre, min or empty (use ordinary spec) */
{ "ipmipmn.nat_t.tunneltype", MIPMN_NAT_T_TUNNEL_TYPE},
/* Configuration delimiter - DO NOT EDIT! */
{ IP_NULL, IP_NULL }
};
IP_STATIC IP_CONST Ipcom_sysvar_ext ipmipmn_conf_sysvar_ext[] =
{
/* Extended security association selection and creation */
{ "ipmipmn.fa.spi", "secret", MIPMN_FA_SPI_SECRET_LIST},
{ "ipmipmn.fa.spi", "method", MIPMN_FA_SPI_METHOD_LIST},
{ "ipmipmn.ha.spi", "secret", MIPMN_HA_SPI_SECRET_LIST },
{ "ipmipmn.ha.spi", "method", MIPMN_HA_SPI_METHOD_LIST},
{ "ipmipmn.ha.sa.address", IP_NULL, MIPMN_HA_SA_ADDRESS_LIST},
{ "ipmipmn.fa.sa.address", IP_NULL, MIPMN_FA_SA_ADDRESS_LIST},
/* Configuration delimiter - DO NOT EDIT! */
{ IP_NULL, IP_NULL, IP_NULL }
};
#else /* WRS_IPNET */
IP_STATIC IP_CONST Ipcom_sysvar ipmipmn_conf_sysvar[] =
{
/* Configuration delimiter - DO NOT EDIT! */
{ IP_NULL, IP_NULL }
};
#if defined(IPTESTENGINE)
# define INCLUDE_IPMIPMN_FEATURE_EXTENSION 1
# define MIPMN_FEATURE_INITIALIZATION_HOOK ipmipmn_regext_test_install
#endif
#endif /* WRS_IPNET */
#if defined(INCLUDE_IPMIPMN_FEATURE_EXTENSION)
extern void MIPMN_FEATURE_INITIALIZATION_HOOK(void);
#endif
IP_GLOBAL void ipmipmn_regext_mobnet_install(void);
typedef void (*Ipmipmn_config_func_t) (void);
Ipmipmn_config_func_t ipmipmn_function_registrations[] =
{
#if defined(INCLUDE_IPMIPMN_FEATURE_EXTENSION)
MIPMN_FEATURE_INITIALIZATION_HOOK,
#endif
#ifdef IPMIPMN_NOT_YET
ipmipmn_regext_mobnet_install,
#endif
IP_NULL
};
/*
****************************************************************************
* 9 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmipmn_configure
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err
ipmipmn_configure(void)
{
Ip_err err;
/* Initialize IPMIPMN system variables. */
if ((err = ipcom_sysvar_setv(ipmipmn_conf_sysvar, 0)) != IPCOM_SUCCESS)
return err;
#if defined(INCLUDE_IPMIPMN)
if ((err = ipcom_sysvar_ext_setv(ipmipmn_conf_sysvar_ext, 0)) != IPCOM_SUCCESS)
return err;
#endif
return IPCOM_SUCCESS;
}
/*
*===========================================================================
* ipmipha_init
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err ipmipmn_init(void);
IP_PUBLIC Ip_err
ipmipmn_init(void)
{
#if defined(INCLUDE_IPMIPMN_CMD) && !defined(IP_PORT_LAS)
(void)ipcom_shell_add_cmd("mn",
"mn <command> [modifiers]", "Mobile IP Mobile Node",
ipmipmn_cmd_mn,
IPCOM_PRIORITY_DEFAULT, IPCOM_PROC_STACK_SMALL);
#endif
return IPCOM_SUCCESS;
}
/*
*===========================================================================
* ipmipha_exit
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err ipmipmn_exit(void);
IP_PUBLIC Ip_err
ipmipmn_exit(void)
{
#if defined(INCLUDE_IPMIPMN_CMD) && !defined(IP_PORT_LAS)
(void)ipcom_shell_remove_cmd("mn", ipmipmn_cmd_mn);
#endif
return IPCOM_SUCCESS;
}
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,82 @@
/*
******************************************************************************
* INTERPEAK CONFIGURATION HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_config.h,v $ $Revision: 1.14 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/config/ipmipmn_config.h,v $
* $Author: jhorteli $ $Date: 2009-03-31 14:57:47 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Lennart Bang <lob@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_CONFIG_H
#define IPMIPMN_CONFIG_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 INCLUDE FILES
****************************************************************************
*/
#include <ipmip4_config.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 3 DEFINES
****************************************************************************
*/
#ifdef IP_DEBUG
#define IPMIPMN_EVENT_BACKLOG 300
#else
#define IPMIPMN_EVENT_BACKLOG 100
#endif
/*
*===========================================================================
* IPMIPMN_MAX_CHALLENGE_SIZE
*===========================================================================
* Maximum size of rfc3012 FA Challenge.
*/
#define IPMIPMN_MAX_CHALLENGE_SIZE 16
/*
****************************************************************************
* 4 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 5 FUNCTIONS
****************************************************************************
*/
extern Ipmip_init_func_t ipmipmn_function_registrations[];
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,171 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_pktbuf.c,v $ $Revision: 1.8 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/config/ipmipmn_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_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 "ipmipmn_h.h"
#include "ipmipmn_pktbuf.h"
#include "ipmipmn_if.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmipmn_pktbuf_alloc
*===========================================================================
* Description: Allocate a packet buffer
* Parameters:
* Returns: A newly allocated packet buffer
*
*/
IP_GLOBAL Ipmip_pktbuf_t *
ipmipmn_pktbuf_alloc(Ipmipmn_context_t *ctx,
Ipmip_proc_t *proc,
Ip_size_t extra)
{
Ipmipmn_pktbuf_t *pbuf = ipcom_calloc(1, sizeof(Ipmipmn_pktbuf_t) + extra);
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
if (pbuf)
{
pbuf->api.ipmip4.ipmip.pktend = (void *) (pbuf + 1);
return &pbuf->api.ipmip4.ipmip;
}
/* Return a Ipmipha_pktbuf_t */
return IP_NULL;
}
/*
*===========================================================================
* ipmipmn_pktbuf_free
*===========================================================================
* Description: Free a packet buffer
* Parameters: pbuf - The packet buffer
* Returns:
*
*/
IP_GLOBAL void
ipmipmn_pktbuf_free(Ipmipmn_context_t *ctx,
Ipmip_proc_t *proc,
Ipmipmn_pktbuf_t *pbuf)
{
ipmipmn_api_pktbuf_free(&ctx->api, proc, &pbuf->api);
if (pbuf->api.iff.priv != IP_NULL)
ipmipmn_if_release(ctx, proc, pbuf->api.iff.priv, IP_NULL);
/* Free the data */
ipcom_free(pbuf);
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,109 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_pktbuf.h,v $ $Revision: 1.7 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/config/ipmipmn_pktbuf.h,v $
* $Author: jhorteli $ $Date: 2009-04-01 18:34:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_PKTBUF_H
#define IPMIPMN_PKTBUF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmipmn_api_pktbuf.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmipmn_context;
typedef struct Ipmipmn_pktbuf
{
Ipmipmn_api_pktbuf_t api;
} Ipmipmn_pktbuf_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmipmn_pktbuf_alloc
*===========================================================================
* Description: Allocate a packet buffer
* Parameters: ctx - Context
* proc - Process
* Returns: A newly allocated packet buffer
*
*/
IP_GLOBAL Ipmip_pktbuf_t *ipmipmn_pktbuf_alloc(struct Ipmipmn_context *ctx,
struct Ipmip_proc *proc,
Ip_size_t extra);
/*
*===========================================================================
* ipmipmn_pktbuf_free
*===========================================================================
* Description: Free a packet buffer
* Parameters: ctx - Context
* proc - Process
* pbuf - The packet buffer
* Returns:
*
*/
IP_GLOBAL void ipmipmn_pktbuf_free(struct Ipmipmn_context *ctx,
struct Ipmip_proc *proc,
Ipmipmn_pktbuf_t *pbuf);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,404 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_regext_test.c,v $ $Revision: 1.4.16.1 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/config/ipmipmn_regext_test.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 "ipmipmn_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef IPTESTENGINE
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_err.h>
#include <ipcom_sysvar.h>
#include <ipcom_syslog.h>
#include <ipcom_shell.h>
#include <ipcom_route.h>
#include <ipnet.h>
#include <ipnet_radvd.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <private/ipmip_sysvar.h>
#include <ipmip4.h>
#include <private/ipmip4_context.h>
#include <private/ipmip4_util.h>
#include <private/ipmip4_sysext.h>
#include "ipmipmn.h"
#include "ipmipmn_h.h"
#include "ipmipmn_attr_h.h"
#include "ipmipmn_pktbuf.h"
#include "ipmipmn_if.h"
#include "ipmipmn_node.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIPMN_REGEXT_TEST_VENDOR_WR "VENDOR-WR"
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef struct Ipmipmn_regext_test_vendor_ext_wr_config_instance
{
union Ipmip4_msgext_uhdr *nvse_noop_mn;
union Ipmip4_msgext_uhdr *nvse_noop_fa;
union Ipmip4_msgext_uhdr *nvse_noop_ha;
union Ipmip4_msgext_uhdr *nvse_noop_all;
union Ipmip4_msgext_uhdr *cvse_noop_mn;
union Ipmip4_msgext_uhdr *cvse_noop_fa;
union Ipmip4_msgext_uhdr *cvse_noop_ha;
union Ipmip4_msgext_uhdr *cvse_noop_all;
} Ipmipmn_regext_test_vendor_ext_wr_config_instance_t;
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
static Ipmipmn_api_extension_t ipmipmn_regext_test_srv_wr;
static Ipmip4_msgext_vendor_parse_ext_t ipmipmn_regext_msgext_wr;
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC int
ipmipmn_regext_test_vendor_wr_parse(Ipmipmn_context_t *ctx,
Ipmip_proc_t *proc,
Ipmipmn_pktbuf_t *pbuf,
union Ipmip4_msgext_uhdr *uhdr,
Ipmipmn_regext_test_vendor_ext_wr_config_instance_t *wr)
{
Ip_size_t sz;
IPMIP_UNUSED_PARAMETER(pbuf);
/* There are no CISCO CVSE's */
if (IPMIP4_MSGEXT_UHDR_TYPE(uhdr) == IPMIP4_EXT_TYPE_CVSE)
{
Ipmip4_cvse_t *vse;
/* Get the CVSE data */
vse = (void *)IPMIP4_MSGEXT_LHDR_EXT_DATA(uhdr);
sz = IPMIP4_MSGEXT_CVSE_EXT_SIZE(uhdr);
switch (IP_GET_NTOHS(&vse->vendor_type))
{
case IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_MN:
/* Must be atleast 4 byte data */
if (sz < 4)
return IPMIP4_REG_EXT_POORLY_FORMED;
wr->cvse_noop_mn = uhdr;
IPMIP4_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->api.ipmip4.ipmip,
proc,
"Wind River Critical Vendor Extension Extension cvse_noop_mn"));
break;
case IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_ALL:
/* Must be atleast 4 byte data */
if (sz < 4)
return IPMIP4_REG_EXT_POORLY_FORMED;
wr->cvse_noop_all = uhdr;
IPMIP4_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->api.ipmip4.ipmip,
proc,
"Wind River Critical Vendor Extension Extension cvse_noop_all"));
break;
default:
IPMIP4_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->api.ipmip4.ipmip,
proc,
"Unknown Wind River Critical Vendor Extension Extension %d", IP_GET_NTOHS(&vse->vendor_type)));
return IPMIP4_REG_EXT_UNKNOWN_VSE;
}
}
else
{
Ipmip4_nvse_t *vse;
/* Get the NVSE data */
vse = (void *)IPMIP4_MSGEXT_SHDR_EXT_DATA(uhdr);
sz = IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr);
switch (IP_GET_NTOHS(&vse->vendor_type))
{
case IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_MN:
/* Must be atleast 4 byte data */
if (sz < 4)
return IPMIP4_REG_EXT_POORLY_FORMED;
wr->nvse_noop_mn = uhdr;
IPMIP4_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->api.ipmip4.ipmip,
proc,
"Wind River Normal Vendor Extension Extension nvse_noop_mn"));
break;
case IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_ALL:
/* Must be atleast 4 byte data */
if (sz < 4)
return IPMIP4_REG_EXT_POORLY_FORMED;
wr->nvse_noop_all = uhdr;
IPMIP4_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->api.ipmip4.ipmip,
proc,
"Wind River Normal Vendor Extension Extension nvse_noop_all"));
break;
default:
IPMIP4_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->api.ipmip4.ipmip,
proc,
"Unknown Wind River Normal Vendor Extension Extension %d", IP_GET_NTOHS(&vse->vendor_type)));
return IPMIP4_REG_EXT_UNKNOWN_VSE;
}
}
return IPMIP4_REG_EXT_SUCCESS;
}
IP_STATIC Ipmip4_msgext_uhdr_t *
ipmipmn_regext_test_vendor_wr_vse_wr(Ip_bool cvse,
Ip_u16 subtype,
const char *format,
...)
{
va_list ap;
char *value;
Ipmip4_msgext_uhdr_t *vse = IP_NULL;
va_start(ap, format);
value = ipmip_vsysvar(format, ap);
va_end(ap);
/**/
if (value)
{
if (cvse)
vse = ipmip4_sysext_cvse_alloc(IPMIP_SMI_WIND_RIVER,
subtype,
value,
ipcom_strlen(value));
else
vse = ipmip4_sysext_nvse_alloc(IPMIP_SMI_WIND_RIVER,
subtype,
value,
ipcom_strlen(value));
ipcom_free(value);
}
return vse;
}
IP_STATIC void
ipmipmn_regext_test_vendor_wr_req_mobile_home(struct Ipmipmn_context *ctx,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node_conf *conf,
Ipmipmn_regext_test_vendor_ext_wr_config_instance_t *inst_config,
void *node_config,
struct Ipmipmn_node *node,
Ip_bool deregister,
struct Ipmipmn_pktbuf *pbuf)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(conf);
IPMIP_UNUSED_PARAMETER(deregister);
IPMIP_UNUSED_PARAMETER(node_config);
IPMIP_UNUSED_PARAMETER(node);
if (inst_config->nvse_noop_mn)
ipmip4_msgext_buffer_append_shdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->nvse_noop_mn);
if (inst_config->cvse_noop_mn)
ipmip4_msgext_buffer_append_lhdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->cvse_noop_mn);
if (inst_config->nvse_noop_ha)
ipmip4_msgext_buffer_append_shdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->nvse_noop_ha);
if (inst_config->cvse_noop_ha)
ipmip4_msgext_buffer_append_lhdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->cvse_noop_ha);
if (inst_config->nvse_noop_fa)
ipmip4_msgext_buffer_append_shdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->nvse_noop_fa);
if (inst_config->cvse_noop_fa)
ipmip4_msgext_buffer_append_lhdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->cvse_noop_fa);
if (inst_config->nvse_noop_all)
ipmip4_msgext_buffer_append_shdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->nvse_noop_all);
if (inst_config->cvse_noop_all)
ipmip4_msgext_buffer_append_lhdr(&pbuf->api.ipmip4.ipmip.packet, inst_config->cvse_noop_all);
}
IP_STATIC void
ipmipmn_regext_test_vendor_wr_config(struct Ipmipmn_context *ctx,
struct Ipmip_proc *proc,
int action,
const char *pre,
const char *spec,
struct Ipmipmn_api_node_conf *conf,
Ipmipmn_regext_test_vendor_ext_wr_config_instance_t *inst_config,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(conf);
IPMIP_UNUSED_PARAMETER(request);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
inst_config->nvse_noop_mn = ipmipmn_regext_test_vendor_wr_vse_wr(IP_FALSE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_MN,
"%s.%snvse.wr.mn",
pre, spec);
inst_config->cvse_noop_mn = ipmipmn_regext_test_vendor_wr_vse_wr(IP_TRUE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_MN,
"%s.%scvse.wr.mn",
pre, spec);
inst_config->nvse_noop_ha = ipmipmn_regext_test_vendor_wr_vse_wr(IP_FALSE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_HA,
"%s.%snvse.wr.ha",
pre, spec);
inst_config->cvse_noop_ha = ipmipmn_regext_test_vendor_wr_vse_wr(IP_TRUE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_HA,
"%s.%scvse.wr.ha",
pre, spec);
inst_config->nvse_noop_fa = ipmipmn_regext_test_vendor_wr_vse_wr(IP_FALSE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_FA,
"%s.%snvse.wr.fa",
pre, spec);
inst_config->cvse_noop_fa = ipmipmn_regext_test_vendor_wr_vse_wr(IP_TRUE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_FA,
"%s.%scvse.wr.fa",
pre, spec);
inst_config->nvse_noop_all = ipmipmn_regext_test_vendor_wr_vse_wr(IP_FALSE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_ALL,
"%s.%snvse.wr.all",
pre, spec);
inst_config->cvse_noop_all = ipmipmn_regext_test_vendor_wr_vse_wr(IP_TRUE,
IPMIP4_VENDOR_EXT_MSGEXT_WINDRIVER_NOOP_ALL,
"%s.%scvse.wr.all",
pre, spec);
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
if (inst_config->nvse_noop_mn)
ipcom_free(inst_config->nvse_noop_mn);
if (inst_config->cvse_noop_mn)
ipcom_free(inst_config->cvse_noop_mn);
if (inst_config->nvse_noop_ha)
ipcom_free(inst_config->nvse_noop_ha);
if (inst_config->cvse_noop_ha)
ipcom_free(inst_config->cvse_noop_ha);
if (inst_config->nvse_noop_fa)
ipcom_free(inst_config->nvse_noop_fa);
if (inst_config->cvse_noop_fa)
ipcom_free(inst_config->cvse_noop_fa);
if (inst_config->nvse_noop_all)
ipcom_free(inst_config->nvse_noop_all);
if (inst_config->cvse_noop_all)
ipcom_free(inst_config->cvse_noop_all);
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
/* Could dump, but dont bother */
}
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmipmn_regext_test_install(void);
IP_GLOBAL void
ipmipmn_regext_test_install(void)
{
ipcom_memset(&ipmipmn_regext_test_srv_wr, 0, sizeof(ipmipmn_regext_test_srv_wr));
ipmipmn_regext_test_srv_wr.name = IPMIPMN_REGEXT_TEST_VENDOR_WR;
ipmipmn_regext_test_srv_wr.instance_data_size = sizeof(Ipmipmn_regext_test_vendor_ext_wr_config_instance_t);
ipmipmn_regext_test_srv_wr.config_instance = (Ipmipmn_api_extension_config_instance_t)ipmipmn_regext_test_vendor_wr_config;
ipmipmn_regext_test_srv_wr.pkt_req_mobile_home = (Ipmipmn_api_extension_pkt_req_mobile_home_t)ipmipmn_regext_test_vendor_wr_req_mobile_home;
ipmipmn_context_register_function(&ipmipmn_regext_test_srv_wr);
ipcom_memset(&ipmipmn_regext_msgext_wr, 0, sizeof(ipmipmn_regext_msgext_wr));
ipmipmn_regext_msgext_wr.vendor_id = IPMIP_SMI_WIND_RIVER;
ipmipmn_regext_msgext_wr.parse = (Ipmip4_msgext_parse_ext_t) ipmipmn_regext_test_vendor_wr_parse;
ipmipmn_regext_msgext_wr.pktaux.pktbuf_data_size = sizeof(Ipmipmn_regext_test_vendor_ext_wr_config_instance_t);
ipmipmn_msgext_vendor_parse_ext_register(&ipmipmn_regext_msgext_wr);
}
#else
IP_GLOBAL void ipmipmn_regext_test_install(void);
IP_GLOBAL void
ipmipmn_regext_test_install(void)
{
}
#endif
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,11 @@
IPTARGETS := lib
ifneq ($(IPMAKEFILE),)
include $(IPMAKEFILE)
else
include $(IPCOM_ROOT)/Makefile
endif
include ipmipmn.mk
include $(IPCOM_ROOT)/gmake/ipcom_make.mk
lib: dirs $(IPLIBFILE)
@@ -0,0 +1,176 @@
#############################################################################
# IPMIPMN.MK
#
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn.mk,v $ $Revision: 1.22 $
# $Source: /home/interpeak/CVSRoot/ipmipmn/gmake/ipmipmn.mk,v $
# $Author: jhorteli $ $Date: 2010-10-15 11:29:06 $
# $State: Exp $ $Locker: $
#
# Copyright 2000-2006 Interpeak AB (http://www.interpeak.se). All rights reserved.
#
#############################################################################
#
# Copyright (c) 2006 Wind River Systems, Inc.
#
# The right to copy, distribute, modify or otherwise make use
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
#
# modification history
# --------------------
# 01a,31aug06,kch Build ipmipmn_config.o only if $(SKIP_CONFIG) is either
# not defined or set to anything other than true.
#
ifeq ($(IPMIPMN),)
ifneq ($(IPCOM_USE_INET),no)
IPMIPMN := yes
#############################################################################
# PRODUCT
###########################################################################
IPPROD ?= ipmipmn
#############################################################################
# DEFINE
###########################################################################
IPDEFINE += -DIPMIPMN
#############################################################################
# INCLUDE
###########################################################################
IPINCLUDE += -I$(IPMIPMN_ROOT)/config
IPINCLUDE += -I$(IPMIPMN_ROOT)/include
IPINCLUDE += -I$(IPMIPMN_ROOT)/src
#############################################################################
# OBJECTS
###########################################################################
# Common files
IPLIBOBJECTS += ipmipmn_pktbuf.o
IPLIBOBJECTS += ipmipmn_regext_test.o
#IPLIBOBJECTS += ipmipmn_regext_mobnet.o
# Library files.
#IPLIBOBJECTS += ipmipmn_node.o
IPLIBOBJECTS += ipmipmn_api.o
IPLIBOBJECTS += ipmipmn_api_pktbuf.o
IPLIBOBJECTS += ipmipmn_api_node.o
IPLIBOBJECTS += ipmipmn_api_attr.o
IPLIBOBJECTS += ipmipmn_api_reg.o
IPLIBOBJECTS += ipmipmn_api_icmp.o
IPLIBOBJECTS += ipmipmn_api_cli.o
IPLIBOBJECTS += ipmipmn_main.o
IPLIBOBJECTS += ipmipmn_cli.o
IPLIBOBJECTS += ipmipmn_icmp.o
IPLIBOBJECTS += ipmipmn_node.o
IPLIBOBJECTS += ipmipmn_route.o
IPLIBOBJECTS += ipmipmn_if.o
IPLIBOBJECTS += ipmipmn_pkt.o
IPLIBOBJECTS += ipmipmn_attr.o
IPLIBOBJECTS += ipmipmn_reg.o
# SNMP
ifneq ($(WIND_IPNET),true)
IPLIBOBJECTS += ipmipmn_mip_mib.o
endif
ifneq ($(IPPORT),lkm)
# If las, don't include the entry point files.
ifneq ($(IPPORT),las)
# Entry point files.
IPLIBOBJECTS += ipmipmn.o
IPLIBOBJECTS += ipmipmn_cmd_mn.o
# Configuration
IPLIBOBJECTS_C += ipmipmn_config.o
endif # LAS
# Compiles the xxx_config.o if the $SKIP_CONFIG macro is either not defined
# or set to anything other than true.
ifneq ($(SKIP_CONFIG),true)
IPLIBOBJECTS += $(IPLIBOBJECTS_C)
endif
#############################################################################
# VPATH
###########################################################################
IPSRCDIRS += $(IPMIPMN_ROOT)/src $(IPMIPMN_ROOT)/config
#############################################################################
# LIB
###########################################################################
IPLIBS += $(IPLIBROOT)/libipmipmn.a
#############################################################################
# BINARIES
###########################################################################
ifeq ($(IPPORT),las)
# Path to binaries
IPCMDDIR := $(IPOBJDIR)/bin
IPDAEMONDIR := $(IPOBJDIR)/sbin
# List of shell commands to build
IPMIPMNCMDS = mn
_IPIPMIPMNCMDS = $(addprefix $(IPCMDDIR)/,$(IPMIPMNCMDS))
# List of daemons to build
IPMIPMND = mnd
_IPMIPMND = $(addprefix $(IPDAEMONDIR)/,$(IPMIPMND))
bin: $(_IPIPMIPMNCMDS) $(_IPMIPMND)
$(IPOBJDIR)/ipmipmn_cmd_mn.o: $(IPMIPMN_ROOT)/src/ipmipmn_cmd_mn.c
@$(IPECHO) "+++ Compiling IPMIPMN shell command $<"
$(IPVERB)$(IPCC) -Dipmipmn_cmd_mn=ipcom_cmd_entry_point $(IPCFLAGS) -o $@ $<
$(IPOBJDIR)/ipmipmn.o: $(IPMIPMN_ROOT)/src/ipmipmn.c
@$(IPECHO) "+++ Compiling IPMIPMN daemon $<"
$(IPVERB)$(IPCC) -Dipmipmn_proc=ipcom_daemon_entry_point -Dipmipmn_create=ipcom_daemon_create $(IPCFLAGS) -o $@ $<
$(IPOBJDIR)/ipmipmn_config.o: $(IPMIPMN_ROOT)/config/ipmipmn_config.c
@$(IPECHO) "+++ Compiling IPMIPMN configuration interface $<"
$(IPVERB)$(IPCC) -Dipmipmn_configure=ipcom_daemon_configure $(IPCFLAGS) -o $@ $<
# Linking shell commands and daemons
$(IPCMDDIR)/mn: $(IPOBJDIR)/ipmipmn_cmd_mn.o $(IPOBJDIR)/ipcom_shell_cmd_stub.o
@$(IPECHO) "+++ Linking IPMIPMN shell command $@"
$(IPVERB)$(IPLD) -o $@ $(IPLDFLAGS) $^ $(IPLIBS) $(IPLIBS) $(IPLIBS) $(IPLASTLIBS)
$(IPDAEMONDIR)/mnd: $(IPOBJDIR)/ipmipmn.o $(IPOBJDIR)/ipmipmn_config.o $(IPOBJDIR)/ipcom_daemon_stub.o
@$(IPECHO) "+++ Linking IPMIPMND daemon $@"
$(IPVERB)$(IPLD) -o $@ $(IPLDFLAGS) $^ $(IPLIBS) $(IPLIBS) $(IPLIBS) $(IPLASTLIBS)
endif # LAS
endif # LKM
endif # IPCOM_USE_INET
endif # IPMIPMN
###########################################################################
# END OF IPMIPMN.MK
###########################################################################
@@ -0,0 +1,74 @@
/* ipmipmn.h - ipmipmn.h *//*
******************************************************************************
* INTERPEAK HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn.h,v $ $Revision: 1.22 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/ipmipmn.h,v $
* $Author: jhorteli $ $Date: 2009-04-01 18:34:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Niklas Lundberg <n@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_H
#define IPMIPMN_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_ipd.h>
#include <ipcom_sock.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIPMN_RELEASE 60701
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,92 @@
/* ipmipmn_attr.h - ipmipmn_attr.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_attr.h,v $ $Revision: 1.17 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/ipmipmn_attr.h,v $
* $Author: jhorteli $ $Date: 2009-04-01 18:34:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_ATTR_H
#define IPMIPMN_ATTR_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_cli.h>
#include <private/ipmipmn_api_attr.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
IPMIPMN_CLI_NODE_GET = IPMIP_CLI_TYPE_BASE,
IPMIPMN_CLI_NODE_IF_SET,
IPMIPMN_CLI_DAEMON_IF_LU,
IPMIPMN_CLI_DAEMON_IF_LD,
IPMIPMN_CLI_NODE_LLH_MT
};
enum
{
IPMIPMN_CLI_ATTR_NODE_LLH_FA = IPMIPMN_CLI_API_ATTR_NODE_LAST,
IPMIPMN_CLI_ATTR_NODE_LLH_AP,
IPMIPMN_CLI_ATTR_NODE_MAX
};
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,281 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_cli.h,v $ $Revision: 1.1 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/ipmipmn_cli.h,v $
* $Author: jhorteli $ $Date: 2009-03-31 14:56:56 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_CLI_H
#define IPMIPMN_CLI_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip4_cli.h>
#include <private/ipmipmn_api_cli.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip_attr;
struct Ipmip_lladdr;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmipmn_cli_connect - ipmipmn_cli_connect
*
* Connect to the foreign agent daemon.
*
* Parameters:
* \is
* \i daemon_info
* Will be filled in by the function
* \ie
*
* RETURNS: IP_TRUE on success
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_cli_connect
(
Ipmip_cli_daemon_t *daemon_info
);
/*******************************************************************************
*
* ipmipmn_cli_node_get - ipmipmn_cli_node_get
*
* Retrieve information on a specific node
*
* Parameters:
* \is
* \i dameon
* Connection to the IPMIP6PM daemon
* \i req
* Request to use.
* \ie
*
* RETURNS: The RTA containing the node's attributes if found, or IP_NULL.
*
* ERRNO:
*
*/
IP_PUBLIC struct Ipmip_attr *ipmipmn_cli_node_get
(
Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req
);
/*******************************************************************************
*
* ipmipmn_cli_node_setif - ipmipmn_cli_node_setif
*
* Set a specific interface name to be used
*
* Parameters:
* \is
* \i dameon
* Connection to the IPMIP6PM daemon
* \i ifname
* Interface name
* \ie
*
* RETURNS: IP_TRUE on success
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_cli_node_setif
(
Ipmip_cli_daemon_t *daemon,
const char *ifname
);
/*******************************************************************************
*
* ipmipmn_cli_node_setif - ipmipmn_cli_node_setif
*
* Set a specific interface name to be used
*
* Parameters:
* \is
* \i dameon
* Connection to the IPMIP6PM daemon
* \i ifname
* Interface name
* \i fa
* foreign agent [may be set]
* \i ap
* access point [may be set]
* \ie
*
* RETURNS: IP_TRUE on success
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_cli_node_llh_mt
(
Ipmip_cli_daemon_t *daemon,
const char *ifname,
Ip_u32 fa,
Ip_u32 ap
);
/*******************************************************************************
*
* ipmipmn_cli_request_set_access_point - ipmipmn_cli_request_set_access_point
*
* Set an access point identifier in the request
*
* Parameters:
* \is
* \i req
* Daemon request structure
* \i ap
* The access point
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_PUBLIC void ipmipmn_cli_request_set_access_point
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 ap
);
/*******************************************************************************
*
* ipmipmn_cli_request_set_foreign_agent - ipmipmn_cli_request_set_foreign_agent
*
* Set an foreign agent identifier in the request
*
* Parameters:
* \is
* \i req
* Daemon request structure
* \i fa
* The foreign agent
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_PUBLIC void ipmipmn_cli_request_set_foreign_agent
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 fa
);
/*******************************************************************************
*
* ipmipmn_cli_daemon_if_link_up - ipmipmn_cli_daemon_if_link_up
*
* Set a specific interface up
*
* Parameters:
* \is
* \i dameon
* Connection to the IPMIP6PM daemon
* \i ifname
* Interface name
* \ie
*
* RETURNS: IP_TRUE on success
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_cli_daemon_if_link_up
(
Ipmip_cli_daemon_t *daemon,
const char *ifname
);
/*******************************************************************************
*
* ipmipmn_cli_daemon_if_link_down - ipmipmn_cli_daemon_if_link_down
*
* Set a specific interface down
*
* Parameters:
* \is
* \i dameon
* Connection to the IPMIP6PM daemon
* \i ifname
* Interface name
* \ie
*
* RETURNS: IP_TRUE on success
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_cli_daemon_if_link_down
(
Ipmip_cli_daemon_t *daemon,
const char *ifname
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,163 @@
/* ipmipmn_mib.h - ipmipmn_mib.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_mib.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/ipmipmn_mib.h,v $
* $Author: joel $ $Date: 2007-08-28 14:54:41 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_MIB_H
#define IPMIPMN_MIB_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIPMN_MIB_mnState_home (1)
#define IPMIPMN_MIB_mnState_registered (2)
#define IPMIPMN_MIB_mnState_pending (3)
#define IPMIPMN_MIB_mnState_isolated (4)
#define IPMIPMN_MIB_mnState_unknown (5)
#define IPMIPMN_MIB_mnAdvFlags_vjCompression (1)
#define IPMIPMN_MIB_mnAdvFlags_gre (1<<1)
#define IPMIPMN_MIB_mnAdvFlags_minEnc (1<<2)
#define IPMIPMN_MIB_mnAdvFlags_foreignAgent (1<<3)
#define IPMIPMN_MIB_mnAdvFlags_homeAgent (1<<4)
#define IPMIPMN_MIB_mnAdvFlags_busy (1<<5)
#define IPMIPMN_MIB_mnAdvFlags_regRequired (1<<6)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmipmn_mib_mnSystem
{
Ip_s32 mnState;
struct Ip_in_addr mnHomeAddress;
};
struct Ipmipmn_mib_mnHAEntry
{
struct Ip_in_addr mnHAAddress;
Ip_bool mnCurrentHA;
Ip_s32 mnHAStatus;
};
struct Ipmipmn_mib_mnFAEntry
{
struct Ip_in_addr mnFAAddress;
struct Ip_in_addr mnCOA;
};
struct Ipmipmn_mib_mnDiscovery
{
struct Ip_in_addr mnAdvSourceAddress;
Ip_s32 mnAdvSequence;
Ip_u32 mnAdvFlags;
Ip_s32 mnAdvMaxRegLifetime;
Ip_s32 mnAdvMaxAdvLifetime;
Ip_u32 mnAdvTimeReceived;
};
struct Ipmipmn_mib_mnDiscoveryCounters
{
Ip_u32 mnSolicitationsSent;
Ip_u32 mnAdvertisementsReceived;
Ip_u32 mnAdvsDroppedInvalidExtension;
Ip_u32 mnAdvsIgnoredUnknownExtension;
Ip_u32 mnMoveFromHAToFA;
Ip_u32 mnMoveFromFAToFA;
Ip_u32 mnMoveFromFAToHA;
Ip_u32 mnGratuitousARPsSend;
Ip_u32 mnAgentRebootsDectected;
};
struct Ipmipmn_mib_mnRegistrationEntry
{
struct Ip_in_addr mnRegAgentAddress;
struct Ip_in_addr mnRegCOA;
Ip_u32 mnRegFlags;
Ip_s32 mnRegIDLow;
Ip_s32 mnRegIDHigh;
Ip_s32 mnRegTimeRequested;
Ip_u32 mnRegTimeRemaining;
Ip_u32 mnRegTimeSent;
Ip_bool mnRegIsAccepted;
Ip_bool mnCOAIsLocal;
};
struct Ipmipmn_mib_mnRegistrationCounters
{
Ip_u32 mnRegRequestsSent;
Ip_u32 mnDeRegRequestsSent;
Ip_u32 mnRegRepliesRecieved;
Ip_u32 mnDeRegRepliesRecieved;
Ip_u32 mnRepliesInvalidHomeAddress;
Ip_u32 mnRepliesUnknownHA;
Ip_u32 mnRepliesUnknownFA;
Ip_u32 mnRepliesInvalidID;
Ip_u32 mnRepliesDroppedInvalidExtension;
Ip_u32 mnRepliesIgnoredUnknownExtension;
Ip_u32 mnRepliesHAAuthenticationFailure;
Ip_u32 mnRepliesFAAuthenticationFailure;
Ip_u32 mnRegRequestsAccepted;
Ip_u32 mnRegRequestsDeniedByHA;
Ip_u32 mnRegRequestsDeniedByFA;
Ip_u32 mnRegRequestsDeniedByHADueToID;
Ip_u32 mnRegRequestsWithDirectedBroadcast;
};
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,290 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api.h,v $
* $Author: jhorteli $ $Date: 2009-04-01 18:34:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_API_H
#define IPMIPMN_API_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipmipmn_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip4_msgext.h>
#include <private/ipmip4_context.h>
#include <private/ipmipmn_api_pktbuf.h>
#include <private/ipmipmn_api_attr.h>
#include <private/ipmipmn_api_node.h>
#include <private/ipmipmn_api_reg.h>
#include <private/ipmipmn_api_icmp.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/* Runmode */
#define IPMIPMN_API_RUNMODE_FA 1 /* MN uses the home address and lets the FA decapsulate packets */
#define IPMIPMN_API_RUNMODE_COLOCATED 2 /* MN got a new IP address and decapsulates tunneled packets */
#define IPMIPMN_API_DHAA_DISABLED 0
#define IPMIPMN_API_DHAA_ENABLED 1
#define IPMIPMN_API_DHAA_HOME 2
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmipmn_api_context;
struct Ipmipmn_api_node_conf;
typedef Ip_bool (*Ipmipmn_api_extension_pkt_rep_validate_t)
(
struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node_conf *conf,
void *inst_config,
void *node_config,
struct Ipmipmn_api_node *node,
struct Ipmipmn_api_pktbuf *pbuf
);
typedef void (*Ipmipmn_api_extension_pkt_rep_accepted_t)
(
struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node_conf *conf,
void *inst_config,
void *node_config,
struct Ipmipmn_api_node *node,
struct Ipmipmn_api_pktbuf *pbuf
);
typedef void (*Ipmipmn_api_extension_config_instance_t)
(
struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
int action,
const char *pre,
const char *spec,
struct Ipmipmn_api_node_conf *conf,
void *inst_config,
struct Ipmip_cli_message *request
);
typedef int (*Ipmipmn_api_extension_provide_t)
(
struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmipmn_api_node_conf *conf,
void *inst_config,
void *node_config,
struct Ipmipmn_api_node *node
);
typedef Ip_bool (*Ipmipmn_api_extension_setup_t)
(
struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmipmn_api_node_conf *conf,
void *inst_config,
void *node_config,
struct Ipmipmn_api_node *node,
struct Ipmip_cli_message *request
);
typedef void (*Ipmipmn_api_extension_pkt_req_mobile_home_t)
(
struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node_conf *conf,
void *inst_config,
void *node_config,
struct Ipmipmn_api_node *node,
Ip_bool deregister,
struct Ipmipmn_api_pktbuf *pbuf
);
typedef void (*Ipmipmn_api_extension_pkt_req_mobile_foreign_t)
(
struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node_conf *conf,
void *inst_config,
void *node_config,
struct Ipmipmn_api_node *node,
Ip_bool deregister,
struct Ipmipmn_api_pktbuf *pbuf
);
typedef struct Ipmipmn_api_extension
{
const char *name;
Ip_u32 node_data_size;
Ip_u32 instance_data_size;
/**/
Ipmip_pktbuf_payload_t pktaux;
/* Callbacks */
Ipmipmn_api_extension_config_instance_t config_instance;
Ipmipmn_api_extension_provide_t provide;
Ipmipmn_api_extension_setup_t setup;
Ipmipmn_api_extension_pkt_rep_validate_t pkt_rep_validate;
Ipmipmn_api_extension_pkt_rep_accepted_t pkt_rep_accepted;
Ipmipmn_api_extension_pkt_req_mobile_home_t pkt_req_mobile_home;
Ipmipmn_api_extension_pkt_req_mobile_foreign_t pkt_req_mobile_foreign;
/* Set by MN */
Ip_u32 type;
Ip_u32 func;
Ip_u32 unique;
} Ipmipmn_api_extension_t;
typedef struct Ipmipmn_api_function_context
{
Ipmipmn_api_extension_t *functions[32];
Ip_u32 num;
Ip_u32 node_data;
Ip_u32 mask;
Ip_u32 elem;
} Ipmipmn_api_function_context_t;
typedef struct Ipmipmn_api_context
{
Ipmip4_context_t ipmip4;
/* FD for communicating with the mobile node */
Ip_fd fd_ipd;
/* Function table */
Ipmipmn_api_node_functable_t *node_func;
Ipmipmn_api_node_state_functable_t *node_state_func;
Ipmipmn_api_function_context_t *functions;
}
Ipmipmn_api_context_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmipmn_api_init - ipmipmn_api_init
*
* Init the API section of a context
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i func
* Node function table
* \i state_func
* Node state function table
* \i reg_func
* Node registration function table
* \ie
*
* RETURNS:
*
* ERRNO:
*
* \NOMANUAL
*/
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
);
/*******************************************************************************
*
* ipmipmn_api_done - ipmipmn_api_done
*
* Free any resource allocate by the API section of the context
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \ie
*
* RETURNS:
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_done
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,212 @@
/* ipmipmn_attr.h - ipmipmn_attr.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_attr.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_attr.h,v $
* $Author: jhorteli $ $Date: 2009-04-23 14:13:50 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_API_ATTR_H
#define IPMIPMN_API_ATTR_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_cli.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
IPMIPMN_API_CLI_ATTR_NONE,
IPMIPMN_API_CLI_ATTR_NODE,
IPMIPMN_API_CLI_ATTR_LAST
};
enum
{
IPMIPMN_CLI_API_ATTR_NODE_NONE,
IPMIPMN_CLI_API_ATTR_NODE_MIPIFNAME,
IPMIPMN_CLI_API_ATTR_NODE_IFNAME,
IPMIPMN_CLI_API_ATTR_NODE_HOA,
IPMIPMN_CLI_API_ATTR_NODE_HOA_DYNAMIC,
IPMIPMN_CLI_API_ATTR_NODE_HA_DHAA,
IPMIPMN_CLI_API_ATTR_NODE_HA,
IPMIPMN_CLI_API_ATTR_NODE_HA_PENDING,
IPMIPMN_CLI_API_ATTR_NODE_TUNNEL_REVERSE,
IPMIPMN_CLI_API_ATTR_NODE_TUNNEL_TYPE,
IPMIPMN_CLI_API_ATTR_NODE_BROADCAST,
IPMIPMN_CLI_API_ATTR_NODE_LIFETIME,
IPMIPMN_CLI_API_ATTR_NODE_REMAINING,
IPMIPMN_CLI_API_ATTR_NODE_CREATED,
IPMIPMN_CLI_API_ATTR_NODE_UPDATED,
IPMIPMN_CLI_API_ATTR_NODE_STATUS,
IPMIPMN_CLI_API_ATTR_NODE_NAI,
IPMIPMN_CLI_API_ATTR_NODE_NAI_HA,
IPMIPMN_CLI_API_ATTR_NODE_NAI_AAAH,
IPMIPMN_CLI_API_ATTR_NODE_COA,
IPMIPMN_CLI_API_ATTR_NODE_EXTENSION,
IPMIPMN_CLI_API_ATTR_NODE_LAST
};
enum
{
IPMIPMN_CLI_API_ATTR_NODE_EXTENSION_NONE,
IPMIPMN_CLI_API_ATTR_NODE_EXTENSION_NAME,
IPMIPMN_CLI_API_ATTR_NODE_EXTENSION_DATA,
IPMIPMN_CLI_API_ATTR_NODE_EXTENSION_MAX
};
enum
{
IPMIPMN_CLI_API_ATTR_NODE_COA_NONE,
IPMIPMN_CLI_API_ATTR_NODE_COA_INET,
IPMIPMN_CLI_API_ATTR_NODE_COA_PEER,
IPMIPMN_CLI_API_ATTR_NODE_COA_TYPE,
IPMIPMN_CLI_API_ATTR_NODE_COA_DOWN,
IPMIPMN_CLI_API_ATTR_NODE_COA_MOBIKE,
IPMIPMN_CLI_API_ATTR_NODE_COA_RETRANSMITS,
IPMIPMN_CLI_API_ATTR_NODE_COA_TUNNEL_FLAGS,
IPMIPMN_CLI_API_ATTR_NODE_COA_CHALLENGE,
IPMIPMN_CLI_API_ATTR_NODE_COA_LLH,
IPMIPMN_CLI_API_ATTR_NODE_COA_SPI_MF,
IPMIPMN_CLI_API_ATTR_NODE_COA_SPI_MH,
IPMIPMN_CLI_API_ATTR_NODE_COA_LAST
};
/* States */
enum
{
IPMIPMN_ATTR_STATE_HALTED = 0,
IPMIPMN_ATTR_STATE_BOOTING,
IPMIPMN_ATTR_STATE_ISOLATED,
IPMIPMN_ATTR_STATE_PENDING,
IPMIPMN_ATTR_STATE_REGISTERED,
IPMIPMN_ATTR_STATE_HOME
};
#define IPMIPMN_ATTR_HA_DISCOVERY_NONE 0
#define IPMIPMN_ATTR_HA_DISCOVERY_RFC3344 1
#define IPMIPMN_ATTR_HA_DISCOVERY_RFC4433_NO_PREFERENCE 2
#define IPMIPMN_ATTR_HA_DISCOVERY_RFC4433_HOME_PREFERENCE 3
#define IPMIPMN_ATTR_HA_DISCOVERY_RFC4433_DISABLED 4
enum
{
IPMIPMN_ATTR_PEER_HOME_AGENT = 0,
IPMIPMN_ATTR_PEER_FOREIGN_AGENT
};
/* Current types */
enum
{
IPMIPMN_ATTR_COA_CCOA = 0,
IPMIPMN_ATTR_COA_SCOA_TIA,
IPMIPMN_ATTR_COA_SCOA_PROTECTED,
IPMIPMN_ATTR_COA_FA,
IPMIPMN_ATTR_COA_FA_LLH,
IPMIPMN_ATTR_COA_HA,
IPMIPMN_ATTR_COA_SCOA_DEAD,
IPMIPMN_ATTR_COA_MAX,
IPMIPMN_ATTR_COA_NONE = -1
};
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmipmn_api_context;
struct Ipmip_proc;
struct Ipmip_cli_message;
struct Ipmipmn_api_node;
struct Ipmipmn_api_node_conf;
extern IP_CONST char *ipmipmn_api_attr_statename[];
extern IP_CONST char *ipmipmn_api_attr_peername[];
extern IP_CONST char *ipmipmn_api_attr_coaname[];
extern IP_CONST char *ipmipmn_api_attr_dhaa[];
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmipmn_api_attr_node_coa_dump
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
struct Ipmip_cli_message *request,
struct Ipmipmn_api_node *node
);
IP_GLOBAL void ipmipmn_api_attr_node_dump
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
struct Ipmip_cli_message *request,
struct Ipmipmn_api_node *node
);
IP_GLOBAL void ipmipmn_api_attr_config_dump
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
struct Ipmip_cli_message *request,
struct Ipmipmn_api_node_conf *confp,
const char *pre,
const char *spec
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,812 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_cli.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_cli.h,v $
* $Author: jhorteli $ $Date: 2009-12-02 08:50:47 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_API_CLI_H
#define IPMIPMN_API_CLI_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip4_cli.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip_attr;
struct Ipmip_lladdr;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmipmn_api_cli_request_set_ifname - ipmipmn_api_cli_request_set_ifname
*
* Set an IFNAME identifier in the request
*
* Parameters:
* \is
* \i req
* Daemon request structure
* \i ifname
* Interface name
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_PUBLIC void ipmipmn_api_cli_request_set_ifname
(
Ipmip_cli_daemon_req_t *req,
const char *ifname
);
/*******************************************************************************
*
* ipmipmn_api_cli_request_set_nai - ipmipmn_api_cli_request_set_nai
*
* Set an NAI identifier in the request
*
* Parameters:
* \is
* \i req
* Daemon request structure
* \i nai
* Mobile Nai
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_PUBLIC void ipmipmn_api_cli_request_set_nai
(
Ipmip_cli_daemon_req_t *req,
const char *nai
);
/*******************************************************************************
*
* ipmipmn_api_cli_request_set_home_address - ipmipmn_api_cli_request_set_home_address
*
* Set the Home Address identifier in the request
*
* Parameters:
* \is
* \i req
* Daemon request structure
* \i hoa
* Home Address
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_PUBLIC void ipmipmn_api_cli_request_set_home_address
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 hoa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_home_agent - ipmipmn_api_cli_node_get_home_agent
*
* Returns the home agent of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The home agent or zero if not found
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_home_agent
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_home_agent_pending - ipmipmn_api_cli_node_get_home_agent_pending
*
* Returns the pending home agent of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The home agent or zero if not found
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_home_agent_pending
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_home_agent_dhaa - ipmipmn_api_cli_node_get_home_agent_dhaa
*
* Returns the home agent DHAA setting of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The home agent DHAA or zero if not found
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_home_agent_dhaa
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_home_address - ipmipmn_api_cli_node_get_home_address
*
* Returns the home address of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The home address or zero if not found
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_home_address
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_home_address_dynamic - ipmipmn_api_cli_node_get_home_address_dynamic
*
* Returns IP_TRUE if the home address of the node is dynamically allocated
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: IP_TRUE if the home address is dynamically allocated
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_api_cli_node_get_home_address_dynamic
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_ifname - ipmipmn_api_cli_node_get_ifname
*
* Returns the interface of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The interface name or zero if not found
*
* ERRNO:
*
*/
IP_PUBLIC const char *ipmipmn_api_cli_node_get_ifname
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_mipifname - ipmipmn_api_cli_node_get_mipifname
*
* Returns the mobile tunnel interface of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The mobile tunnel interface name or zero if not found
*
* ERRNO:
*
*/
IP_PUBLIC const char *ipmipmn_api_cli_node_get_mipifname
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_tunnel_reverse - ipmipmn_api_cli_node_get_tunnel_reverse
*
* Returns the Reverse Tunneling setting
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: IP_TRUE if reverse tunneling is used
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_api_cli_node_get_tunnel_reverse
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_tunnel_type - ipmipmn_api_cli_node_get_tunnel_type
*
* Returns the Tunneling Type setting
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The tunneling type
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_tunnel_type
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_receive_broadcast - ipmipmn_api_cli_node_get_receive_broadcast
*
* Returns the broadcast setting
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: IP_TRUE if broadcast is received
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_api_cli_node_get_receive_broadcast
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_time_requested - ipmipmn_api_cli_node_get_time_requested
*
* Returns the requested time of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The granted time
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_time_requested
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_time_remaining - ipmipmn_api_cli_node_get_time_remaining
*
* Returns the remaining time of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The remaining time
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_time_remaining
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_created - ipmipmn_api_cli_node_get_created
*
* Returns the time when the node was created
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The creation time or zero if not found
*
* ERRNO:
*
*/
IP_PUBLIC Ip_time_t ipmipmn_api_cli_node_get_created
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_last_updated - ipmipmn_api_cli_node_get_last_updated
*
* Returns the time the node was last updated
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The last updated time
*
* ERRNO:
*
*/
IP_PUBLIC Ip_time_t ipmipmn_api_cli_node_get_last_updated
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_status - ipmipmn_api_cli_node_get_status
*
* Returns the node's status
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The status
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_get_status
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get - ipmipmn_api_cli_node_coa_get
*
* Returns the node's coa properties
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The CoA property block
*
* ERRNO:
*
*/
IP_PUBLIC struct Ipmip_attr *ipmipmn_api_cli_node_coa_get
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_address - ipmipmn_api_cli_node_coa_get_address
*
* Returns the coa's address
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: The CoA Address
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_coa_get_address
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_peer - ipmipmn_api_cli_node_coa_get_peer
*
* Returns the coa's peer
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: The CoA Peer
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_coa_get_peer
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_type - ipmipmn_api_cli_node_coa_get_type
*
* Returns the coa's type
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: The CoA Type
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_coa_get_type
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_down - ipmipmn_api_cli_node_coa_get_down
*
* Returns the coa's downstatus
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: IP_TRUE if the CoA is down
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_api_cli_node_coa_get_down
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_mobike - ipmipmn_api_cli_node_coa_get_mobike
*
* Returns the coa's mobike status
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: IP_TRUE if the CoA is mobiked
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_api_cli_node_coa_get_mobike
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_retransmits - ipmipmn_api_cli_node_coa_get_retransmits
*
* Returns the coa's retransmits
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: The number of retransmits
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_coa_get_retransmits
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_tunnel_flags - ipmipmn_api_cli_node_coa_get_tunnel_flags
*
* Returns the tunneling flags of the node
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: The tunneling flags
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_coa_get_tunnel_flags
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_challenge - ipmipmn_api_cli_node_coa_get_challenge
*
* Returns the coa's challenge status
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: IP_TRUE if the CoA uses challenges
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_api_cli_node_coa_get_challenge
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_llh - ipmipmn_api_cli_node_coa_get_llh
*
* Returns the coa's LLH status
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: IP_TRUE if the CoA is in LLH mode
*
* ERRNO:
*
*/
IP_PUBLIC Ip_bool ipmipmn_api_cli_node_coa_get_llh
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_spi_mf - ipmipmn_api_cli_node_coa_get_spi_mf
*
* Returns the SPI Mobile Foreign
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: The SPI MF or 0
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_coa_get_spi_mf
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_coa_get_spi_mh - ipmipmn_api_cli_node_coa_get_spi_mh
*
* Returns the SPI Mobile Home
*
* Parameters:
* \is
* \i coa
* rta containing the coa attributes
* \ie
*
* RETURNS: The SPI MH or 0
*
* ERRNO:
*
*/
IP_PUBLIC Ip_u32 ipmipmn_api_cli_node_coa_get_spi_mh
(
struct Ipmip_attr *coa
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_nai - ipmipmn_api_cli_node_get_nai
*
* Returns the Mobile NAI of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The mobile NAI or IP_NULL
*
* ERRNO:
*
*/
IP_PUBLIC const char *ipmipmn_api_cli_node_get_nai
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_nai_ha - ipmipmn_api_cli_node_get_nai_ha
*
* Returns the HA NAI of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The HA NAI or IP_NULL
*
* ERRNO:
*
*/
IP_PUBLIC const char *ipmipmn_api_cli_node_get_nai_ha
(
struct Ipmip_attr *node
);
/*******************************************************************************
*
* ipmipmn_api_cli_node_get_nai_aaah - ipmipmn_api_cli_node_get_nai_aaah
*
* Returns the AAAH NAI of the node
*
* Parameters:
* \is
* \i node
* rta containing the node attributes
* \ie
*
* RETURNS: The AAAH NAI or IP_NULL
*
* ERRNO:
*
*/
IP_PUBLIC const char *ipmipmn_api_cli_node_get_nai_aaah
(
struct Ipmip_attr *node
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,169 @@
/* ipmipmn_if.h - ipmipmn_if.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_coa.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_coa.h,v $
* $Author: jhorteli $ $Date: 2009-04-23 14:13:50 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_COA_API_H
#define IPMIPMN_COA_API_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip4_if.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip_proc;
struct Ipmipmn_api_coa;
typedef int (*Ipmipmn_api_coa_output_t)
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node *node,
struct Ipmipmn_api_pktbuf *pbuf,
struct Ipmipmn_api_coa *coa,
Ip_bool deregister,
Ip_u32 src,
Ip_u32 dst,
void *extarg
);
typedef struct Ipmipmn_api_coa_fa
{
Ip_u16 adv_seq;
Ip_u16 adv_flags;
Ip_u16 lifetime;
Ip_u32 seen;
Ip_bool revoked;
Ipmip_lladdr_t *lladdr;
Ipmip_lladdr_t *lladdr_llh;
Ipmip4_msgext_uhdr_t *challenge;
Ipmip_timer_t timer;
} Ipmipmn_api_coa_fa_t;
typedef struct Ipmipmn_api_coa_ha
{
Ip_u16 lifetime;
Ip_u8 verify;
Ip_u8 __reserved;
Ipmip_lladdr_t *lladdr;
Ipmip_timer_t timer;
} Ipmipmn_api_coa_ha_t;
typedef struct Ipmipmn_api_coa_tia
{
Ip_u32 local_address;
Ip_u32 ike_address;
Ip_bool mobiked;
} Ipmipmn_api_coa_tia_t;
typedef struct Ipmipmn_api_coa_ccoa
{
Ip_bool ike_reconfigure;
Ip_bool ike_mobility;
} Ipmipmn_api_coa_ccoa_t;
typedef union Ipmipmn_api_coa_params
{
Ipmipmn_api_coa_fa_t fa;
Ipmipmn_api_coa_ha_t ha;
Ipmipmn_api_coa_tia_t tia;
Ipmipmn_api_coa_ccoa_t ccoa;
} Ipmipmn_api_coa_params_t;
typedef struct Ipmipmn_api_coa
{
Ipcom_list next;
/**/
Ip_u32 type;
Ip_u32 addr;
char *name;
Ip_u32 peer;
int route_reverse;
int route_ro;
/* Not seen since we've lost interface */
Ip_bool down;
Ip_bool sysref;
Ip_bool unreliable;
/* Number of current references; protected by the interface's
* lock
*/
Ip_u32 refcnt;
/* Notifier entry used for modification and verification */
Ip_u32 timestamp;
/**/
Ipmipmn_api_coa_output_t output;
/* Lock used for protecting COA information */
Ipmipmn_api_coa_params_t params;
} Ipmipmn_api_coa_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,114 @@
/* ipmipmn_adv.h - ipmipmn_adv.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_icmp.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_icmp.h,v $
* $Author: jhorteli $ $Date: 2008-03-07 13:28:42 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_API_ICMP_H
#define IPMIPMN_API_ICMP_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;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmipmn_api_icmp_solicit - ipmipmn_api_icmp_solicit
*
* Send a solicitation request.
*
* Parameters:
* \is
* \i data
* The context
* \i proc
* Current process.
* \i node
* Node
* \i iff
* Interface
* \i lla
* Optional LLA extension.
* \i udir
* Destination MAC address
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_icmp_solicit
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node *node,
Ipmip4_if_t *iff,
Ipmip_lladdr_t *lladdr,
Ipmip_lladdr_t *ulladdr
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,688 @@
/* ipmipmn_node.h - ipmipmn_node.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_node.h,v $ $Revision: 1.13 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_node.h,v $
* $Author: jhorteli $ $Date: 2010-10-15 11:28:40 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_NODE_GENERIC_H
#define IPMIPMN_NODE_GENERIC_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmipmn_api_coa.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIPMN_API_NODE_NAME(data, proc, node) \
((*(data)->node_func->node_name)(proc, node))
#define IPMIPMN_API_NODE_STATE_GET(data, proc, node, why) \
((*(data)->node_func->state_get)(data, proc, node, why))
#define IPMIPMN_API_NODE_DESTROY(data, proc, node) \
((*(data)->node_func->destroy_node)(data, proc, node))
#define IPMIPMN_API_NODE_STATE_CALL(data, proc, node, state_call) \
(data)->node_state_func->state_call? ((*(data)->node_state_func->state_call)(data, proc, node)) : 0
#define IPMIPMN_API_NODE_FINDBYKEY(data, proc, pbuf, timer, func, arg1) \
(*(data)->node_func->findbykey) (data, proc, pbuf, timer, func, arg1)
#define IPMIPMN_API_CONF_COMPARE_EQUAL 0
#define IPMIPMN_API_CONF_COMPARE_SECONDARY 1
#define IPMIPMN_API_CONF_COMPARE_PRIMARY 2
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmipmn_api_node;
struct Ipmipmn_api_context;
/* Node major functions */
typedef void (*Ipmipmn_api_node_func_set_coa_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node,
Ipmipmn_api_coa_t *coa
);
typedef int (*Ipmipmn_api_node_func_state_get_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node,
char **why
);
typedef const char *(*Ipmipmn_api_node_func_node_name_t)
(
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef const char *(*Ipmipmn_api_node_func_node_destroy_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef int (*Ipmipmn_api_node_func_node_ifindex_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef void (*Ipmipmn_api_node_findbykey_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_pktbuf *pbuf,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg1
);
enum
{
IPMIPMN_NODE_ATTR_FUNC_STATUS,
IPMIPMN_NODE_ATTR_FUNC_CONF,
IPMIPMN_NODE_ATTR_FUNC_EXT,
IPMIPMN_NODE_ATTR_FUNC_COA,
};
typedef void (*Ipmipmn_node_status_attributes_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
int block,
struct Ipmip_buffer *reply,
struct Ipmipmn_api_node *node
);
typedef struct Ipmipmn_api_node_functable
{
Ipmipmn_api_node_func_set_coa_t set_coa;
Ipmipmn_api_node_func_state_get_t state_get;
Ipmip_timer_lock_event_func_t node_lock;
Ipmipmn_api_node_func_node_name_t node_name;
Ipmipmn_api_node_func_node_destroy_t destroy_node;
Ipmipmn_api_node_findbykey_t findbykey;
} Ipmipmn_api_node_functable_t;
/* Node state transitions */
typedef int (*Ipmipmn_api_node_state_func_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef struct Ipmipmn_api_node_state_functable
{
Ipmipmn_api_node_state_func_t booting_up_init;
Ipmipmn_api_node_state_func_t booting_up_exit;
Ipmipmn_api_node_state_func_t booting_down_init;
Ipmipmn_api_node_state_func_t booting_down_exit;
Ipmipmn_api_node_state_func_t isolated_up_init;
Ipmipmn_api_node_state_func_t isolated_up_exit;
Ipmipmn_api_node_state_func_t isolated_down_init;
Ipmipmn_api_node_state_func_t isolated_down_exit;
Ipmipmn_api_node_state_func_t pending_up_init;
Ipmipmn_api_node_state_func_t pending_up_exit;
Ipmipmn_api_node_state_func_t pending_down_init;
Ipmipmn_api_node_state_func_t pending_down_exit;
Ipmipmn_api_node_state_func_t registered_up_init;
Ipmipmn_api_node_state_func_t registered_down_exit;
} Ipmipmn_api_node_state_functable_t;
/*
*===========================================================================
* IPMIPMN data
*===========================================================================
*/
typedef struct Ipmipmn_api_node_conf_security
{
/* SPI lookup tables */
Ipmip4_auth_context_t *spi_ctx_fa;
Ipmip4_auth_context_t *spi_ctx_ha;
Ipmip4_auth_spi_table_t *spi_fa; /* FA SPI */
Ipmip4_auth_spi_table_t *spi_ha; /* MN SPI */
Ipmip4_auth_spi_t *aaa; /* AAA SPI */
} Ipmipmn_api_node_conf_security_t;
/* Changing the config data below requires a complete reboot */
typedef struct Ipmipmn_api_node_conf_primary
{
Ip_u32 home_agent; /* home agent address */
Ip_bool dhaa;
}
Ipmipmn_api_node_conf_primary_t;
/* Changing this config data allows current connections to survive */
typedef struct Ipmipmn_api_node_conf_secondary
{
Ip_u32 sol_address; /* router solicitation address */
Ip_bool receive_broadcasts;
Ip_bool reverse_tunneling;
Ip_u16 lifetime; /* registration lifetime in host endian */
Ip_s8 tunneltype;
}
Ipmipmn_api_node_conf_secondary_t;
typedef struct Ipmipmn_api_node_conf
{
Ipmipmn_api_node_conf_primary_t primary;
Ipmipmn_api_node_conf_secondary_t secondary;
Ipmipmn_api_node_conf_security_t security;
void *extdata[32];
}
Ipmipmn_api_node_conf_t;
typedef struct Ipmipmn_api_node_capture
{
Ipcom_list next;
/* Prefix to capture */
Ip_u32 prefix;
Ip_u32 prefix_length;
} Ipmipmn_api_node_capture_t;
typedef struct Ipmipmn_api_node_params
{
Ip_u32 assigned_home_address; /* home address */
Ip_u32 pending_home_address; /* pending home address */
Ip_u32 assigned_home_agent; /* assigned home agent */
Ip_u32 pending_home_agent; /* pending home agent */
Ip_u32 redirect_home_agent; /* redirect home agent */
Ip_u32 home_netmask; /* home network mask */
Ip_u32 home_gateway; /* home default gateway */
int dhaa;
int reverse_tunnel;
Ip_u16 resends;
Ip_time_t created;
Ip_time_t updated;
Ip_u32 tv_sec_offset;
Ip_u32 last_id1;
Ip_u32 last_tv;
/* Registration information */
int mnRegState;
Ip_u16 mnRegTimeGranted;
Ip_u8 mnRegTunnelFlags;
Ipmip_timer_t mnRegTimer; /* Registration timeout */
Ipmip_timer_t mnRegPendingTimer; /* Pending registration timeout */
Ipmip_timer_t mnRegReRegTimer; /* Pending registration timeout */
Ipmipmn_api_coa_t *mnRegCoA;
Ipmip4_msgext_uhdr_t *mnChallenge;
Ipmip4_msgext_uhdr_t *mnChallengeAdv;
Ip_u16 mnRequestedLifetime;
int mnReverseTunnel;
Ip_u8 mnChallengeRequire;
Ip_u8 mnRegTunnelType;
Ip_u8 mnRegLowLatency;
Ip_u8 mnRegNoResend;
Ip_u32 mnRegRevocationTimestamp;
struct Ipmipmn_api_pktbuf *mnRegReq;
struct Ipmip4_auth_spi *mnRegSPIMobileHome;
struct Ipmip4_auth_spi *mnRegSPIMobileForeign;
struct Ipmip4_if *pubIf;
/**/
#if 0
Ipmipmn_attr_node_stats_t stats;
#endif
Ipmip4_msgext_uhdr_t *nai_ha; /* Runtime value for nai_ha */
Ipmip4_msgext_uhdr_t *nai_aaah; /* Runtime value for nai_aaah */
Ipmip4_msgext_uhdr_t *nai_mn; /* Runtime value for nai_mn */
}
Ipmipmn_api_node_params_t;
typedef struct Ipmipmn_api_node
{
/* Configuration */
Ipmipmn_api_node_conf_t *conf;
/* Node lock */
Ipmip_timer_lock_t *lock;
Ipmip_timer_t service;
Ip_u32 supported;
Ip_u32 enabled;
void **extdata;
/* Home agent parameters */
Ipmipmn_api_node_params_t params;
} Ipmipmn_api_node_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmipmn_api_node_state_update - ipmipmn_api_node_state_update
*
* Update state.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* Node to change state for
* \i new_state
* The new state
* \i format
* Format string for the state change reason
* \i ...
* Format arguments
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_state_update
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node,
int new_state,
const char *format,
...
);
/*******************************************************************************
*
* ipmipmn_node_api_reregister - ipmipmn_node_api_reregister
*
* Do send a re-registration
*
* Parameters:
* \is
* \i event
* A timer event
* \i data
* Context
* \i proc
* Current process
* \i node
* Node to re-register
* \i extarg
* Extra opaque argument
* \ie
*
* RETURNS: One of the timer codes
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmipmn_api_node_reregister
(
int event,
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node,
void *extarg
);
/*******************************************************************************
*
* ipmipmn_api_node_registration_timeout - ipmipmn_api_node_registration_timeout
*
* Timeout a registration
*
* Parameters:
* \is
* \i event
* A timer event
* \i data
* Context
* \i proc
* Current process
* \i node
* Node to timeout
* \i extarg
* Extra opaque argument
* \ie
*
* RETURNS: One of the timer codes
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmipmn_api_node_registration_timeout
(
int event,
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node,
void *extarg
);
/*******************************************************************************
*
* ipmipmn_api_node_alloc - ipmipmn_api_node_alloc
*
* Create a node.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i sz
* Node size
* \ie
*
* RETURNS: The allocated node.
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL Ipmipmn_api_node_t * ipmipmn_api_node_alloc
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ip_size_t sz
);
/*******************************************************************************
*
* ipmipmn_api_node_destroy - ipmipmn_api_node_destroy
*
* Destroy a node.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_destroy
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
/*******************************************************************************
*
* ipmipmn_api_node_config_read - ipmipmn_api_node_config_read
*
* Read the current configuration
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i confp
* Configuration block to fill in.
* \i pre
* Pre sysvar header.
* \i spec
* Configuration specification.
* \ie
*
* RETURNS: IP_TRUE on success.
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL Ip_bool ipmipmn_api_node_config_read
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_conf_t *confp,
const char *pre,
const char *spec
);
/*******************************************************************************
*
* ipmipmn_api_node_config_free - ipmipmn_api_node_config_free
*
* Destroy a config instance
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i confp
* The configuration instance
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_config_free
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_conf_t *confp
);
/*******************************************************************************
*
* ipmipmn_api_node_config_compare - ipmipmn_api_node_config_compare
*
* Destroy a config instance
*
* Parameters:
* \is
* \i conf1
* Configuration instance 1
* \i conf2
* Configuration instance 2
* \i reason
* If -1 or 1 was returned, the reason states why.
* \ie
*
* RETURNS: IPMIPMN_API_CONF_COMPARE_EQUAL, IPMIPMN_API_CONF_COMPARE_SECONDARY
* or IPMIPMN_API_CONF_COMPARE_PRIMARY
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmipmn_api_node_config_compare
(
Ipmipmn_api_node_conf_t *conf1,
Ipmipmn_api_node_conf_t *conf2,
const char **reason
);
/*******************************************************************************
*
* ipmipmn_api_node_reset_home_agent - ipmipmn_api_node_reset_home_agent
*
* Reset the home agent parameters to their default value based on
* current configuration
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_reset_home_agent
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
/*******************************************************************************
*
* ipmipmn_api_node_runtime_free - ipmipmn_api_node_runtime_free
*
* Free and reset allocated runtime parameters.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_runtime_free
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
/*******************************************************************************
*
* ipmipmn_api_node_free_coa - ipmipmn_api_node_free_coa
*
* Free and reset parameters allocated for the current CoA
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_free_coa
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,173 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_pktbuf.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_pktbuf.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_API_PKTBUF_H
#define IPMIPMN_API_PKTBUF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip4_pktbuf.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef struct Ipmipmn_api_pktbuf_reginfo
{
Ip_u32 mnRegRegIDLow;
Ip_u32 mnRegSPIMobileForeign;
Ip_u32 mnRegSPIMobileHome;
Ip_u8 mnRegTunnelFlags;
Ip_u8 mnRegTunnelType;
Ip_u8 mnRegFlags;
Ip_u8 mnRegReRegistration;
} Ipmipmn_api_pktbuf_reginfo_t;
typedef struct Ipmipmn_api_pktbuf_pktinfo
{
Ip_u8 mnRegRegType;
Ip_u8 mnRegErrorCode;
Ip_u8 mnRegFAErrorCode;
Ip_u8 mnRegParsingState;
Ip_u32 mnRegHomeAddress;
Ip_u32 mnRegHomeAgentAddress;
Ip_u32 mnRegRegIDHigh;
Ip_u16 mnRegTimeGranted;
Ip_u16 mnRegNATTraversalKeepAlive;
Ip_u16 mnRegOptions;
Ip_u32 mnRegRevocationTimeStamp;
Ip_u32 mnRegCOA;
} Ipmipmn_api_pktbuf_pktinfo_t;
typedef struct Ipmipmn_api_pktbuf_advinfo
{
Ip_u16 lifetime;
Ip_u16 flags;
Ip_u16 adv_seq;
Ip_u32 coa;
} Ipmipmn_api_pktbuf_advinfo_t;
struct Ipmip4_if;
struct Ipmipmn_api_node;
struct Ipmipmn_api_pktbuf;
struct Ipmip_proc;
struct Ipmipmn_api_context;
struct Ipmipmn_api_iff;
typedef int (*Ipmipmn_api_pktbuf_output_t)
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node *node,
struct Ipmipmn_api_pktbuf *pbuf,
Ip_bool deregister,
Ip_u32 src,
Ip_u32 dst
);
typedef struct Ipmipmn_api_pktbuf
{
Ipmip4_pktbuf_t ipmip4;
Ip_u32 from;
Ip_u32 to;
Ip_u32 processed;
/* The arriving interface */
union
{
struct Ipmipmn_api_iff *priv;
struct Ipmip4_if *pub;
} iff;
/* The received reply for a request */
Ipmipmn_api_pktbuf_pktinfo_t pktinfo;
Ipmipmn_api_pktbuf_reginfo_t reginfo;
Ipmipmn_api_pktbuf_advinfo_t advinfo;
struct Ipmip4_auth_spi *mnRegSPIMobileHome;
struct Ipmip4_auth_spi *mnRegSPIMobileForeign;
} Ipmipmn_api_pktbuf_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmipmn_pktbuf_free
*===========================================================================
* Description: Free a packet buffer
* Parameters: ctx - Context
* proc - Process
* pbuf - The packet buffer
* Returns:
*
*/
IP_GLOBAL void ipmipmn_api_pktbuf_free(struct Ipmipmn_api_context *ctx,
struct Ipmip_proc *proc,
Ipmipmn_api_pktbuf_t *pbuf);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,141 @@
/* ipmipmn_reg.h - ipmipmn_reg.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_reg.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_reg.h,v $
* $Author: jhorteli $ $Date: 2009-04-01 18:34:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_API_REG_H
#define IPMIPMN_API_REG_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmipmn_api_context;
struct Ipmipmn_api_node;
struct Ipmip_proc;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmipmn_api_reg_output - ipmipmn_api_reg_output
*
* Send a registration request
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* Current node
* \i resend
* Is it a resend
* \i deregister
* Is it a de-registration.
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_reg_output
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
struct Ipmipmn_api_node *node,
int resend,
Ip_bool deregister
);
/*******************************************************************************
*
* ipmipmn_api_reg_recv - ipmipmn_api_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_api_reg_recv
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_pktbuf_t *pbuf
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -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
****************************************************************************
*/