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,813 @@
/* 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
--------------------
01b,14jul08,tlu Fix a module name to fix the component greyed out in WB
01i,11may08,jho created.
*/
#ifdef _WRS_CONFIG_COMPONENT_IPMIP6HA
Component INCLUDE_IPMIP6HA {
NAME IPv6 Home Agent
SYNOPSIS IPv6 Home Agent
REQUIRES INCLUDE_IPCOM INCLUDE_IPCOM_USE_INET6 INCLUDE_IPMIP6 SELECT_IPMIP6HA
MODULES ipmip6ha.o
CONFIGLETTES ipmip6ha_config.c
CFG_PARAMS MIP6HA_LIFETIME_ENUM \
MIP6HA_INTERFACES \
MIP6HA_INTERFACE_ADDRESS_ENUM \
MIP6HA_REFRESH_ENUM \
MIP6HA_TUNNEL_IP6IP6_ENUM \
MIP6HA_BINDING_REVOCATION_MIN_DELAY_ENUM \
MIP6HA_BINDING_REVOCATION_MAX_RETRIES_ENUM
}
Component INCLUDE_IPMIP6HA_DUAL_STACK {
NAME IPv6 Home Agent Dual Stack Support
SYNOPSIS IPv6 Home Agent Dual Stack Support
REQUIRES INCLUDE_IPMIP6HA
CFG_PARAMS MIP6HA_INET_INTERFACE_ADDRESS_ENUM \
MIP6HA_INET_ACCEPT_FORCED_IPV4_UDP_ENCAPSULATION_REQUEST_ENUM \
MIP6HA_INET_FORCE_IPV4_UDP_ENCAPSULATION_ENUM \
MIP6HA_INET_IPV4_UDP_ENCAPSULATION_NAT_TIMEOUT \
MIP6HA_INET_TUNNEL_IPIP_ENUM \
MIP6HA_INET_TOPOLOGY_ADDRESS_RESERVATION \
MIP6HA_INET_POOL_ENUM \
MIP6HA_INET_ACL_HOMEADDRESS_ENUM \
MIP6HA_INET_ACL_POOL_ENUM \
MIP6HA_INET_ACL_LIMIT_HOMEADDRESS_ENUM \
MIP6HA_INET_ACL_LIMIT_PD_ENUM
}
Component INCLUDE_IPMIP6HA_MOBILE_ROUTER {
NAME IPv6 Home Agent Mobile Router Support
SYNOPSIS IPv6 Home Agent Mobile Router Support
REQUIRES INCLUDE_IPMIP6HA
CFG_PARAMS MIP6HA_MOBILE_ROUTER_ACL_PD_ENUM
}
Component INCLUDE_IPMIP6HA_MOBILE_ROUTER_DUAL_STACK {
NAME IPv6 Home Agent Mobile Router Dual Stack Support
SYNOPSIS IPv6 Home Agent Mobile Router Dual Stack Support
REQUIRES INCLUDE_IPMIP6HA_DUAL_STACK INCLUDE_IPMIP6HA_MOBILE_ROUTER
CFG_PARAMS MIP6HA_MOBILE_ROUTER_INET_ACL_PD_ENUM
}
Component INCLUDE_IPMIP6HA_LMA {
NAME IPv6 Home Agent LMA Support
SYNOPSIS IPv6 Home Agent LMA Support
REQUIRES INCLUDE_IPMIP6HA
CFG_PARAMS MIP6HA_LMA_TUNNEL_IP6IP6_ENUM \
MIP6HA_LMA_TUNNEL_GRE_ENUM \
MIP6HA_LMA_POOL_ENUM \
MIP6HA_LMA_ACL_PD_ENUM \
MIP6HA_LMA_ACL_POOL_ENUM \
MIP6HA_LMA_ACL_LIMIT_ENUM \
MIP6HA_LMA_MIN_DELAY_BEFORE_BCE_DELETE_ENUM \
MIP6HA_LMA_MAX_DELAY_BEFORE_NEW_BCE_ASSIGN_ENUM \
MIP6HA_LMA_TIMESTAMP_VALIDITY_WINDOW_ENUM \
MIP6HA_LMA_MOBILE_NODE_GENERATED_TIMESTAMP_IN_USE_ENUM \
MIP6HA_LMA_HEARTBEAT_ENABLED_ENUM \
MIP6HA_LMA_HEARTBEAT_INTERVAL_ENUM \
MIP6HA_LMA_MISSING_HEARTBEATS_ALLOWED_ENUM \
MIP6HA_LMA_MAG_ENUM \
MIP6HA_LMA_FIXED_MAG_LINKLOCAL_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM \
MIP6HA_LMA_REVOKE_PREVIOUS_MAG_ENUM
}
Component INCLUDE_IPMIP6HA_LMA_DHCP_SERVER {
NAME IPv6 Home Agent LMA DHCP Server Support
SYNOPSIS IPv6 Home Agent LMA DHCP Server Support
REQUIRES INCLUDE_IPMIP6HA_LMA
CFG_PARAMS MIP6HA_LMA_DHCP_SERVER_SERVER_ENUM \
MIP6HA_LMA_DHCP_SERVER_SERVER_PREFERRED_ENUM \
MIP6HA_LMA_DHCP_SERVER_SERVER_VALID_ENUM
}
Component INCLUDE_IPMIP6HA_LMA_DUAL_STACK {
NAME IPv6 Home Agent LMA Dual Stack Support
SYNOPSIS IPv6 Home Agent LMA Dual Stack Support
REQUIRES INCLUDE_IPMIP6HA_DUAL_STACK INCLUDE_IPMIP6HA_LMA
CFG_PARAMS MIP6HA_LMA_INET_TUNNEL_IPIP_ENUM \
MIP6HA_LMA_INET_TUNNEL_GRE_ENUM \
MIP6HA_LMA_INET_TOPOLOGY_DHCP_OPTION_ENUM \
MIP6HA_LMA_INET_ACL_HOMEADDRESS_ENUM \
MIP6HA_LMA_INET_ACL_POOL_ENUM
}
Component INCLUDE_IPMIP6HA_LMA_DUAL_STACK_DHCP_SERVER {
NAME IPv6 Home Agent LMA Dual Stack Internal DHCP Server Support
SYNOPSIS IPv6 Home Agent LMA Dual Stack Internal DHCP Server includes \
the integrated DHCP server feature.
REQUIRES INCLUDE_IPMIP6HA_LMA_DUAL_STACK
CFG_PARAMS MIP6HA_LMA_INET_DHCP_SERVER_ENUM
}
Component INCLUDE_IPMIP6HA_FEATURE_EXTENSION {
NAME IPv6 Home Agent Feature Extension
SYNOPSIS This feature should be included if one wants to add \
a new feature to the home agent v6, and have the \
feature hook being registered during initialization.
REQUIRES INCLUDE_IPMIP6HA
CFG_PARAMS MIP6HA_FEATURE_INITIALIZATION_HOOK
}
Selection SELECT_IPMIP6HA {
NAME Ipv6 Home Agent Components
SYNOPSIS Ipv6 Home Agent Components
COUNT 0-
REQUIRES INCLUDE_IPMIP6HA
_CHILDREN FOLDER_MOBILITY_V6
CHILDREN INCLUDE_IPMIP6HA \
INCLUDE_IPMIP6HA_CMD \
INCLUDE_IPMIP6HA_DUAL_STACK \
INCLUDE_IPMIP6HA_MOBILE_ROUTER \
INCLUDE_IPMIP6HA_MOBILE_ROUTER_DUAL_STACK \
INCLUDE_IPMIP6HA_FEATURE_EXTENSION \
INCLUDE_IPMIP6HA_LMA \
INCLUDE_IPMIP6HA_LMA_DHCP_SERVER \
INCLUDE_IPMIP6HA_LMA_DUAL_STACK \
INCLUDE_IPMIP6HA_LMA_DUAL_STACK_DHCP_SERVER
DEFAULTS INCLUDE_IPMIP6HA \
INCLUDE_IPMIP6HA_CMD \
INCLUDE_IPMIP6HA_MOBILE_ROUTER \
INCLUDE_IPMIP6HA_MOBILE_ROUTER_DUAL_STACK \
INCLUDE_IPMIP6HA_DUAL_STACK \
INCLUDE_IPMIP6HA_LMA \
INCLUDE_IPMIP6HA_LMA_DHCP_SERVER \
INCLUDE_IPMIP6HA_LMA_DUAL_STACK \
INCLUDE_IPMIP6HA_LMA_DUAL_STACK_DHCP_SERVER
}
Component INCLUDE_IPMIP6HA_CMD {
NAME IPv6 Home Agent IPCOM commands
SYNOPSIS IPv6 Home Agent IPCOM commands.
MODULES ipmip6ha_cmd_ha6.o
REQUIRES INCLUDE_IPCOM_SHELL_CMD INCLUDE_IPMIP6HA
}
/* INCLUDE_IPMIP6HA configuration parameters */
Parameter MIP6HA_LIFETIME_ENUM {
NAME Interface lifetime specification
SYNOPSIS The maximum lifetime in seconds allowed on this interface. A \
value of "0" means that any lifetime may be accepted. For \
ordinary non-proxy registrations, the maximum lifetime value \
is still limited by the home address prefix lifetime as \
advertised by the routers. Format for this configuration item \
is a semi-colon separated list of interfaces and lifetime values \
as specified by the following format string \
"<ifname1>=<lifetime1>;<ifnameN>=<lifetimeN>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_REFRESH_ENUM {
NAME Interface refresh indication
SYNOPSIS This configuration item specifies the refresh indicator that \
the home agent should provide, if any. The value may range \
between 0 and 100, which is per cent of the granted lifetime. \
A value of 0 disables the refresh indicator. The refresh \
indicator tells the registering node how long it should wait \
before refreshing its binding. If no refresh indicator value \
has been specified for an interface, it is considered having \
a value of 0. Format for this configuration item \
is a semi-colon separated list of interfaces and refresh values \
as specified by the following format string \
"<ifname1>=<refresh1>;<ifnameN>=<refreshN>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INTERFACES {
NAME Interface list
SYNOPSIS The interface list specifies what interfaces \
should be configured for home agent operation. This \
parameter is a comma separated list of interfaces such \
as "<ifname1>,<ifname2>" etc.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INTERFACE_ADDRESS_ENUM {
NAME Interface address configuration
SYNOPSIS Each enabled interface must have an assigned v6 address that \
will be used during communication with registering nodes. If \
no address has been specified for an enabled interface, the \
home agent will attempt to resolve the address and use the \
first global IPv6 address it locates on the specified \
interface. This configuration parameter is specified by using \
a semi-colon separated list of interface names and addresses, as \
specified by the format string \
"<ifname1>=<address1>;<ifnameN>=<addressN>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_TUNNEL_IP6IP6_ENUM {
NAME Home Agent IPv6 tunneling
SYNOPSIS This configuration item specifies whether or not IPv6 tunneling \
is allowed by the home agent. This configuration item should \
not be disabled unless the home agent is only doing Proxy Mobility,\
or is only reachable by means of IPv4. This configuration \
parameter is specified by using a semi-colon separated list of \
interface names and disabled/enabled values, as specified by \
the format string \
"<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_MOBILE_ROUTER_ACL_PD_ENUM {
NAME Mobile Router Prefix Delegation Access Control
SYNOPSIS This configuration item determines how prefixes are allocated \
to the registrering node when Mobile Router. The specified prefixes \
indicates what prefixes are to be used for Mobile Router \
registrations. Syntax for this configuration item is: \
<nai|hoa=<prefix1>/prefixlen1>[,<prefixN>/<prefixlenN>] \
A Mobile Router example for this entry would be: \
"mr-user@windriver.com=3ffe:1::/64,3ffe:2::/64" or \
"3ffe:10::1=3ffe:1::/64,3ffe:2::/64"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_TUNNEL_IP6IP6_ENUM {
NAME LMA IPv6 tunneling
SYNOPSIS This configuration item specifies whether or not IPv6 tunneling \
is allowed by the LMA for proxy mobility. By default all \
interfaces enables IPv6 tunneling. This configuration parameter \
is specified by using a semi-colon separated list of interface \
names and disabled/enabled values, as specified by the format \
string "<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_TUNNEL_GRE_ENUM {
NAME LMA IPv6 GRE tunneling
SYNOPSIS This configuration item specifies whether IPv6 GRE tunneling \
is allowed by the LMA for Proxy Mobility. By default all \
interfaces enables GRE. This configuration parameter is \
specified by using a semi-colon separated list of interface \
names and disabled/enabled values, as specified by the format string \
"<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_POOL_ENUM {
NAME LMA Prefix Allocation Pool definitions
SYNOPSIS This configuration item defines a LMA pool allocation \
object, from which MAGs may allocate v6 prefixes for use \
by nodes located in their networks. The format of the \
configuration parameter is \
<pool name1>=<pool definition1>[;<pool nameN>=<pool definitionN>] \
<pool definition> has the form <prefix>/<prefix length>/<chunk size> \
where <prefix> is the prefix we will be allocating chunks from, \
<prefix length> is the size of the entire prefix, while <chunk size> \
determines the size of the allocated prefix. For example, \
"WR-POOL=3ffe::/48/64" will be allocating 64 bit chunks from \
the prefix 3ffe::/48.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_ACL_PD_ENUM {
NAME Proxy Mobility Prefix Delegation Access Control
SYNOPSIS This configuration item determines how prefixes are allocated \
to the registrering node when Proxy Mobility is used. \
The explicitly specified prefixes \
indicates what prefixes are to be used for Proxy Mobility \
registrations using the specified NAI. Syntax for this \
configuration item is: \
<nai|domain=<prefix1>/prefixlen1>[,<prefixN>/<prefixlenN> \
An example would be: "pm-user@windriver.com=3ffe:3::/64". A \
domain example specifying available prefixes for a domain \
would be: "@windriver.com=3ffe:4::/64,3ffe:5::/64,3ffe:6::/64"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_ACL_POOL_ENUM {
NAME Proxy Mobility Pool Access Control
SYNOPSIS This configuration item determines what pool to be used in order\
to allocate prefixes to a specified NAI or domain.\
Syntax for this configuration item is: <nai|domain=<pool name> \
An example would be: "pm-user@windriver.com=WR-POOL". A domain \
example specifying a pool for a domain would be: \
"@windriver.com=WR-POOL"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_ACL_LIMIT_ENUM {
NAME Proxy Mobility Prefix Allocation Limit Access Control
SYNOPSIS This configuration item determines the maximum number of \
prefix which a specific NAI or domain may allocate from \
the Home Agent. If no LIMIT is specified for a given \
user or domain, it will resort to "1". \
Syntax for this configuration item is: <nai|domain=<limit> \
An example would be: "pm-user@windriver.com=3". A domain example \
specifying available prefixes for a domain would be: \
"@windriver.com=2"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_MIN_DELAY_BEFORE_BCE_DELETE_ENUM {
NAME Proxy Mobility Minimum Delay before BCE Delete
SYNOPSIS This variable specifies the amount of time in milliseconds the \
local mobility anchor MUST wait before it deletes a Binding \
Cache entry of a mobile node, upon receiving a Proxy Binding \
Update message from a mobile access gateway with a lifetime \
value of 0. During this wait time, if the local mobility \
anchor receives a Proxy Binding Update for the same mobility \
binding, with a lifetime value greater than 0, then it must \
update the binding cache entry with the accepted binding \
values. By the end of this wait-time, if the local \
mobility anchor did not receive any valid Proxy Binding \
Update message for that mobility binding, it MUST delete the \
Binding Cache entry. This delay essentially ensures a \
mobile node's Binding Cache entry is not deleted too quickly \
and allows some time for the new mobile access gateway to \
complete the signaling for the mobile node. \
The format for this configuration item is a semi-colon \
separated list of "<ifname>=<timeout>". \
If no value has been specified for a given interface, \
a value of "10000" will be used.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_MAX_DELAY_BEFORE_NEW_BCE_ASSIGN_ENUM {
NAME Proxy Mobility Max Delay Before New BCE Assign
SYNOPSIS This variable specifies the amount of time in milliseconds the \
local mobility anchor MUST wait for the de-registration message \
for an existing mobility session before it decides to create a \
new mobility session.The format for this configuration item is \
a semi-colon separated list of "<ifname>=<timeout>". \
If no value has been specified for a given interface, \
a value of "1500" will be used.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_TIMESTAMP_VALIDITY_WINDOW_ENUM {
NAME Proxy Mobility Timestamp Validity Window
SYNOPSIS This variable specifies the maximum amount of time difference \
in milliseconds between the timestamp in the received Proxy \
Binding Update message and the current time of day on the \
local mobility anchor, that is allowed by the local mobility \
anchor for thereceived message to be considered valid.\
The format for this configuration item is \
a semi-colon separated list of "<ifname>=<validity timeout>". \
If no value has been specified for a given interface, \
a value of "300" will be used.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_MOBILE_NODE_GENERATED_TIMESTAMP_IN_USE_ENUM {
NAME Proxy Mobility Mobile Node Generated Timestamp In Use
SYNOPSIS This flag indicates whether or not the mobile-node-generated \
timestamp approach is in use in that Proxy Mobile IPv6 domain. \
When the value for this flag is set to 1, the local mobility \
anchors and mobile access gateways in that Proxy Mobile IPv6 \
domain MUST apply the mobile node generated timestamp \
considerations. Syntax for this parameter is a semi-colon \
separated list of "<ifname>=<0|1>". By default this \
feature is turned off.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_HEARTBEAT_ENABLED_ENUM {
NAME Proxy Mobility HEARTBEAT
SYNOPSIS This configuration option specifies whether or not the Heartbeat \
feature is enabled for the specified interface. If no \
configuration is provided, the feature is turned off. \
The format for this configuration item is \
a semi-colon separated list of "<ifname>=<enabled|disabled>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_HEARTBEAT_INTERVAL_ENUM {
NAME Proxy Mobility HEARTBEAT_INTERVAL
SYNOPSIS This variable is used to set the time interval in seconds \
between two consecutive Heartbeat Request messages. The \
default value is 60 seconds. It SHOULD NOT be set to less \
than 30 seconds.The format for this configuration item is \
a semi-colon separated list of "<ifname>=<interval>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_MISSING_HEARTBEATS_ALLOWED_ENUM {
NAME Proxy Mobility MISSING_HEARTBEATS_ALLOWED
SYNOPSIS This variable indicates the maximum number of consecutive \
Heartbeat Request messages that a PMIPv6 node can miss before \
concluding that the peer PMIPv6 node is not reachable. The \
default value for this variable is 3.\
The format for this configuration item is a semi-colon \
separated list of "<ifname>=<misses>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_MAG_ENUM {
NAME Proxy Mobility Mobility Access Gateway Definitions
SYNOPSIS This configuration item specifies what Mobility Access \
Gateways should be permanently added to the MAG database, \
and whether or not they support HeartBeat. The LMA will \
send an unsolicited HeartBeat response to each HeartBeat \
enabled MAG during startup and reconfiguration. \
The format for this configuration item is a semi-colon \
separated list of "<MAG address>=<enabled|disabled>" where \
<MAG Address> has the form <MAG INET6 Address>[/<MAG INET Address>]
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_REVOKE_PREVIOUS_MAG_ENUM {
NAME Proxy Mobility Automatic Revocation of Previous MAG
SYNOPSIS This feature specifies whether or not the LMA will revoke \
bindings from previous MAGs when a new registration and \
care-of address has been registered. By default this parameter \
is enabled. This configuration parameter is specified by using \
a semi-colon separated list of interface names and timeout \
values, as specified by the format string \
"<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_FIXED_MAG_LINKLOCAL_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM {
NAME Proxy Mobility Fixed MAG LinkLocal Address On All Access Links
SYNOPSIS This variable indicates the link-local address value that all \
the mobile access gateways SHOULD use on any of the access \
links shared with any of the mobile nodes in that Proxy Mobile \
IPv6 domain. If this variable is initialized to ALL_ZERO value,\
itimplies the use of fixed link-local address mode is not \
enabled for that Proxy Mobile IPv6 domain. ALL_ZERO is \
specified by omitting the configuration or specifying the \
address as "::". The format for this configuration item is a \
semi-colon separated list of "<ifname>=<link local addresss>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_DHCP_SERVER_SERVER_ENUM {
NAME Proxy Mobility IPDHCPv6 Support
SYNOPSIS This configuration item enabled IPDHCPS6 server support \
for the specified interfaces. IPDHCPS6 must be included \
in the build for this parameter to be available.. \
The format for this configuration item is a semi-colon \
separated list of "<ifname>=<enabled|disabled>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_DHCP_SERVER_SERVER_PREFERRED_ENUM {
NAME Proxy Mobility IPDHCPv6 Preferred Lifetime Configuration
SYNOPSIS This configuration item specifies the preferred lifetime in \
seconds to be used by the IPDHCPS6 server during DHCP \
negotiations. If no configuration is provided, this value \
will default to "10000". \
The format for this configuration item is a semi-colon \
separated list of "<ifname>=<preferred lifetime in seconds>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_DHCP_SERVER_SERVER_VALID_ENUM {
NAME Proxy Mobility IPDHCPv6 Valid Lifetime Configuration
SYNOPSIS This configuration item specifies the valid lifetime in \
seconds to be used by the IPDHCPS6 server during DHCP \
negotiations. If no configuration is provided, this value \
will default to "10000". \
The format for this configuration item is a semi-colon \
separated list of "<ifname>=<valid lifetime in seconds>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_INET_TUNNEL_IPIP_ENUM {
NAME INET LMA v4 IPIP tunneling
SYNOPSIS This configuration item specifies whether or not v4 IPIP tunneling \
is allowed by the LMA for proxy mobility. By default all \
interfaces enables IPIP tunneling. This configuration parameter \
is specified by using a semi-colon separated list of interface \
names and disabled/enabled values, as specified by the format \
string "<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_INET_TUNNEL_GRE_ENUM {
NAME INET LMA v4 GRE tunneling
SYNOPSIS This configuration item specifies whether v4 GRE tunneling \
is allowed by the LMA for Proxy Mobility. By default all \
interfaces enables GRE. This configuration parameter is \
specified by using a semi-colon separated list of interface \
names and disabled/enabled values, as specified by the format string \
"<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_INET_TOPOLOGY_DHCP_OPTION_ENUM {
NAME INET LMA Network Topology DHCP Configuration
SYNOPSIS Specify the DHCP options that are valid for various network \
segments. The syntax is <type>.<code>.<network>=<value>. \
<type> is one of "bool","u8","u16","u32","ip","ip_pair" and \
"string". The type specifies how the following values should be \
parsed. Type "string" will not parse the value in any way, only \
add the entire value to the DHCP option. If more than one space \
separated value is provided, they will be added in an array \
fashion to the DHCP option. <code> is the DHCP option code as \
defined by IANA. For example "ip.6.10.0.0.0/8=10.1.2.3 10.2.3.3" \
will add a DNS server option with two servers valid for the \
network segment 10.0.0.0/8. Some DHCP options do have alias \
names, where the most common are "router", "subnet_mask" and \
"dns". So, a valid configuration is also \
"router.10.0.0.0/8=10.1.2.3" which would add 10.1.2.3 as a \
default router for the network segment 10.0.0.0/8. You \
MUST add a router and a subnet_mask option for the appropriate \
networks, when using v4 address assignments in Proxy Mobility, \
since the specification requires that information to be provided. \
This configuration parameter is specified by using a semi-colon \
separated list of network topology configurations and values,\
such as: "<type>.<code>.<network>/<prefix length>=<value>" or \
"<alias>.<network>/<prefix length>=<value>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_INET_ACL_HOMEADDRESS_ENUM {
NAME INET LMA Home Address Assignment Access Control
SYNOPSIS This configuration item determines what INET home address may \
be allocated by a specific NAI. Syntax for this \
configuration item is: \
<nai>=<INET hoa>/prefixlen> \
An example for this entry would be: \
"mr-user@windriver.com=10.0.1.1/24"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_INET_ACL_POOL_ENUM {
NAME INET LMA Pool Allocation Access Control
SYNOPSIS This configuration item determines what INET pool may be used \
by a specific NAI or DOMAIN for INET home address Syntax for \
this configuration item is: <nai|domain>=<pool name> \
An example for this entry would be: \
"mr-user@windriver.com=WR-INET_POOL"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_LMA_INET_DHCP_SERVER_ENUM {
NAME INET LMA Integrated DHCP Server Support
SYNOPSIS This configuration item determines if the intergrated DHCP \
server is enabled or disabled. The integrated DHCP server \
provides DHCP functionality for DHCP requests relayed by the \
MAG for proxy mobile nodes. The DHCP options provided by \
the server is decided by MIP6HA_LMA_INET_TOPOLOGY_DHCP_OPTION_ENUM. \
The format of this entry is a semi-colon separated list of \
<ifname>=<enabled|disabled>, such as "eth0=disabled". By \
default, the integrated DHCP server is not enabled.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_INTERFACE_ADDRESS_ENUM {
NAME INET Interface address configuration
SYNOPSIS Each enabled interface may have an assigned v4 address that \
will be used during communication with registering nodes. If \
no address has been specified for an enabled interface, the \
home agent will attempt to resolve the address and use the \
first IPv4 address it locates on the specified \
interface. This configuration parameter is specified by using \
a semi-colon separated list of interface names and addresses, \
as specified by the format string \
"<ifname1>=<address1>;<ifnameN>=<addressN>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_ACCEPT_FORCED_IPV4_UDP_ENCAPSULATION_REQUEST_ENUM {
NAME INET Accept Forced IPv4 UDP Encapsulation Request
SYNOPSIS This flag indicates whether or not the local mobility anchor/ \
home agent should accept IPv4 UDP encapsulation request for \
the mobile node's data traffic, even if there is no NAT \
detected in the path. The default value for this flag is set \
to value of 0, indicating that the LMA/HA MUST NOT accept IPv4 \
UDP encapsulation request when NAT is not detected in the path.\
When the value for this flag is set to value of 1, the LMA/HA \
MUST accept IPv4 UDP encapsulation request even when NAT is not \
detected in the path. This configuration parameter is specified \
by using a semi-colon separated list of interface names and \
flags, as specified by the format string \
"<ifname1>=<0|1>;<ifnameN>=<0|1>
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_FORCE_IPV4_UDP_ENCAPSULATION_ENUM {
NAME INET Force IPv4 UDP Encapsulation
SYNOPSIS This boolean parameter specifies whether or not the LMA/HA will \
force UDP encapsulation for Ipv4 tunneled frames. This \
parameter is by default false. This configuration parameter is \
specified by using a semi-colon separated list of interface \
names and boolean values as specified by the format string \
"<ifname1>=<true|false>;<ifnameN>=<true|false>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_IPV4_UDP_ENCAPSULATION_NAT_TIMEOUT {
NAME INET IPv4 UDP Encapsulation NAT Timeout
SYNOPSIS This parameter specifies in seconds the estimated time a NAT \
binding will remain valid within this domain. If specified as \
0xFFFFFFFF a binding never times out, 0 allows the requesting \
node to to determine the timeout value. The default value is \
110. This configuration parameter is specified by using a \
semi-colon separated list of interface names and timeout values \
as specified by the format string \
"<ifname1>=<timeout1>;<ifnameN>=<timeoutN>".
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_TUNNEL_IPIP_ENUM {
NAME INET Home Agent v4 IPIP tunneling
SYNOPSIS This configuration item specifies whether or not v4 IPIP tunneling \
is allowed by the home agent. By default, IPIP is always enabled. \
This configuration parameter is specified by using a semi-colon \
separated list of interface names and disabled/enabled values, \
as specified by the format string \
"<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_TOPOLOGY_ADDRESS_RESERVATION {
NAME INET Network Topology Address Reservation
SYNOPSIS Specify the v4 address and prefixes that MUST not be allocated \
to any MAG or DSMIPv6 node. \
This configuration parameter is specified by specifying a \
comma separated list of addresses or prefixes such as: \
"<address1>[/<prefix length1>][,<addressN>[/<prefix lengthN>]]"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_POOL_ENUM {
NAME INET Prefix and Home Address Allocation Pool definitions
SYNOPSIS This configuration item defines an INET pool allocation \
object, from which MAGs or INET enabled mobile nodes may \
allocate v4 prefixes and home addresses.The format of the \
configuration parameter is \
<pool name1>=<pool definition1>[;<pool nameN>=<pool definitionN>] \
<pool definition> has the form: \
<INET prefix>/<prefix length>/<chunk size> \
or an inclusive range such as: \
<INET prefix start>-<INET prefix end>/<prefix length>/<chunk size> \
where <INET prefix> is the prefix we will be allocating chunks from, \
<prefix length> is number of bits in the netmask, while <chunk size> \
determines the size of the allocated prefix. For example, \
"WR-INET-POOL=10.0.0.0/24/32" will be allocating single \
addresses bit from the network 10.0.0.0/24. Another example is: \
"WR-INET-POOL=10.0.0.1-10.0.0.3/24/32" which will provide \
addresses 10.0.0.1, 10.0.0.2 and 10.0.0.3 for allocation. \
For prefix allocations, a pool rule could read: \
"WR-INET-POOL=10.0.0.0/8/24" which would allocate 24 bit segments \
of the 10.0.0.0/8 network. If you need to reserve addresses \
in the pool, see MIP6HA_INET_TOPOLOGY_ADDRESS_RESERVATION.
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_MOBILE_ROUTER_INET_ACL_PD_ENUM {
NAME INET Mobile Router Prefix Delegation Access Control
SYNOPSIS This configuration item determines how prefixes are allocated \
to the registrering node when Mobile Router. The specified prefixes \
indicates what prefixes are to be used for Mobile Router \
registrations. Syntax for this configuration item is: \
<nai|hoa>=<INET prefix1>/prefixlen1>[,<prefixN>/<INET prefixlenN>] \
A Mobile Router example for this entry would be: \
"mr-user@windriver.com=10.0.1.0/24,10.0.2.0/24" or \
"3ffe:10::1=10.0.1.0/24,10.0.2.0/24"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_ACL_HOMEADDRESS_ENUM {
NAME INET Home Address Assignment Access Control
SYNOPSIS This configuration item determines what INET home addresses may \
be allocated by a specific Home Address or NAI. Syntax for this \
configuration item is: \
<nai|hoa>=<INET hoa1>/prefixlen1>[,<INET hoaN>/<prefixlenN>] \
An example for this entry would be: \
"mr-user@windriver.com=10.0.1.1/24"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_ACL_POOL_ENUM {
NAME INET Pool Allocation Access Control
SYNOPSIS This configuration item determines what INET pool may be used \
by a specific Home Address, NAI or DOMAIN for INET home address \
or prefix allocations. Syntax for this configuration item is: \
<nai|hoa|domain>=<pool name> \
An example for this entry would be: \
"mr-user@windriver.com=WR-INET_POOL"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_ACL_LIMIT_HOMEADDRESS_ENUM {
NAME INET Home Address Allocation Limit Access Control
SYNOPSIS This configuration item determines the number of INET Home \
Addresses may be allocated by a specific NAI, domain or \
Home Address. The default value is "1". The format for this \
entry is <nai|domain|hoa>=<limit>. \
An example for this entry would be: \
"mr-user@windriver.com=2"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_INET_ACL_LIMIT_PD_ENUM {
NAME INET Prefix Delegation Limit Access Control
SYNOPSIS This configuration item determines the number of INET Prefixes \
that may be allocated by a specific NAI, domain or \
Home Address. The default value is "0". The format for this \
entry is <nai|domain|hoa>=<limit>. \
An example for this entry would be: \
"mr-user@windriver.com=1"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_FEATURE_INITIALIZATION_HOOK {
NAME Home Agent Service Initialization Hook
SYNOPSIS This is the function hook that you may define in order to \
register extra functional extensions to the Home Agent.
TYPE FUNCPTR
DEFAULT your_function_here
}
Parameter MIP6HA_BINDING_REVOCATION_MIN_DELAY_ENUM {
NAME Home Agent Minimum Delay Between BRI messages (MINDelayBRIs)
SYNOPSIS This variable specifies the delay time in milliseconds before \
the revoking mobility entity retransmits a BRI message. The \
default is 1000 ms but not less than 500 ms.\
This configuration parameter is specified by using a semi-colon \
separated list of interface names and timeout values, as \
specified by the format string \
"<ifname1>=<milliseconds>;<ifnameN>=<milliseconds>"
TYPE char *
DEFAULT ""
}
Parameter MIP6HA_BINDING_REVOCATION_MAX_RETRIES_ENUM {
NAME Home Agent BRI Maximum Number of Retries (BRIMaxRetriesNumber)
SYNOPSIS This variable specifies the maximum Number of times a mobility \
entity can retransmit a Binding Revocation Indication message \
before receiving a Binding Revocation Acknowledgement message. \
The default value for this parameter is 1. \
This configuration parameter is specified by using a semi-colon \
separated list of interface names and retransmit values, as \
specified by the format string \
"<ifname1>=<retransmits>;<ifnameN>=<retransmits>"
TYPE char *
DEFAULT ""
}
#endif
@@ -0,0 +1,12 @@
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: common.vxconfig,v $ $Revision: 1.8 $
# $Source: /home/interpeak/CVSRoot/ipmip6ha/config/common.vxconfig,v $
# $Author: myakan $
# $State: Exp $ $Locker: $
#
# INTERPEAK_COPYRIGHT_STRING
#hidden option that enables IPMIP6HA
config SUPPORTS_MIP6HA
bool
default y
@@ -0,0 +1,314 @@
/*
******************************************************************************
* INTERPEAK CONFIGURATION SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_config.c,v $ $Revision: 1.11 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_config.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_cstyle.h>
#include <ipcom_os.h>
#include <ipcom_err.h>
#include <ipcom_sysvar.h>
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef void (*Ipmip6ha_config_func_t) (void *);
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
IP_GLOBAL int ipmip6ha_cmd_ha6(int argc, char **argv);
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
*===========================================================================
* Basic MIP6 Home Agent (ha) sysvar Configuration
*===========================================================================
*/
#ifndef INCLUDE_IPMIP6HA
#define INCLUDE_IPMIP6HA_LMA_DUAL_STACK_DHCP_SERVER 1
#define INCLUDE_IPMIP6HA_LMA_DHCP_SERVER 1
#if defined(IPTESTENGINE)
#define INCLUDE_IPMIP6HA_FEATURE_EXTENSION 1
#define MIP6HA_FEATURE_INITIALIZATION_HOOK ipmip6ha_service_testext_install
#endif
#if !defined(IP_PORT_LAS)
#define INCLUDE_IPMIP6HA_CMD 1
#endif
IP_STATIC IP_CONST Ipcom_sysvar ipmip6ha_conf_sysvar[] =
{
/* Configuration delimiter - DO NOT EDIT! */
{ IP_NULL, IP_NULL }
};
#else
IP_STATIC IP_CONST Ipcom_sysvar ipmip6ha_conf_sysvar[] =
{
{ "ipmip6ha.interfaces", MIP6HA_INTERFACES },
/* DSMIPv6 */
#if defined (INCLUDE_IPMIP6HA_DUAL_STACK)
{ "ipmip6ha.inet.topology.reserved", MIP6HA_INET_TOPOLOGY_ADDRESS_RESERVATION },
#endif
/* Configuration delimiter - DO NOT EDIT! */
{ IP_NULL, IP_NULL }
};
/* Interface specific list configurations */
IP_CONST Ipcom_sysvar_ext ipmip6ha_conf_sysvar_ext[] =
{
/* Basic Configuration Parameters */
{ "ipmip6ha.interface", "homeagent", MIP6HA_INTERFACE_ADDRESS_ENUM },
{ "ipmip6ha.interface", "lifetime", MIP6HA_LIFETIME_ENUM },
{ "ipmip6ha.interface", "refresh", MIP6HA_REFRESH_ENUM },
{ "ipmip6ha.interface", "tunnel.ip6ip6", MIP6HA_TUNNEL_IP6IP6_ENUM },
{ "ipmip6ha.interface", "BRIMaxRetriesNumber", MIP6HA_BINDING_REVOCATION_MAX_RETRIES_ENUM },
{ "ipmip6ha.interface", "MINDelayBRIs", MIP6HA_BINDING_REVOCATION_MIN_DELAY_ENUM },
#if defined(INCLUDE_IPMIP6HA_DUAL_STACK)
/* DSMIPv6 */
{ "ipmip6ha.interface", "inet.homeagent", MIP6HA_INET_INTERFACE_ADDRESS_ENUM },
{ "ipmip6ha.interface", "inet.AcceptForcedIPv4UDPEncapsulationRequest", MIP6HA_INET_ACCEPT_FORCED_IPV4_UDP_ENCAPSULATION_REQUEST_ENUM },
{ "ipmip6ha.interface", "inet.ForceIPv4UDPEncapsulation", MIP6HA_INET_FORCE_IPV4_UDP_ENCAPSULATION_ENUM },
{ "ipmip6ha.interface", "inet.IPv4UDPEncapsulationNATTimeout", MIP6HA_INET_IPV4_UDP_ENCAPSULATION_NAT_TIMEOUT },
{ "ipmip6ha.interface", "inet.tunnel.ipip", MIP6HA_INET_TUNNEL_IPIP_ENUM },
{ "ipmip6ha.inet.pool", IP_NULL, MIP6HA_INET_POOL_ENUM },
{ "ipmip6ha.inet.acl.homeaddress", IP_NULL, MIP6HA_INET_ACL_HOMEADDRESS_ENUM },
{ "ipmip6ha.inet.acl.limit.homeaddress", IP_NULL, MIP6HA_INET_ACL_LIMIT_HOMEADDRESS_ENUM },
{ "ipmip6ha.inet.acl.limit.prefix_delegation", IP_NULL, MIP6HA_INET_ACL_LIMIT_PD_ENUM },
{ "ipmip6ha.inet.acl.pool", IP_NULL, MIP6HA_INET_ACL_POOL_ENUM },
#endif
/* NEMO */
#if defined(INCLUDE_IPMIP6HA_MOBILE_ROUTER)
{ "ipmip6ha.mobile_router.acl.prefix_delegation", IP_NULL, MIP6HA_MOBILE_ROUTER_ACL_PD_ENUM },
#endif
#if defined(INCLUDE_IPMIP6HA_MOBILE_ROUTER_DUAL_STACK)
/* DSMIPv6 NEMO */
{ "ipmip6ha.mobile_router.inet.acl.prefix_delegation", IP_NULL, MIP6HA_MOBILE_ROUTER_INET_ACL_PD_ENUM },
#endif
#if defined(INCLUDE_IPMIP6HA_LMA)
/* Proxy Mobility*/
{ "ipmip6ha.LMA.pool", IP_NULL, MIP6HA_LMA_POOL_ENUM },
{ "ipmip6ha.LMA.acl.prefix_delegation", IP_NULL, MIP6HA_LMA_ACL_PD_ENUM },
{ "ipmip6ha.LMA.acl.pool", IP_NULL, MIP6HA_LMA_ACL_POOL_ENUM },
{ "ipmip6ha.LMA.acl.limit", IP_NULL, MIP6HA_LMA_ACL_LIMIT_ENUM },
{ "ipmip6ha.interface", "LMA.BindingRevocation", MIP6HA_LMA_REVOKE_PREVIOUS_MAG_ENUM },
{ "ipmip6ha.interface", "LMA.tunnel.ip6ip6", MIP6HA_LMA_TUNNEL_IP6IP6_ENUM },
{ "ipmip6ha.interface", "LMA.tunnel.gre", MIP6HA_LMA_TUNNEL_GRE_ENUM },
{ "ipmip6ha.interface", "LMA.MinDelayBeforeBCEDelete", MIP6HA_LMA_MIN_DELAY_BEFORE_BCE_DELETE_ENUM },
{ "ipmip6ha.interface", "LMA.MaxDelayBeforeNewBCEAssign", MIP6HA_LMA_MAX_DELAY_BEFORE_NEW_BCE_ASSIGN_ENUM },
{ "ipmip6ha.interface", "LMA.TimestampValidityWindow", MIP6HA_LMA_TIMESTAMP_VALIDITY_WINDOW_ENUM },
{ "ipmip6ha.interface", "LMA.MobileNodeGeneratedTimestampInUse", MIP6HA_LMA_MOBILE_NODE_GENERATED_TIMESTAMP_IN_USE_ENUM },
{ "ipmip6ha.interface", "LMA.FixedMAGLinkLocalAddressOnAllAccessLinks", MIP6HA_LMA_FIXED_MAG_LINKLOCAL_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM },
{ "ipmip6ha.interface", "LMA.HeartBeatEnabled", MIP6HA_LMA_HEARTBEAT_ENABLED_ENUM },
{ "ipmip6ha.interface", "LMA.HeartBeatInterval", MIP6HA_LMA_HEARTBEAT_INTERVAL_ENUM },
{ "ipmip6ha.interface", "LMA.MissingHeartBeatsAllowed", MIP6HA_LMA_MISSING_HEARTBEATS_ALLOWED_ENUM },
{ "ipmip6ha.LMA.MAG", IP_NULL, MIP6HA_LMA_MAG_ENUM },
#endif
#if defined(INCLUDE_IPMIP6HA_LMA_DHCP_SERVER)
{ "ipmip6ha.interface", "LMA.dhcp.server", MIP6HA_LMA_DHCP_SERVER_SERVER_ENUM },
{ "ipmip6ha.interface", "LMA.dhcp.server.preferred", MIP6HA_LMA_DHCP_SERVER_SERVER_PREFERRED_ENUM },
{ "ipmip6ha.interface", "LMA.dhcp.server.valid", MIP6HA_LMA_DHCP_SERVER_SERVER_VALID_ENUM },
#endif
#if defined(INCLUDE_IPMIP6HA_LMA_DUAL_STACK)
/* DSMIPv6 Proxy Mobility */
{ "ipmip6ha.LMA.inet.topology.dhcp.option", IP_NULL, MIP6HA_LMA_INET_TOPOLOGY_DHCP_OPTION_ENUM },
{ "ipmip6ha.LMA.inet.acl.homeaddress", IP_NULL, MIP6HA_LMA_INET_ACL_HOMEADDRESS_ENUM },
{ "ipmip6ha.LMA.inet.acl.pool", IP_NULL, MIP6HA_LMA_INET_ACL_POOL_ENUM },
{ "ipmip6ha.interface", "LMA.inet.tunnel.ipip", MIP6HA_LMA_INET_TUNNEL_IPIP_ENUM },
{ "ipmip6ha.interface", "LMA.inet.tunnel.gre", MIP6HA_LMA_INET_TUNNEL_GRE_ENUM },
#endif
#if defined(INCLUDE_IPMIP6HA_LMA_DUAL_STACK_DHCP_SERVER)
{ "ipmip6ha.interface", "LMA.inet.dhcp.server", MIP6HA_LMA_INET_DHCP_SERVER_ENUM },
#endif
/* Configuration delimiter - DO NOT EDIT! */
{ IP_NULL, IP_NULL, IP_NULL }
};
#endif
#if defined(INCLUDE_IPMIP6HA_LMA_DUAL_STACK_DHCP_SERVER)
extern void ipmip6ha_pmipv6_dhcpv4_install(void *);
#endif
#if defined(INCLUDE_IPMIP6HA_LMA_DHCP_SERVER)
extern void ipmip6ha_pmipv6_dhcpv6_install(void *);
#endif
extern void ipmip6ha_pmipv6_linklocal_install(void *);
#if defined(INCLUDE_IPMIP6HA_FEATURE_EXTENSION)
extern void MIP6HA_FEATURE_INITIALIZATION_HOOK(void *);
#endif
Ipmip6ha_config_func_t ipmip6ha_service_registrations[] =
{
#if defined(INCLUDE_IPMIP6HA_LMA_DUAL_STACK_DHCP_SERVER)
ipmip6ha_pmipv6_dhcpv4_install,
#endif
#if defined(INCLUDE_IPMIP6HA_LMA_DHCP_SERVER)
ipmip6ha_pmipv6_dhcpv6_install,
#endif
ipmip6ha_pmipv6_linklocal_install,
#if defined(INCLUDE_IPMIP6HA_FEATURE_EXTENSION)
MIP6HA_FEATURE_INITIALIZATION_HOOK,
#endif
IP_NULL
};
/*
****************************************************************************
* 9 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6ha_configure
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err ipmip6ha_configure(void);
IP_PUBLIC Ip_err
ipmip6ha_configure(void)
{
/* Initialize IPMIPMN system variables. */
/* Initialize IPMIPMN system variables. */
if (ipcom_sysvar_setv(ipmip6ha_conf_sysvar, 0) == IPCOM_SUCCESS)
{
/* now configure the interface-specific sysvars */
#ifdef INCLUDE_IPMIP6HA
return ipcom_sysvar_ext_setv (ipmip6ha_conf_sysvar_ext, 0);
#else
return IPCOM_SUCCESS;
#endif
}
return IPCOM_SUCCESS;
}
/*
*===========================================================================
* ipmip6ha_init
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err ipmip6ha_init(void);
IP_PUBLIC Ip_err
ipmip6ha_init(void)
{
#if defined(INCLUDE_IPMIP6HA_CMD) && !defined(IP_PORT_LAS)
ipcom_shell_add_cmd("ha6", "ha6 <command> [modifiers]", "Mobile IPv6 Home Agent",
ipmip6ha_cmd_ha6,
IPCOM_PRIORITY_DEFAULT, IPCOM_PROC_STACK_SMALL);
#endif
return IPCOM_SUCCESS;
}
/*
*===========================================================================
* ipmip6ha_exit
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err ipmip6ha_exit(void);
IP_PUBLIC Ip_err
ipmip6ha_exit(void)
{
#if defined(INCLUDE_IPMIP6HA_CMD) && !defined(IP_PORT_LAS)
/* Remove the shell command */
ipcom_shell_remove_cmd("ha6", ipmip6ha_cmd_ha6);
#endif
return IPCOM_SUCCESS;
}
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,86 @@
/*
******************************************************************************
* INTERPEAK CONFIGURATION HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_config.h,v $ $Revision: 1.7 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_config.h,v $
* $Author: jhorteli $ $Date: 2009-03-02 11:45:07 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_CONFIG_H
#define IPMIP6HA_CONFIG_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 INCLUDE FILES
****************************************************************************
*/
#include "ipmip6_config.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 3 DEFINES
****************************************************************************
*/
#define IPMIP6HA_PENDING_TIMEOUT 10
#ifdef IP_DEBUG
#define IPMIP6HA_EVENT_BACKLOG 300
#else
#define IPMIP6HA_EVENT_BACKLOG 100
#endif
/*
****************************************************************************
* 4 TYPES
****************************************************************************
*/
struct Ipmip6ha_context;
struct Ipmip_proc;
typedef void (*Ipmip6ha_service_install_t)
(
struct Ipmip6ha_context *ctx
);
/*
****************************************************************************
* 5 FUNCTIONS
****************************************************************************
*/
/* Callbacks */
extern Ipmip6ha_service_install_t ipmip6ha_service_registrations[];
IP_PUBLIC Ip_err ipmip6ha_configure(void);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,169 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_pktbuf.c,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_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 "ipmip6ha_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 <ipmip6.h>
#include <private/ipmip6_pkt.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_pktbuf.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6ha_pktbuf_alloc
*===========================================================================
* Description: Allocate a packet buffer
* Parameters:
* Returns: A newly allocated packet buffer
*
*/
IP_GLOBAL Ipmip_pktbuf_t *
ipmip6ha_pktbuf_alloc(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ip_size_t extra)
{
Ipmip6ha_pktbuf_t *pbuf;
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
pbuf = ipcom_calloc(1, sizeof(Ipmip6ha_pktbuf_t) + extra);
if (pbuf)
{
ipmip_buffer_init(&pbuf->mo_reply);
pbuf->ipmip6.ipmip.pktend = (void *) (pbuf + 1);
return &pbuf->ipmip6.ipmip;
}
return IP_NULL;
}
/*
*===========================================================================
* ipmip6ha_pktbuf_free
*===========================================================================
* Description: Free a packet buffer
* Parameters: pbuf - The packet buffer
* Returns:
*
*/
IP_GLOBAL void
ipmip6ha_pktbuf_free(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_pktbuf_t *pbuf)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
ipmip_buffer_release(&pbuf->mo_reply);
/* Free the data */
ipcom_free(pbuf);
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,171 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_pktbuf.h,v $ $Revision: 1.13 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_pktbuf.h,v $
* $Author: jhorteli $ $Date: 2010-03-30 15:00:37 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_PKTBUF_H
#define IPMIP6HA_PKTBUF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip6_pkt.h>
#include <private/ipmip6_mh_pkt.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_if;
struct Ipmip6_if;
struct Ipmip6ha_context;
struct Ipmip6ha_mag;
typedef struct Ipmip6ha_pktbuf_pktinfo
{
Ip_u32 mip6BindingCOAType;
union Ipmip6_mib_InetAddress mip6BindingCOA;
Ip_u16 mip6BindingUDPEncapPort;
Ip_bool mip6BindingUDPEncapsulate;
Ip_bool mip6BindingCOANAT;
Ip_u32 mip6BindingHomeAddressType;
union Ipmip6_mib_InetAddress mip6BindingHomeAddress;
Ip_u8 iperr;
Ip_u8 haMobilityError;
Ip_u8 haMobilityBindingTunnelingType;
Ip_u8 haMobilityBindingSuccessCode;
Ip_time_t haBindingLastUpdated;
Ip_u16 haMobilityBindingTimeGranted;
Ip_u16 haMobilityBindingSequenceNumber;
Ip_u16 haMobilityReason;
Ip_u16 haMobilityBindingFlags;
Ip_time_t haMobilityPrefixValid;
Ip_time_t haMobilityPrefixTimestamp;
Ip_bool haMobilityDeregistration;
Ip_bool haMobilitySelectiveDeregistration;
Ip_bool haMobilityRefreshRequest;
} Ipmip6ha_pktbuf_pktinfo_t;
typedef struct Ipmip6ha_pktbuf
{
Ipmip6_pktbuf_t ipmip6;
Ip_u32 state;
Ip_bool update_services;
Ip_bool refresh_request;
Ip_u32 extensions_processed;
/* The arriving interface */
union
{
struct Ipmip6ha_if *priv;
struct Ipmip6_if *pub;
} iff_home;
union
{
struct Ipmip6ha_if *priv;
struct Ipmip6_if *pub;
} iff_transport;
Ipmip_buffer_t mo_reply;
Ipmip6ha_pktbuf_pktinfo_t pktinfo;
void **extensions;
} Ipmip6ha_pktbuf_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6ha_pktbuf_alloc
*===========================================================================
* Description: Allocate a packet buffer
* Parameters: ctx - Context
* proc - Process
* Returns: A newly allocated packet buffer
*
*/
IP_GLOBAL Ipmip_pktbuf_t *ipmip6ha_pktbuf_alloc(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ip_size_t extra);
/*
*===========================================================================
* ipmip6ha_pktbuf_free
*===========================================================================
* Description: Free a packet buffer
* Parameters: ctx - Context
* proc - Process
* pbuf - The packet buffer
* Returns:
*
*/
IP_GLOBAL void ipmip6ha_pktbuf_free(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_pktbuf_t *pbuf);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,504 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_pmipv6_dhcpv4.c,v $ $Revision: 1.7 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_pmipv6_dhcpv4.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 "ipmip6ha_config.h"
#if defined(IPMIP_USE_INET)
/*
****************************************************************************
* 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 <ipcom_strlib.h>
#include <ipmip.h>
#include <private/ipmip_sysvar.h>
#include <private/ipmip_dhcp.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_pktbuf.h"
#include "ipmip6ha_nemo.h"
#include "ipmip6ha_nemo_dsmipv6.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_PMIPV6_DHCPV4_SERVER "DHCPV4-SERVER"
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef struct Ipmip6ha_pmipv6_dhcpv4_config
{
Ip_bool enabled;
} Ipmip6ha_pmipv6_dhcpv4_config_t;
typedef struct Ipmip6ha_pmipv6_dhcpv4_config_global
{
Ip_bool enabled;
} Ipmip6ha_pmipv6_dhcpv4_config_global_t;
typedef struct Ipmip6ha_pmipv6_dhcpv4_node
{
Ipmip_dhcp_node_t dhcp;
Ip_bool installed;
} Ipmip6ha_pmipv6_dhcpv4_node_t;
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC int
ipmip6ha_pmipv6_dhcpv4_server(int event,
Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_pmipv6_dhcpv4_node_t *dnode,
Ipmip6ha_pktbuf_t *pbuf)
{
if (event == IPMIP_TIMER_EVENT_RUN)
{
Ipmip6ha_node_t *node = dnode->dhcp.opaque;
Ipmip_dhcp_hdr_t *pkt = (Ipmip_dhcp_hdr_t *)IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
if (pkt->op == IPMIP_DHCP_OP_BOOTREQUEST)
{
Ip_u8 *opt;
/**/
if ((opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_DHCP_MESSAGE_TYPE)) == IP_NULL)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"No MESSAGE TYPE in DHCP Request Received by %s",
ipmip6ha_node_describe(proc, node)));
goto done_out;
}
else
{
Ipmip6ha_pktbuf_t *rpkt = (Ipmip6ha_pktbuf_t*)ipmip_pktbuf_alloc(&ctx->ipmip6.ipmip, proc, 512);
Ipmip_buffer_t *buf = &rpkt->ipmip6.ipmip.packet;
Ip_u8 type;
Ip_u8 *ra_opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_RELAY_AGENT_INFO);
Ip_u8 *req_opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_DHCP_PARAMETER_REQUEST_LIST);
Ip_u32 tmp32;
Ip_u32 override = 0;
/* Do we have a override option? */
if (ra_opt)
{
Ip_u8 *oopt = ipmip_dhcp_option_find(&ra_opt[IPMIP_DHCP_OPT_DATA], ra_opt[IPMIP_DHCP_OPT_LEN], IPMIP_DHCP_SUBOPTCODE_RA_SERVER_OVERRIDE);
if (oopt)
override = IP_GET_32ON8(&oopt[IPMIP_DHCP_OPT_DATA]);
}
/* Add the packet */
ipmip_buffer_append(buf, pkt, sizeof(*pkt));
switch(opt[IPMIP_DHCP_OPT_DATA])
{
case IPMIP_DHCP_MSG_DISCOVER:
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"DHCP Discover Received by %s",
ipmip6ha_node_describe(proc, node)));
type = IPMIP_DHCP_MSG_OFFER;
break;
case IPMIP_DHCP_MSG_REQUEST:
{
Ip_u32 sid = 0;
Ip_u32 req_addr = 0;
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"DHCP Request Received by %s",
ipmip6ha_node_describe(proc, node)));
sid = ipmip_dhcp_option_buffer_find_ip(&pbuf->ipmip6.ipmip.packet,
IPMIP_DHCP_OPTCODE_DHCP_SERVER_IDENTIFIER);
req_addr = ipmip_dhcp_option_buffer_find_ip(&pbuf->ipmip6.ipmip.packet,
IPMIP_DHCP_OPTCODE_DHCP_REQUESTED_ADDRESS);
if (req_addr == 0)
req_addr = IP_GET_32ON8(&pkt->ciaddr);
if (sid != 0 && sid != node->ifp_home->ifaddr_v4)
{
if (override == 0 || sid != override)
goto done_out;
}
if (req_addr != 0 && req_addr == dnode->dhcp.remote_id)
type = IPMIP_DHCP_MSG_ACK;
else
type = IPMIP_DHCP_MSG_NAK;
}
break;
case IPMIP_DHCP_MSG_DECLINE:
/* Do what? */
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"DHCP Decline Received by %s",
ipmip6ha_node_describe(proc, node)));
goto done_out;
case IPMIP_DHCP_MSG_RELEASE:
/* Do what? */
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"DHCP Release Received by %s",
ipmip6ha_node_describe(proc, node)));
goto done_out;
case IPMIP_DHCP_MSG_INFORM:
/* Do what? */
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"DHCP Inform Received by %s",
ipmip6ha_node_describe(proc, node)));
if (IP_GET_32ON8(&pkt->ciaddr) == dnode->dhcp.remote_id)
type = IPMIP_DHCP_MSG_INFORM_ACK;
else
type = IPMIP_DHCP_MSG_NAK;
break;
default:
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"DHCP unknown Received by %s",
ipmip6ha_node_describe(proc, node)));
goto done_out;
}
/* Add TYPE */
ipmip_dhcp_option_buffer_append_u8(buf, IPMIP_DHCP_OPTCODE_DHCP_MESSAGE_TYPE, type);
ipmip_dhcp_option_buffer_append_ip(buf, IPMIP_DHCP_OPTCODE_DHCP_SERVER_IDENTIFIER, override? override : node->ifp_home->ifaddr_v4);
/**/
if (type != IPMIP_DHCP_MSG_NAK)
{
/* ACK or INFORM_ACK */
if (type != IPMIP_DHCP_MSG_INFORM_ACK)
{
#ifndef IPTESTENGINE
ipmip_dhcp_option_buffer_append_u32(buf, IPMIP_DHCP_OPTCODE_DHCP_LEASE_TIME, node->mip6BindingCacheEntry.mip6BindingTimeRemaining);
#else
ipmip_dhcp_option_buffer_append_u32(buf, IPMIP_DHCP_OPTCODE_DHCP_LEASE_TIME, 5);
#endif
}
/* Add the basic options */
{
Ipmip6ha_nemo_dsmipv6_config_t *cfg = ipmip6ha_nemo_dsmipv6_subnet_config_get(ctx, proc, node->ifp_home->nemo->nemo_dsmipv6, dnode->dhcp.remote_id);
if (cfg != IP_NULL)
{
Ipmip6ha_nemo_dsmipv6_config_t *ncfg;
Ipmip_dhcp_option_t *dopt;
if (req_opt != IP_NULL)
{
for (tmp32 = 0; tmp32 < req_opt[IPMIP_DHCP_OPT_LEN]; tmp32++)
{
for (ncfg = cfg; ncfg != IP_NULL; ncfg = ncfg->parent)
{
dopt = ipmip_dhcp_option_entry_find(&ncfg->opts, req_opt[IPMIP_DHCP_OPT_DATA + tmp32]);
if (dopt != IP_NULL)
{
ipmip_dhcp_buffer_append_option_entry(buf, dopt);
break;
}
}
}
}
for (ncfg = cfg; ncfg != IP_NULL; ncfg = ncfg->parent)
{
for (dopt = IPCOM_LIST_FIRST(&ncfg->opts); dopt != IP_NULL; dopt = IPCOM_LIST_NEXT(&dopt->next))
ipmip_dhcp_buffer_append_option_entry(buf, dopt);
}
}
}
}
else
{
/* NAK */
}
/* Restore the RA_OPT */
if (ra_opt)
ipmip_dhcp_option_buffer_append(buf, IPMIP_DHCP_OPTCODE_RELAY_AGENT_INFO, ra_opt[IPMIP_DHCP_OPT_LEN], &ra_opt[IPMIP_DHCP_OPT_DATA]);
ipmip_dhcp_option_buffer_close(buf);
pkt = (Ipmip_dhcp_hdr_t *)IPMIP_BUFFER_PTR(buf);
pkt->op = IPMIP_DHCP_OP_BOOTREPLY;
pkt->hops = 0;
if (type != IPMIP_DHCP_MSG_NAK && type != IPMIP_DHCP_MSG_INFORM_ACK)
IP_SET_32ON8(&pkt->yiaddr, dnode->dhcp.remote_id);
/* Send */
tmp32 = IP_GET_32ON8(&pkt->giaddr);
if (tmp32 == 0)
tmp32 = dnode->dhcp.remote_id;
/* Always assume unicast; unicast renew will be tunneled */
ipmip_dhcp_server_reply(&ctx->ipmip6.ipmip, proc, &rpkt->ipmip6.ipmip, node->ifp_home->ifaddr_v4, IP_NULL, IP_FALSE);
}
}
else
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"DHCP Reply Received for %s",
ipmip6ha_node_describe(proc, node)));
}
}
done_out:
/* Free the DHCP packet */
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
return IPMIP_TIMER_RET_DONE;
}
IP_STATIC void
ipmip6ha_pmipv6_dhcpv4_config(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmip6ha_if *ifp,
Ipmip6ha_pmipv6_dhcpv4_config_global_t *gcfg,
Ipmip6ha_pmipv6_dhcpv4_config_t *cfg,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ifp);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
cfg->enabled = ipmip_sysvar_bool(gcfg->enabled, "ipmip6ha.interface.%s.LMA.inet.dhcp.server", ifp->ipmip6.iff.ifname);
if (cfg->enabled)
ipmip_dhcp_context_create(&ctx->ipmip6.ipmip, proc);
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
/**/
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.inet.dhcp.server=%s",
ifp->ipmip6.iff.ifname, cfg->enabled? "enabled" : "disabled");
}
}
IP_STATIC void
ipmip6ha_pmipv6_dhcpv4_config_global(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
Ipmip6ha_pmipv6_dhcpv4_config_global_t *gcfg,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
gcfg->enabled = ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.LMA.inet.dhcp.server");
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
ipmip_cli_config_printf(&request->message,
"ipmip6ha.LMA.inet.dhcp.server=%s",
gcfg->enabled? "enabled" : "disabled");
}
}
IP_STATIC int
ipmip6ha_pmipv6_dhcpv4_provide(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
void *gcfg,
Ipmip6ha_pmipv6_dhcpv4_config_t *cfg,
Ipmip6ha_pmipv6_dhcpv4_node_t *handle,
struct Ipmip6ha_node_P *node,
struct Ipmip_timer *service)
{
Ipmip6ha_nemo_dsmipv6_t *nemo;
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(service);
IPMIP_UNUSED_PARAMETER(gcfg);
if (cfg->enabled)
{
if (action == IPMIP_CALLBACK_ENABLE)
{
nemo = IPCOM_LIST_FIRST(&node->node.nemo_hoa_v4);
if (nemo != IP_NULL)
{
handle->dhcp.remote_id = nemo->prefix;
handle->dhcp.lock = node->node.lock;
handle->dhcp.opaque = node;
handle->dhcp.process_func = (Ipmip_timer_func_t)ipmip6ha_pmipv6_dhcpv4_server;
ipmip_dhcp_register(&ctx->ipmip6.ipmip, proc, &handle->dhcp);
handle->installed = IP_TRUE;
}
}
else if (action == IPMIP_CALLBACK_DISABLE || action == IPMIP_CALLBACK_UPDATE)
{
if (handle->installed)
{
ipmip_dhcp_unregister(&ctx->ipmip6.ipmip, proc, &handle->dhcp);
handle->installed = IP_FALSE;
}
if (action == IPMIP_CALLBACK_UPDATE)
return IPMIP_CALLBACK_RET_FAILED;
}
}
/* Don't delay */
return IPMIP_CALLBACK_RET_SUCCESS;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6ha_pmipv6_dhcpv4_install(struct Ipmip6ha_context *ctx);
IP_GLOBAL void
ipmip6ha_pmipv6_dhcpv4_install(struct Ipmip6ha_context *ctx)
{
static Ipmip6ha_extension_t srv;
ipcom_memset(&srv, 0, sizeof(srv));
srv.name = IPMIP6HA_PMIPV6_DHCPV4_SERVER;
srv.ifp_data_size = sizeof(Ipmip6ha_pmipv6_dhcpv4_config_t);
srv.global_data_size= sizeof(Ipmip6ha_pmipv6_dhcpv4_config_global_t);
srv.node_data_size = sizeof(Ipmip6ha_pmipv6_dhcpv4_node_t);
srv.config_global = (Ipmip6ha_extension_config_global_t)ipmip6ha_pmipv6_dhcpv4_config_global;
srv.config_ifp = (Ipmip6ha_extension_config_ifp_t)ipmip6ha_pmipv6_dhcpv4_config;
srv.provide = (Ipmip6ha_extension_provide_t)ipmip6ha_pmipv6_dhcpv4_provide;
/* This is a PMIP only feature */
ipmip6ha_context_register_extension(ctx, &srv, IP_FALSE, IP_TRUE);
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
#else
IP_GLOBAL void ipmip6ha_pmipv6_dhcpv4_install(struct Ipmip6ha_context *ctx);
IP_GLOBAL void
ipmip6ha_pmipv6_dhcpv4_install(struct Ipmip6ha_context *ctx)
{
IPMIP_UNUSED_PARAMETER(ctx);
}
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,353 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_pmipv6_dhcpv6.c,v $ $Revision: 1.12.16.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_pmipv6_dhcpv6.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 "ipmip6ha_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 <ipcom_strlib.h>
#include <ipmip.h>
#include <private/ipmip_sysvar.h>
#include <private/ipmip_dhcp6.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_pktbuf.h"
#include "ipmip6ha_nemo.h"
#ifdef IPDHCPS6
#include <ipdhcps6.h>
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_PMIPV6_DHCPV6_SERVER "DHCPV6-SERVER"
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef struct Ipmip6ha_pmipv6_dhcpv6_config_global
{
Ip_bool enabled;
Ip_u32 preferred;
Ip_u32 valid;
} Ipmip6ha_pmipv6_dhcpv6_config_global_t;
typedef struct Ipmip6ha_pmipv6_dhcpv6_config
{
Ip_bool enabled;
Ip_u32 preferred;
Ip_u32 valid;
} Ipmip6ha_pmipv6_dhcpv6_config_t;
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC void
ipmip6ha_pmipv6_dhcpv6_config_global(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
Ipmip6ha_pmipv6_dhcpv6_config_global_t *gcfg,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(gcfg);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
gcfg->enabled = ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.LMA.dhcp.server");
gcfg->preferred = ipmip_sysvar_u32(10000, "ipmip6ha.LMA.dhcp.server.preferred");
gcfg->valid = ipmip_sysvar_u32(10000, "ipmip6ha.LMA.dhcp.server.valid");
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
/* Do nothing */
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
ipmip_cli_config_printf(&request->message,
"ipmip6ha.LMA.dhcp.server=%s",
gcfg->enabled? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.LMA.dhcp.server.valid=%u",
gcfg->valid);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.LMA.dhcp.server.preferred=%u",
gcfg->preferred);
}
}
IP_STATIC void
ipmip6ha_pmipv6_dhcpv6_config(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmip6ha_if *ifp,
Ipmip6ha_pmipv6_dhcpv6_config_global_t *gcfg,
Ipmip6ha_pmipv6_dhcpv6_config_t *cfg,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ifp);
IPMIP_UNUSED_PARAMETER(gcfg);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
cfg->enabled = ipmip_sysvar_bool(gcfg->enabled, "ipmip6ha.interface.%s.LMA.dhcp.server", ifp->ipmip6.iff.ifname);
cfg->preferred = ipmip_sysvar_u32(gcfg->preferred, "ipmip6ha.interface.%s.LMA.dhcp.server.preferred", ifp->ipmip6.iff.ifname);
cfg->valid = ipmip_sysvar_u32(gcfg->valid, "ipmip6ha.interface.%s.LMA.dhcp.server.valid", ifp->ipmip6.iff.ifname);
if (cfg->enabled)
ipmip_dhcp6_embedded_server_start(&ctx->ipmip6.ipmip, proc, ifp->ipmip6.iff.ifname);
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
/* Do nothing */
if (cfg->enabled)
ipmip_dhcp6_embedded_server_stop(&ctx->ipmip6.ipmip, proc);
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.dhcp.server=%s",
ifp->ipmip6.iff.ifname, cfg->enabled? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.dhcp.server.valid=%u",
ifp->ipmip6.iff.ifname, cfg->valid);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.dhcp.server.preferred=%u",
ifp->ipmip6.iff.ifname, cfg->preferred);
}
}
IP_STATIC int
ipmip6ha_pmipv6_dhcpv6_provide(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
Ipmip6ha_pmipv6_dhcpv6_config_global_t *gcfg,
Ipmip6ha_pmipv6_dhcpv6_config_t *cfg,
void *handle,
struct Ipmip6ha_node_P *node,
struct Ipmip_timer *service)
{
Ipmip6ha_nemo_t *nemo, *nnemo;
Ipmip6ha_nemo_t *nemo_p, *nnemo_p;
Ipdhcps6_subnet subnet;
IPMIP_UNUSED_PARAMETER(service);
IPMIP_UNUSED_PARAMETER(cfg);
IPMIP_UNUSED_PARAMETER(handle);
IPMIP_UNUSED_PARAMETER(gcfg);
if (cfg->enabled)
{
if (action == IPMIP_CALLBACK_ENABLE)
{
for (nemo = IPCOM_LIST_FIRST(&node->node.nemo_v6); nemo != IP_NULL; nemo = nnemo)
{
nnemo = IPCOM_LIST_NEXT(&nemo->next);
ipcom_memset(&subnet, 0, sizeof(subnet));
ipcom_memcpy(&subnet.prefix, &nemo->prefix, sizeof(struct Ip_in6_addr));
subnet.prefix_len = nemo->len;
if (ipdhcps6_subnet_add(&subnet) != IPCOM_SUCCESS)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s failed to add subnet '%s/%d'",
ipmip6ha_node_describe(proc, &node->node),
ipmip_ntop_inet6(proc, &nemo->prefix, IP_NULL),
nemo->len));
}
for (nemo_p = IPCOM_LIST_FIRST(&node->node.nemo_v6); nemo_p != IP_NULL; nemo_p = nnemo_p)
{
Ipdhcps6_poolinfo pool;
nnemo_p = IPCOM_LIST_NEXT(&nemo_p->next);
ipcom_memcpy(&pool.first, &nemo_p->prefix, sizeof(struct Ip_in6_addr));
pool.first.in6.addr32[3] = 0x1;
ipcom_memcpy(&pool.last, &pool.first, sizeof(struct Ip_in6_addr));
pool.preferred_lifetime = cfg->preferred;
pool.valid_lifetime = cfg->valid;
pool.prefix_len = 0;
if (ipdhcps6_pool_add(&subnet, &pool) != IPCOM_SUCCESS)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s failed to add pool to subnet '%s/%d'",
ipmip6ha_node_describe(proc, &node->node),
ipmip_ntop_inet6(proc, &nemo->prefix, IP_NULL),
nemo->len));
}
}
}
}
else if (action == IPMIP_CALLBACK_DISABLE || action == IPMIP_CALLBACK_UPDATE)
{
for (nemo = IPCOM_LIST_FIRST(&node->node.nemo_v6); nemo != IP_NULL; nemo = nnemo)
{
nnemo = IPCOM_LIST_NEXT(&nemo->next);
/* Subnet delete will delete any associated pools as well */
ipcom_memset(&subnet, 0, sizeof(subnet));
ipcom_memcpy(&subnet.prefix, &nemo->prefix, sizeof(struct Ip_in6_addr));
subnet.prefix_len = nemo->len;
if (ipdhcps6_subnet_delete(&subnet) != IPCOM_SUCCESS)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s failed to delete subnet '%s/%d'",
ipmip6ha_node_describe(proc, &node->node),
ipmip_ntop_inet6(proc, &nemo->prefix, IP_NULL),
nemo->len));
}
}
if (action == IPMIP_CALLBACK_UPDATE)
return IPMIP_CALLBACK_RET_FAILED;
}
}
/* Don't delay */
return IPMIP_CALLBACK_RET_SUCCESS;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6ha_pmipv6_dhcpv6_install(struct Ipmip6ha_context *ctx);
IP_GLOBAL void
ipmip6ha_pmipv6_dhcpv6_install(struct Ipmip6ha_context *ctx)
{
static Ipmip6ha_extension_t srv;
ipcom_memset(&srv, 0, sizeof(srv));
srv.name = IPMIP6HA_PMIPV6_DHCPV6_SERVER;
srv.ifp_data_size = sizeof(Ipmip6ha_pmipv6_dhcpv6_config_t);
srv.global_data_size= sizeof(Ipmip6ha_pmipv6_dhcpv6_config_global_t);
srv.config_global = (Ipmip6ha_extension_config_global_t)ipmip6ha_pmipv6_dhcpv6_config_global;
srv.config_ifp = (Ipmip6ha_extension_config_ifp_t)ipmip6ha_pmipv6_dhcpv6_config;
srv.provide = (Ipmip6ha_extension_provide_t)ipmip6ha_pmipv6_dhcpv6_provide;
/* This is a PMIP only feature */
ipmip6ha_context_register_extension(ctx, &srv, IP_FALSE, IP_TRUE);
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
#else
IP_GLOBAL void ipmip6ha_pmipv6_dhcpv6_install(struct Ipmip6ha_context *ctx);
IP_GLOBAL void
ipmip6ha_pmipv6_dhcpv6_install(struct Ipmip6ha_context *ctx)
{
IPMIP_UNUSED_PARAMETER(ctx);
}
#endif /* IPDHCPS6 */
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,221 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_pmipv6_linklocal.c,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_pmipv6_linklocal.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 "ipmip6ha_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 <ipcom_atomic.h>
#include <ipmip.h>
#include <private/ipmip_sysvar.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_pktbuf.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_PMIPV6_LINKLOCAL "LINKLOCAL"
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef struct Ipmip6ha_pmipv6_linklocal_config
{
Ipcom_atomic_t counter;
} Ipmip6ha_pmipv6_linklocal_config_t;
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC void
ipmip6ha_pmipv6_linklocal_config(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmip6ha_if *ifp,
void *gcfg,
Ipmip6ha_pmipv6_linklocal_config_t *cfg,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ifp);
IPMIP_UNUSED_PARAMETER(gcfg);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
ipcom_atomic_set(&cfg->counter, 0);
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
/* Do nothing */
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
IPMIP_UNUSED_PARAMETER(request);
}
}
IP_STATIC int
ipmip6ha_pmipv6_linklocal_provide(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
void *gcfg,
Ipmip6ha_pmipv6_linklocal_config_t *cfg,
void *handle,
struct Ipmip6ha_node_P *node,
struct Ipmip_timer *service)
{
IPMIP_UNUSED_PARAMETER(service);
IPMIP_UNUSED_PARAMETER(cfg);
IPMIP_UNUSED_PARAMETER(handle);
IPMIP_UNUSED_PARAMETER(gcfg);
if (action == IPMIP_CALLBACK_ENABLE)
{
if (IP_IN6_IS_ADDR_UNSPECIFIED(&node->pmipv6_link_local_address.prefix))
{
Ip_u32 low;
while ((low = (Ip_u32)ipcom_atomic_add_and_return(&cfg->counter, 1)) == 0)
;
ipcom_memset(&node->pmipv6_link_local_address.prefix, 0, sizeof(node->pmipv6_link_local_address.prefix));
/**/
IP_SET_HTONS(&node->pmipv6_link_local_address.prefix.in6.addr16[0], 0xfe80);
IP_SET_HTONL(&node->pmipv6_link_local_address.prefix.in6.addr32[3], low);
IPMIP6_EVENT_IF(DEBUG2, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Generated Link-Local address %s for node %s",
ipmip_ntop_inet6(proc, &node->pmipv6_link_local_address.prefix, IP_NULL),
ipmip6ha_node_describe(proc, &node->node)));
}
}
else if (action == IPMIP_CALLBACK_DISABLE)
{
/* DO NOTHING */
}
/* Don't delay */
return IPMIP_CALLBACK_RET_SUCCESS;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6ha_pmipv6_linklocal_install(struct Ipmip6ha_context *ctx);
IP_GLOBAL void
ipmip6ha_pmipv6_linklocal_install(struct Ipmip6ha_context *ctx)
{
static Ipmip6ha_extension_t srv;
ipcom_memset(&srv, 0, sizeof(srv));
srv.name = IPMIP6HA_PMIPV6_LINKLOCAL;
srv.ifp_data_size = sizeof(Ipmip6ha_pmipv6_linklocal_config_t);
srv.config_ifp = (Ipmip6ha_extension_config_ifp_t)ipmip6ha_pmipv6_linklocal_config;
srv.provide = (Ipmip6ha_extension_provide_t)ipmip6ha_pmipv6_linklocal_provide;
/* This is a PMIP only feature */
ipmip6ha_context_register_extension(ctx, &srv, IP_FALSE, IP_TRUE);
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,469 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_service_testext.c,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/config/ipmip6ha_service_testext.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 "ipmip6ha_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 <ipcom_strlib.h>
#include <ipmip.h>
#include <private/ipmip_sysvar.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_util.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_pktbuf.h"
#include "ipmip6ha_nemo.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_SERVICE_SERVICE_SELECTION "SERVICE-SELECTION"
#define IPMIP6HA_SERVICE_VENDOR_EXTENSION "VENDOR-EXTENSION"
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef struct Ipmip6ha_service_selection_config
{
Ip_bool enabled;
Ip_bool change_allowed;
} Ipmip6ha_service_selection_config_t;
typedef struct Ipmip6ha_service_selection_node_handle
{
Ip_bool enabled;
Ipmip6_mh_mo_service_selection_mobility_option_t *selection;
} Ipmip6ha_service_selection_node_handle_t;
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC void
ipmip6ha_service_selection_config_global(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
Ipmip6ha_service_selection_config_t *gcfg,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(gcfg);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
gcfg->enabled = ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.service_selection.enabled");
gcfg->change_allowed = ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.service_selection.changeable");
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
/* Do nothing */
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
ipmip_cli_config_printf(&request->message,
"ipmip6ha.service_selection.enabled=%s",
gcfg->enabled? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.service_selection.changeable=%s",
gcfg->change_allowed? "enabled" : "disabled");
}
}
IP_STATIC void
ipmip6ha_service_selection_config(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmip6ha_if *ifp,
Ipmip6ha_service_selection_config_t *gcfg,
Ipmip6ha_service_selection_config_t *cfg,
Ipmip_cli_message_t *request)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ifp);
IPMIP_UNUSED_PARAMETER(gcfg);
if (action == IPMIP_CALLBACK_CONFIG_READ)
{
cfg->enabled = ipmip_sysvar_bool(gcfg->enabled, "ipmip6ha.interface.%s.service_selection.enabled", ifp->ipmip6.iff.ifname);
cfg->change_allowed = ipmip_sysvar_bool(gcfg->enabled, "ipmip6ha.interface.%s.service_selection.changeable", ifp->ipmip6.iff.ifname);
}
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
{
/* Do nothing */
}
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
{
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.service_selection.enabled=%s",
ifp->ipmip6.iff.ifname, cfg->enabled? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.service_selection.changeable=%s",
ifp->ipmip6.iff.ifname, cfg->change_allowed? "enabled" : "disabled");
}
}
IP_STATIC Ip_bool
ipmip6ha_service_selection_pkt_request_validate(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_service_selection_config_t *gcfg,
Ipmip6ha_service_selection_config_t *cfg,
Ipmip6ha_service_selection_node_handle_t *handle,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf,
struct Ipmip_timer *service)
{
IPMIP_UNUSED_PARAMETER(service);
IPMIP_UNUSED_PARAMETER(handle);
IPMIP_UNUSED_PARAMETER(gcfg);
if (pbuf->ipmip6.mo.service_selection != IP_NULL)
{
if (cfg->enabled)
{
/* Here's the time to verify if the selection's valid */
if (handle->enabled != IP_FALSE)
{
/* Already have a service setup?*/
if (!ipmip6_mh_mo_cmp(&pbuf->ipmip6.mo.service_selection->hdr, &handle->selection->hdr))
{
if (cfg->change_allowed)
{
/* Mismatch; redo selection */
IPMIP6_EVENT_IF(DEBUG, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s changing service selection to '%s'",
ipmip6ha_node_describe(proc, node),
ipmip_ntop_strn(proc, (char *)&pbuf->ipmip6.mo.service_selection->identifier[0], pbuf->ipmip6.mo.service_selection->hdr.len)));
pbuf->update_services = IP_TRUE;
}
else
{
ipmip_pktbuf_error(&pbuf->ipmip6.ipmip,
IPMIP6_MH_BA_STATUS_ERROR_SERVICE_AUTHORIZATION_FAILED,
"service selection '%s' specified, but not provided by home agent",
ipmip_ntop_strn(proc, (char *)&pbuf->ipmip6.mo.service_selection->identifier[0], pbuf->ipmip6.mo.service_selection->hdr.len));
ipmip6ha_node_delete(ctx, proc, node, "service selection disallowed");
}
}
}
}
else
{
ipmip_pktbuf_error(&pbuf->ipmip6.ipmip,
IPMIP6_MH_BA_STATUS_ERROR_SERVICE_AUTHORIZATION_FAILED,
"service selection '%s' specified, but not provided by home agent",
ipmip_ntop_strn(proc, (char *)&pbuf->ipmip6.mo.service_selection->identifier[0], pbuf->ipmip6.mo.service_selection->hdr.len));
}
}
/* Don't delay */
return IP_FALSE;
}
IP_STATIC Ip_bool
ipmip6ha_service_selection_pkt_request_accept(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_service_selection_config_t *gcfg,
Ipmip6ha_service_selection_config_t *cfg,
Ipmip6ha_service_selection_node_handle_t *handle,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf,
struct Ipmip_timer *service)
{
IPMIP_UNUSED_PARAMETER(service);
IPMIP_UNUSED_PARAMETER(handle);
IPMIP_UNUSED_PARAMETER(gcfg);
IPMIP_UNUSED_PARAMETER(cfg);
if (pbuf->ipmip6.mo.service_selection != IP_NULL)
{
/* Only store the service first time around */
if (handle->enabled == IP_FALSE)
{
/* Store the selected service; we'll use it later in provde */
handle->selection = (void *)ipmip6_mh_mo_dup(&pbuf->ipmip6.mo.service_selection->hdr);
handle->enabled = IP_TRUE;
/* Mismatch; redo selection */
IPMIP6_EVENT_IF(DEBUG, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s accepting service selection '%s'",
ipmip6ha_node_describe(proc, node),
ipmip_ntop_strn(proc, (char *)&pbuf->ipmip6.mo.service_selection->identifier[0], pbuf->ipmip6.mo.service_selection->hdr.len)));
}
}
/* Don't delay */
return IP_FALSE;
}
IP_STATIC int
ipmip6ha_service_selection_provide(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
Ipmip6ha_service_selection_config_t *gcfg,
Ipmip6ha_service_selection_config_t *cfg,
Ipmip6ha_service_selection_node_handle_t *handle,
struct Ipmip6ha_node *node,
struct Ipmip_timer *service)
{
IPMIP_UNUSED_PARAMETER(service);
IPMIP_UNUSED_PARAMETER(cfg);
IPMIP_UNUSED_PARAMETER(gcfg);
if (action == IPMIP_CALLBACK_ENABLE)
{
if (handle->enabled)
{
/* Do what? */
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s enabling service selection '%s'",
ipmip6ha_node_describe(proc, node),
ipmip_ntop_strn(proc, (char *)&handle->selection->identifier[0], handle->selection->hdr.len)));
}
}
else if (action == IPMIP_CALLBACK_DISABLE)
{
if (handle->enabled)
{
/* Disable whatever service setup we've got */
/* Free & Reset */
ipcom_free(handle->selection);
handle->enabled = IP_FALSE;
}
}
else if (action == IPMIP_CALLBACK_UPDATE)
{
/* We're redoing the service setups */
if (handle->enabled)
{
/* Disable whatever service setup we've got */
/* Free & Reset */
ipcom_free(handle->selection);
handle->enabled = IP_FALSE;
}
/* Indicate that this service needs to be re-setup; if you ignore UPDATE dont return failure */
return IPMIP_CALLBACK_RET_FAILED;
}
/* Don't delay */
return IPMIP_CALLBACK_RET_SUCCESS;
}
IP_STATIC Ip_bool
ipmip6ha_service_vendor_extension_pkt_request_accept(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
void *gcfg,
void *cfg,
void *handle,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf,
struct Ipmip_timer *service)
{
IPMIP_UNUSED_PARAMETER(service);
IPMIP_UNUSED_PARAMETER(handle);
IPMIP_UNUSED_PARAMETER(gcfg);
IPMIP_UNUSED_PARAMETER(cfg);
if (pbuf->ipmip6.mo.vendor_options.numelem > 0)
{
Ipmip6_mh_mo_vendor_specific_mobility_option_t *mo;
unsigned i;
for (i = 0; i < pbuf->ipmip6.mo.vendor_options.numelem; i++)
{
mo = (Ipmip6_mh_mo_vendor_specific_mobility_option_t*)pbuf->ipmip6.mo.vendor_options.hdrs[i];
/* Mismatch; redo selection */
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s received Vendor Extension %u.%u",
ipmip6ha_node_describe(proc, node),
IP_GET_NTOHL(&mo->vendor_id), mo->sub_type));
}
}
/* Don't delay */
return IP_FALSE;
}
/* Echo the Vendor Extension */
IP_STATIC void
ipmip6ha_service_selection_pkt_reply_apply(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
void *gcfg,
void *cfg,
void *handle,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf_reply,
struct Ipmip6ha_pktbuf *pbuf_req)
{
IPMIP_UNUSED_PARAMETER(handle);
IPMIP_UNUSED_PARAMETER(gcfg);
IPMIP_UNUSED_PARAMETER(cfg);
IPMIP_UNUSED_PARAMETER(node);
if (pbuf_req->ipmip6.mo.vendor_options.numelem > 0)
{
Ipmip6_mh_mo_vendor_specific_mobility_option_t *mo;
unsigned i;
for (i = 0; i < pbuf_req->ipmip6.mo.vendor_options.numelem; i++)
{
mo = (Ipmip6_mh_mo_vendor_specific_mobility_option_t*)pbuf_req->ipmip6.mo.vendor_options.hdrs[i];
ipmip6_mh_pkt_opt_add_mo(&ctx->ipmip6,
proc,
&pbuf_reply->ipmip6,
&mo->hdr);
}
}
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6ha_service_testext_install(struct Ipmip6ha_context *ctx);
IP_GLOBAL void
ipmip6ha_service_testext_install(struct Ipmip6ha_context *ctx)
{
static Ipmip6ha_extension_t srv_sel;
static Ipmip6ha_extension_t srv_ven;
ipcom_memset(&srv_sel, 0, sizeof(srv_sel));
srv_sel.name = IPMIP6HA_SERVICE_SERVICE_SELECTION;
srv_sel.ifp_data_size = sizeof(Ipmip6ha_service_selection_config_t);
srv_sel.global_data_size= sizeof(Ipmip6ha_service_selection_config_t);
srv_sel.node_data_size = sizeof(Ipmip6ha_service_selection_node_handle_t);
srv_sel.config_global = (Ipmip6ha_extension_config_global_t)ipmip6ha_service_selection_config_global;
srv_sel.config_ifp = (Ipmip6ha_extension_config_ifp_t)ipmip6ha_service_selection_config;
srv_sel.provide = (Ipmip6ha_extension_provide_t)ipmip6ha_service_selection_provide;
srv_sel.pkt_req_accept = (Ipmip6ha_extension_pkt_req_accept_t)ipmip6ha_service_selection_pkt_request_accept;
srv_sel.pkt_req_validate= (Ipmip6ha_extension_pkt_req_validate_t)ipmip6ha_service_selection_pkt_request_validate;
/* This is a PMIP only feature */
ipmip6ha_context_register_extension(ctx, &srv_sel, IP_TRUE, IP_TRUE);
ipcom_memset(&srv_ven, 0, sizeof(srv_ven));
srv_ven.name = IPMIP6HA_SERVICE_VENDOR_EXTENSION;
srv_ven.pkt_req_accept = (Ipmip6ha_extension_pkt_req_accept_t)ipmip6ha_service_vendor_extension_pkt_request_accept;
srv_ven.pkt_rep_apply = (Ipmip6ha_extension_pkt_rep_apply_t)ipmip6ha_service_selection_pkt_reply_apply;
/* This is a PMIP only feature */
ipmip6ha_context_register_extension(ctx, &srv_ven, IP_TRUE, IP_TRUE);
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,11 @@
IPTARGETS := lib
ifneq ($(IPMAKEFILE),)
include $(IPMAKEFILE)
else
include $(IPCOM_ROOT)/Makefile
endif
include ipmip6ha.mk
include $(IPCOM_ROOT)/gmake/ipcom_make.mk
lib: dirs $(IPLIBFILE)
@@ -0,0 +1,139 @@
#############################################################################
# IPMIPMN.MK
#
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha.mk,v $ $Revision: 1.10 $
# $Source: /home/interpeak/CVSRoot/ipmip6ha/gmake/ipmip6ha.mk,v $
# $Author: jhorteli $ $Date: 2009-03-02 11:45:07 $
# $State: Exp $ $Locker: $
#
# INTERPEAK_COPYRIGHT_STRING
#
#############################################################################
ifeq ($(IPMIP6HA),)
IPMIP6HA := yes
#############################################################################
# PRODUCT
###########################################################################
IPPROD ?= ipmip6ha
#############################################################################
# DEFINE
###########################################################################
IPDEFINE += -DIPMIP6HA
#############################################################################
# INCLUDE
###########################################################################
IPINCLUDE += -I$(IPMIP6HA_ROOT)/config
IPINCLUDE += -I$(IPMIP6HA_ROOT)/include
IPINCLUDE += -I$(IPMIP6HA_ROOT)/src
#############################################################################
# OBJECTS
###########################################################################
ifneq ($(IPPORT),lkm)
ifneq ($(IPPORT),las)
IPLIBOBJECTS += ipmip6ha.o
IPLIBOBJECTS += ipmip6ha_cmd_ha6.o
endif
# Configuration
IPLIBOBJECTS_C += ipmip6ha_config.o
# Home Agent objects
IPLIBOBJECTS += ipmip6ha_main.o
IPLIBOBJECTS += ipmip6ha_attr.o
IPLIBOBJECTS += ipmip6ha_cli.o
IPLIBOBJECTS += ipmip6ha_icmp.o
IPLIBOBJECTS += ipmip6ha_if.o
IPLIBOBJECTS += ipmip6ha_ifevent.o
IPLIBOBJECTS += ipmip6ha_mag.o
IPLIBOBJECTS += ipmip6ha_mh.o
IPLIBOBJECTS += ipmip6ha_nemo.o
IPLIBOBJECTS += ipmip6ha_nemo_dsmipv6.o
IPLIBOBJECTS += ipmip6ha_node.o
IPLIBOBJECTS += ipmip6ha_pktbuf.o
IPLIBOBJECTS += ipmip6ha_pmipv6_linklocal.o
IPLIBOBJECTS += ipmip6ha_pmipv6_dhcpv6.o
IPLIBOBJECTS += ipmip6ha_pmipv6_dhcpv4.o
IPLIBOBJECTS += ipmip6ha_service_testext.o
IPLIBOBJECTS += ipmip6ha_route.o
# 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 += $(IPMIP6HA_ROOT)/src $(IPMIP6HA_ROOT)/config
#############################################################################
# LIB
###########################################################################
IPLIBS += $(IPLIBROOT)/libipmip6ha.a
endif # LKM
ifeq ($(IPPORT),las)
#############################################################################
# BINARIES
###########################################################################
# Path to binaries
IPCMDDIR := $(IPOBJDIR)/bin
IPDAEMONDIR := $(IPOBJDIR)/sbin
# List of shell commands to build
IPMIP6HACMDS = ha6
_IPIPMIP6HACMDS = $(addprefix $(IPCMDDIR)/,$(IPMIP6HACMDS))
# List of daemons to build
IPMIP6HAD = ha6d
_IPMIP6HAD = $(addprefix $(IPDAEMONDIR)/,$(IPMIP6HAD))
bin: $(_IPIPMIP6HACMDS) $(_IPMIP6HAD)
$(IPOBJDIR)/ipmip6ha_cmd_ha6.o: $(IPMIP6HA_ROOT)/src/ipmip6ha_cmd_ha6.c
@$(IPECHO) "+++ Compiling IPMIP6HA shell command $<"
$(IPVERB)$(IPCC) -Dipmip6ha_cmd_ha6=ipcom_cmd_entry_point $(IPCFLAGS) -o $@ $<
$(IPOBJDIR)/ipmip6ha.o: $(IPMIP6HA_ROOT)/src/ipmip6ha.c
@$(IPECHO) "+++ Compiling IPMIP6HA daemon $<"
$(IPVERB)$(IPCC) -Dipmip6ha_proc=ipcom_daemon_entry_point $(IPCFLAGS) -o $@ $<
# Linking shell commands and daemons
$(IPCMDDIR)/ha6: $(IPOBJDIR)/ipmip6ha_cmd_ha6.o $(IPOBJDIR)/ipcom_shell_cmd_stub.o
@$(IPECHO) "+++ Linking IPMIP6HA shell command $@"
$(IPVERB)$(IPLD) -o $@ $(IPLDFLAGS) $^ $(IPLIBS) $(IPLIBS) $(IPLIBS) $(IPLASTLIBS)
$(IPDAEMONDIR)/ha6d: $(IPOBJDIR)/ipmip6ha.o $(IPOBJDIR)/ipcom_daemon_stub.o
@$(IPECHO) "+++ Linking IPMIP6HAD daemon $@"
$(IPVERB)$(IPLD) -o $@ $(IPLDFLAGS) $^ $(IPLIBS) $(IPLIBS) $(IPLIBS) $(IPLASTLIBS)
endif
endif
###########################################################################
# END OF IPMIP6.MK
###########################################################################
@@ -0,0 +1,68 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/include/ipmip6ha.h,v $
* $Author: jhorteli $ $Date: 2009-06-18 12:53:11 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_H
#define IPMIP6HA_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_RELEASE 60701
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,137 @@
/* ipmip6ha_attr.h - ipmip6ha_attr.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_attr.h,v $ $Revision: 1.11 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/include/ipmip6ha_attr.h,v $
* $Author: jhorteli $ $Date: 2009-06-18 12:53:11 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_ATTR_H
#define IPMIP6HA_ATTR_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipmip6_mib.h>
#include <private/ipmip6_cli.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
/* Replies with a list of IPMIP6MN_CLI_NETWORK_ATTR_NAME */
IPMIP6HA_CLI_BC_X_LIST = IPMIP6_CLI_BASE,
/* Returns with a subset or all of the NETWORK attributes */
IPMIP6HA_CLI_BC_X_GET,
IPMIP6HA_CLI_BC_X_DELETE,
IPMIP6HA_CLI_BC_X_REVOKE_NODE,
IPMIP6HA_CLI_BC_X_REVOKE_NODE_INET,
IPMIP6HA_CLI_PREFIX_GET,
IPMIP6HA_CLI_MAG_GET,
IPMIP6HA_CLI_MAG_REVOKE,
IPMIP6HA_CLI_MAX
};
enum
{
IPMIP6HA_CLI_ATTR_NONE,
IPMIP6HA_CLI_ATTR_BC_X,
IPMIP6HA_CLI_ATTR_PREFIX,
IPMIP6HA_CLI_ATTR_MAG,
IPMIP6HA_CLI_ATTR_MAX
};
enum
{
IPMIP6HA_CLI_ATTR_BC_X_NONE,
IPMIP6HA_CLI_ATTR_BC_X_MOBILE_NAI,
IPMIP6HA_CLI_ATTR_BC_X_HOA_V4,
IPMIP6HA_CLI_ATTR_BC_X_HOA_V6,
IPMIP6HA_CLI_ATTR_BC_X_IFNAME,
IPMIP6HA_CLI_ATTR_BC_X_UPDATED,
IPMIP6HA_CLI_ATTR_BC_X_NAT_T,
IPMIP6HA_CLI_ATTR_BC_X_REGFLAGS,
IPMIP6HA_CLI_ATTR_BC_X_PREFIX_V4,
IPMIP6HA_CLI_ATTR_BC_X_PREFIX_V6,
IPMIP6HA_CLI_ATTR_BC_X_MIB_mip6BindingCacheEntry,
IPMIP6HA_CLI_ATTR_BC_X_MIB_mip6NodeTrafficEntry,
IPMIP6HA_CLI_ATTR_BC_X_HANDLE,
IPMIP6HA_CLI_ATTR_BC_X_REVOKE_REASON,
IPMIP6HA_CLI_ATTR_BC_X_MAX
};
enum
{
IPMIP6HA_CLI_ATTR_PREFIX_NONE,
IPMIP6HA_CLI_ATTR_PREFIX_PREFIX,
IPMIP6HA_CLI_ATTR_PREFIX_ROUTER,
IPMIP6HA_CLI_ATTR_PREFIX_IFNAME,
IPMIP6HA_CLI_ATTR_PREFIX_VALID,
IPMIP6HA_CLI_ATTR_PREFIX_TIMESTAMP,
IPMIP6HA_CLI_ATTR_PREFIX_MAX
};
enum
{
IPMIP6HA_CLI_ATTR_MAG_NONE,
IPMIP6HA_CLI_ATTR_MAG_ADDR_V6,
IPMIP6HA_CLI_ATTR_MAG_ADDR_V4,
IPMIP6HA_CLI_ATTR_MAG_IFNAME,
IPMIP6HA_CLI_ATTR_MAG_REFERENCES,
IPMIP6HA_CLI_ATTR_MAG_HEARTBEAT,
IPMIP6HA_CLI_ATTR_MAG_MATCH,
IPMIP6HA_CLI_ATTR_MAG_REASON,
IPMIP6HA_CLI_ATTR_MAG_MAX
};
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,195 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha.c,v $ $Revision: 1.19 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha.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 "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_ipd.h>
#include <ipcom_syslog.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <private/ipmip_dhcp.h>
#include <private/ipmip_sysvar.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_pkt.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha.h"
#include "ipmip6ha_h.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_nemo.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_cli.h"
#include "ipmip6ha_ifevent.h"
#include "ipmip6ha_mh.h"
#include "ipmip6ha_icmp.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_route.h"
#include "ipmip6ha_pktbuf.h"
#include "ipmip6ha_mag.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
IP_PUBLIC Ip_err ipmip6ha_start(void);
IP_PUBLIC const char *ipmip6ha_version(void);
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
IP_PUBLIC IPCOM_PROCESS(ipmip6ha_proc);
IP_PUBLIC
IPCOM_PROCESS(ipmip6ha_proc)
{
/* Invoke main */
ipmip6ha_main();
}
/*
*===========================================================================
* ipmipha_start
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC Ip_err
ipmip6ha_start(void)
{
Ipcom_proc_attr attr;
Ip_err ret;
ipcom_proc_attr_init(&attr);
attr.stacksize = IPCOM_PROC_STACK_LARGE;
ret = ipcom_proc_acreate("ipmip6had", ipmip6ha_proc, &attr, IP_NULL);
ip_assert(ret == IPCOM_SUCCESS);
return ret;
}
/*
*===========================================================================
* ipmipha_version
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_PUBLIC const char *
ipmip6ha_version(void)
{
return "@(#) IPMIP6HA $Name: VXWORKS_ITER40_2019102207 $ - INTERPEAK_COPYRIGHT_STRING";
}
#if defined (IP_PORT_LAS)
IP_PUBLIC Ip_err ipcom_daemon_configure(void);
IP_PUBLIC Ip_err ipcom_daemon_create(void);
IP_PUBLIC Ip_err
ipcom_daemon_configure(void)
{
return IPCOM_SUCCESS;
}
IP_PUBLIC Ip_err
ipcom_daemon_create(void)
{
return IPCOM_SUCCESS;
}
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,755 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_attr.c,v $ $Revision: 1.27 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_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 "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_err.h>
#include <ipcom_inet.h>
#include <ipcom_ipd.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock.h>
#include <ipcom_sock2.h>
#include <ipcom_sysctl.h>
#include <ipcom_syslog.h>
#include <ipcom_route.h>
#include <ipmip.h>
#include <private/ipmip_buffer.h>
#include <private/ipmip_util.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_icmp_pkt.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_attr.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_attr.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_nemo.h"
#include "ipmip6ha_nemo_dsmipv6.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_route.h"
#include "ipmip6ha_mag.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_attr_op
{
Ipmip_cli_message_t *request;
struct Ip_in6_addr *hoa;
const char *nai_mn;
Ip_size_t nai_mn_len;
Ip_u32 ifindex;
};
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmipfa_node_del_cb
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC void
ipmip6ha_attr_list_nodes(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_node_t *node,
struct Ipmip6ha_attr_op *ops,
void *unused)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(unused);
if (ops->hoa != IP_NULL && !IP_IN6_ARE_ADDR_EQUAL(ops->hoa, &node->mip6BindingCacheEntry.mip6BindingHomeAddress.ipv6))
return;
if (ops->nai_mn != IP_NULL && ops->nai_mn_len > 0)
{
/* Check NAI */
Ipmip6_mh_mo_nai_t *nai = (Ipmip6_mh_mo_nai_t *)node->nai_mn;
if (!nai)
return;
/* Does the NAI match? */
if (!ipmip_util_strnnmatch(ops->nai_mn, ops->nai_mn_len, (char *)&nai->nai[0], (Ip_size_t)(nai->hdr.len - 1)))
return;
}
if (ops->ifindex != 0 && ops->ifindex != node->ifp_home->ipmip6.iff.ifindex)
return;
/**/
ipmip_attr_put_u32(&ops->request->message, IPMIP6HA_CLI_ATTR_BC_X_HANDLE, node->identity);
}
/*
*===========================================================================
* ipmip6ha_attr_node_dump
*===========================================================================
* 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
ipmip6ha_attr_node_dump(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip_cli_message_t *request,
Ipmip6ha_node_t *node)
{
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
Ip_size_t rhdr = 0;
Ip_size_t rta;
if (node == IP_NULL)
rhdr = ipmip_attr_hdr_err(&request->message, hdr, IP_ERRNO_ENOENT, IP_NULL);
else
{
/**/
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
/* Do retrieve statistics */
ipmip6ha_netlink_get_handle_stat(ctx, proc, node);
/**/
rta = ipmip_attr_begin(&request->message, IPMIP6HA_CLI_ATTR_BC_X);
/* */
if (!IP_IN6_IS_ADDR_UNSPECIFIED(&node->mip6BindingCacheEntry.mip6BindingHomeAddress.ipv6))
ipmip_attr_put_inet6(&request->message, IPMIP6HA_CLI_ATTR_BC_X_HOA_V6, &node->mip6BindingCacheEntry.mip6BindingHomeAddress.ipv6);
/* Put the home address entry */
ipmip_attr_put_str(&request->message, IPMIP6HA_CLI_ATTR_BC_X_IFNAME,node->ifp_home->ipmip6.iff.ifname);
ipmip_attr_put_time_t(&request->message, IPMIP6HA_CLI_ATTR_BC_X_UPDATED, node->updated);
ipmip_attr_put_u32(&request->message, IPMIP6HA_CLI_ATTR_BC_X_REGFLAGS, node->regflags);
ipmip_attr_put_u32(&request->message, IPMIP6HA_CLI_ATTR_BC_X_HANDLE, node->identity);
if (node->nemo_v6.size > 0
#ifdef IPMIP_USE_INET
|| node->nemo_hoa_v4.size > 0 || node->nemo_prefix_v4.size > 0
#endif
)
{
Ipmip6ha_nemo_t *nemo;
#ifdef IPMIP_USE_INET
Ipmip6ha_nemo_dsmipv6_t *dsmipv6;
#endif
Ipmip_buffer_t pdata;
ipmip_buffer_init(&pdata);
for (nemo = IPCOM_LIST_FIRST(&node->nemo_v6); nemo != IP_NULL; nemo = IPCOM_LIST_NEXT(&nemo->next))
{
Ipmip6_address_t address;
ipcom_memcpy(&address.prefix, &nemo->prefix, sizeof(address.prefix));
address.len = nemo->len;
ipmip_buffer_append(&pdata, &address, sizeof(address));
}
if (IPMIP_BUFFER_SIZE(&pdata))
{
ipmip_attr_put(&request->message, IPMIP6HA_CLI_ATTR_BC_X_PREFIX_V6,(Ip_u32)IPMIP_BUFFER_SIZE(&pdata),IPMIP_BUFFER_DATA(&pdata));
ipmip_buffer_shrink(&pdata, 0);
}
#ifdef IPMIP_USE_INET
for (dsmipv6 = IPCOM_LIST_FIRST(&node->nemo_prefix_v4); dsmipv6 != IP_NULL; dsmipv6 = IPCOM_LIST_NEXT(&dsmipv6->next))
{
Ipmip6_inet_t address;
address.prefix = dsmipv6->prefix;
address.len = (Ip_u8)dsmipv6->len;
ipmip_buffer_append(&pdata, &address, sizeof(address));
}
if (IPMIP_BUFFER_SIZE(&pdata))
{
ipmip_attr_put(&request->message, IPMIP6HA_CLI_ATTR_BC_X_PREFIX_V4,(Ip_u32)IPMIP_BUFFER_SIZE(&pdata),IPMIP_BUFFER_DATA(&pdata));
ipmip_buffer_shrink(&pdata, 0);
}
for (dsmipv6 = IPCOM_LIST_FIRST(&node->nemo_hoa_v4); dsmipv6 != IP_NULL; dsmipv6 = IPCOM_LIST_NEXT(&dsmipv6->next))
ipmip_buffer_append(&pdata, &dsmipv6->prefix, sizeof(dsmipv6->prefix));
if (IPMIP_BUFFER_SIZE(&pdata))
{
ipmip_attr_put(&request->message, IPMIP6HA_CLI_ATTR_BC_X_HOA_V4,(Ip_u32)IPMIP_BUFFER_SIZE(&pdata),IPMIP_BUFFER_DATA(&pdata));
ipmip_buffer_shrink(&pdata, 0);
}
#endif
/* Free memory */
ipmip_buffer_release(&pdata);
}
/* Add the MO for MN NAI */
if (node->nai_mn != IP_NULL)
ipmip_attr_put_strn(&request->message, IPMIP6HA_CLI_ATTR_BC_X_MOBILE_NAI,(char *)&((Ipmip6_mh_mo_nai_t *)node->nai_mn)->nai[0], (Ip_size_t)(node->nai_mn->len - 1));
/**/
ipmip_attr_put(&request->message, IPMIP6HA_CLI_ATTR_BC_X_MIB_mip6BindingCacheEntry, sizeof(node->mip6BindingCacheEntry), &node->mip6BindingCacheEntry);
ipmip_attr_put(&request->message, IPMIP6HA_CLI_ATTR_BC_X_MIB_mip6NodeTrafficEntry, sizeof(node->mip6NodeTrafficEntry), &node->mip6NodeTrafficEntry);
ipmip_attr_end(&request->message, rta);
}
/* If we have a reply header; terminate it */
ipmip_attr_hdr_finalize(&request->message, rhdr);
/* Commit the reply */
ipmip_cli_message_commit(&ctx->ipmip6.ipmip, proc, request);
return IPMIP_TIMER_RET_DONE;
}
/*
*===========================================================================
* ipmip6ha_attr_node_delete
*===========================================================================
* 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
ipmip6ha_attr_node_delete(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip_cli_message_t *request,
Ipmip6ha_node_t *node)
{
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
/**/
ipmip_attr_hdr_finalize(&request->message, ipmip_attr_hdr_ack(&request->message, hdr));
/* Commit the reply */
ipmip_cli_message_commit(&ctx->ipmip6.ipmip, proc, request);
/* Terminate the node(s) */
ipmip6ha_node_delete(ctx, proc, node, "administrative termination");
return IPMIP_TIMER_RET_DONE;
}
/*
*===========================================================================
* ipmip6ha_attr_node_delete
*===========================================================================
* 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
ipmip6ha_attr_node_revoke(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip_cli_message_t *request,
Ipmip6ha_node_t *node,
Ip_bool inet)
{
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
Ip_size_t rhdr = 0;
int ret = IPMIP_TIMER_RET_DONE;
if (node == IP_NULL)
rhdr = ipmip_attr_hdr_err(&request->message, hdr, IP_ERRNO_ENOENT, IP_NULL);
else
{
struct Ipmip_attr *rta_reason = ipmip_attr_hdr_find(hdr, IPMIP6HA_CLI_ATTR_BC_X_REVOKE_REASON);
Ip_u8 reason = IPMIP6_MH_BRI_TRIGGER_ADMINISTRATIVE_REASON;
/**/
if (rta_reason != IP_NULL)
reason = (Ip_u8)ipmip_attr_get_u32(rta_reason);
/**/
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
/* Terminate the node(s) */
ret = ipmip6ha_node_revoke(ctx, proc, node, inet, reason, IP_NULL);
}
/* If we have a reply header; terminate it */
ipmip_attr_hdr_finalize(&request->message, rhdr);
/* Commit the reply */
ipmip_cli_message_commit(&ctx->ipmip6.ipmip, proc, request);
return ret;
}
/*
*===========================================================================
* ipmip6mn_attr_network_dump
*===========================================================================
* 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
ipmip6ha_attr_node_do(int event,
Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip_cli_message_t *request,
Ipmip6ha_node_t *node)
{
if (event == IPMIP_TIMER_EVENT_RUN)
{
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
switch (IPMIP_ATTR_HDR_TYPE(hdr))
{
case IPMIP6HA_CLI_BC_X_GET:
return ipmip6ha_attr_node_dump(ctx, proc, request, node);
case IPMIP6HA_CLI_BC_X_DELETE:
return ipmip6ha_attr_node_delete(ctx, proc, request, node);
case IPMIP6HA_CLI_BC_X_REVOKE_NODE:
return ipmip6ha_attr_node_revoke(ctx, proc, request, node, IP_FALSE);
case IPMIP6HA_CLI_BC_X_REVOKE_NODE_INET:
return ipmip6ha_attr_node_revoke(ctx, proc, request, node, IP_TRUE);
}
}
else
{
/* Free the request */
ipmip_cli_message_free(&ctx->ipmip6.ipmip, proc, request);
}
/**/
return IPMIP_TIMER_RET_DONE;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
IP_GLOBAL int
ipmip6ha_attr_command(struct Ipmip6ha_context *ctx,
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;
struct Ipmip_attr *idattr[IPMIP6HA_CLI_ATTR_BC_X_MAX + 1];
switch (IPMIP_ATTR_HDR_TYPE(hdr))
{
case IPMIP6HA_CLI_BC_X_LIST:
{
struct Ipmip6ha_attr_op aop;
Ip_bool do_nai;
ipcom_memset(&aop, 0, sizeof(aop));
aop.request = request;
ipmip_attr_hdr_parse(IPMIP6HA_CLI_ATTR_BC_X_MAX, hdr, idattr);
aop.hoa = ipmip_attr_get_inet6(idattr[IPMIP6HA_CLI_ATTR_BC_X_HOA_V6]);
if (idattr[IPMIP6HA_CLI_ATTR_BC_X_IFNAME])
aop.ifindex = ipcom_if_nametoindex(ipmip_attr_get_str(idattr[IPMIP6HA_CLI_ATTR_BC_X_IFNAME]));
/* NAI */
if (idattr[IPMIP6HA_CLI_ATTR_BC_X_MOBILE_NAI] != IP_NULL)
{
aop.nai_mn = IPMIP_ATTR_DATA(idattr[IPMIP6HA_CLI_ATTR_BC_X_MOBILE_NAI]);
aop.nai_mn_len = IPMIP_ATTR_PAYLOAD(idattr[IPMIP6HA_CLI_ATTR_BC_X_MOBILE_NAI]);
}
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
ipmip_context_id_lock(ctx->idents);
ipmip_context_id_foreach(&ctx->ipmip6.ipmip,
proc,
ctx->idents,
(Ipmip_util_hash_foreach_t)ipmip6ha_attr_list_nodes,
&aop,
&do_nai);
ipmip_context_id_unlock(ctx->idents);
}
break;
case IPMIP6HA_CLI_BC_X_GET:
case IPMIP6HA_CLI_BC_X_DELETE:
case IPMIP6HA_CLI_BC_X_REVOKE_NODE:
case IPMIP6HA_CLI_BC_X_REVOKE_NODE_INET:
{
struct Ipmip_attr *rta_handle = ipmip_attr_hdr_find(hdr, IPMIP6HA_CLI_ATTR_BC_X_HANDLE);
/**/
if (rta_handle == IP_NULL)
return -IP_ERRNO_EINVAL;
/* Get by identity */
ipmip6ha_node_lookup_handle(ctx,
proc,
ipmip_attr_get_u32(rta_handle),
&request->timer,
(Ipmip_timer_func_t)ipmip6ha_attr_node_do,
request);
return 0;
}
case IPMIP_CLI_NAME_LIST:
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
{
/* Dump each configuration item we've currently got in human readable form */
Ipmip6ha_if_notify_t *notify;
ipmip_attr_put_str(&request->message, IPMIP_CLI_ITEM_NAME, "global");
/* Clear any old interfaces */
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
ipmip_attr_put_str(&request->message, IPMIP_CLI_ITEM_NAME, notify->ipmip6.ifp->iff.ifname);
}
break;
case IPMIP_CLI_CONFIG_GET:
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
{
/* Dump each configuration item we've currently got in human readable form */
Ipmip6ha_if_notify_t *notify;
unsigned int si;
struct Ipmip_attr *rta_name = ipmip_attr_hdr_find(hdr, IPMIP_CLI_ITEM_NAME);
if (rta_name == IP_NULL || ipcom_strcasecmp("global", ipmip_attr_get_str(rta_name)) == 0)
{
for (si = 0; si < ctx->extensions_num; si++)
{
if (ctx->extensions[si]->config_global != IP_NULL && ctx->extdata[si] != IP_NULL)
(*ctx->extensions[si]->config_global) (ctx, proc, IPMIP_CALLBACK_CONFIG_DUMP, ctx->extdata[si], request);
}
/* Dump the relay map */
ipmip6ha_dump_relay_map(ctx, proc, &request->message);
}
/* Clear any old interfaces */
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6ha_if_t *ife = (Ipmip6ha_if_t *)notify->ipmip6.ifp;
if (rta_name != IP_NULL && ipcom_strcasecmp(ife->ipmip6.iff.ifname, ipmip_attr_get_str(rta_name)) != 0)
continue;
/**/
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.lifetime=%d",
ife->ipmip6.iff.ifname, ife->lifetime);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.refresh=%d",
ife->ipmip6.iff.ifname, ife->refresh);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.homeagent=%s",
ife->ipmip6.iff.ifname, ipmip_ntop_inet6(proc, &ife->ifaddr.prefix, IP_NULL));
#ifdef IPMIP_USE_INET
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.inet.homeagent=%s",
ife->ipmip6.iff.ifname, ipmip_ntop_inet(proc, ife->ifaddr_v4));
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.tunnel.inet.ipip=%s",
ife->ipmip6.iff.ifname, ife->ifenabled_H[IPMIP_TUNNELTYPE_IPIP]? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.inet.tunnel.ipip=%s",
ife->ipmip6.iff.ifname, ife->ifenabled_P[IPMIP_TUNNELTYPE_IPIP]? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.inet.tunnel.gre=%s",
ife->ipmip6.iff.ifname, ife->ifenabled_P[IPMIP_TUNNELTYPE_GRE]? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.inet.AcceptForcedIPv4UDPEncapsulationRequest=%s",
ife->ipmip6.iff.ifname, ife->AcceptForcedIPv4UDPEncapsulationRequest? "true" : "false");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.inet.ForceIPv4UDPEncapsulation=%s",
ife->ipmip6.iff.ifname, ife->ForceIPv4UDPEncapsulation? "true" : "false");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.inet.IPv4UDPEncapsulationNATTimeout=%u",
ife->ipmip6.iff.ifname, ife->IPv4UDPEncapsulationNATTimeout);
#endif
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.AcceptUDPTLVEncapsulation=%s",
ife->ipmip6.iff.ifname, ife->AcceptUDPTLVEncapsulation? "true" : "false");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.tunnel.ip6ip6=%s",
ife->ipmip6.iff.ifname, ife->ifenabled_H[IPMIP_TUNNELTYPE_IP6IP6]? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.BRIMaxRetriesNumber=%d",
ife->ipmip6.iff.ifname, ife->BRIMaxRetriesNumber);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.BindingRevocation=%s",
ife->ipmip6.iff.ifname, ife->BindingRevocationEnabled? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.MINDelayBRIs=%d",
ife->ipmip6.iff.ifname, ife->MINDelayBRIs);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.tunnel.ip6ip6=%s",
ife->ipmip6.iff.ifname, ife->ifenabled_P[IPMIP_TUNNELTYPE_IP6IP6]? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.tunnel.gre=%s",
ife->ipmip6.iff.ifname, ife->ifenabled_P[IPMIP_TUNNELTYPE_GRE6]? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.MinDelayBeforeBCEDelete=%d",
ife->ipmip6.iff.ifname, ife->MinDelayBeforeBCEDelete);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.MaxDelayBeforeNewBCEAssign=%d",
ife->ipmip6.iff.ifname, ife->MaxDelayBeforeNewBCEAssign);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.TimestampValidityWindow=%d",
ife->ipmip6.iff.ifname, ife->TimestampValidityWindow);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.TimestampBasedApproachInUse=%d",
ife->ipmip6.iff.ifname, ife->TimestampBasedApproachInUse? 1 : 0);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.LMA.MobileNodeGeneratedTimestampInUse=%d",
ife->ipmip6.iff.ifname, ife->MobileNodeGeneratedTimestampInUse? 1 : 0);
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.AlwaysVerifyTunnelSrc=%s",
ife->ipmip6.iff.ifname, ife->AlwaysVerifyTunnelSrc? "enabled" : "disabled");
ipmip_cli_config_printf(&request->message,
"ipmip6ha.interface.%s.RelayBindings=%s",
ife->ipmip6.iff.ifname, ife->RelayBindings? "enabled" : "disabled");
ipmip6ha_mag_configure_dump(ctx, proc, ife, &request->message);
ipmip6ha_nemo_dump_config(ctx, proc, ife->nemo, ife->ipmip6.iff.ifname, &request->message);
for (si = 0; si < ctx->extensions_num; si++)
{
if (ctx->extensions[si]->config_ifp != IP_NULL)
(*ctx->extensions[si]->config_ifp) (ctx, proc, IPMIP_CALLBACK_CONFIG_DUMP, ife, ctx->extdata[si], ife->extdata[si], request);
}
}
}
/* */
break;
case IPMIP6HA_CLI_PREFIX_GET:
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
{
Ipmip6ha_if_notify_t *notify;
/* Clear any old interfaces */
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6ha_if_t *ifp = (Ipmip6ha_if_t *)notify->ipmip6.ifp;
Ipmip6_if_prefix_t *prefix;
Ipmip6_if_router_t *router;
ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, ifp->ipmip6.iff_lock);
/* We have the address; do prefix matching */
for (router = IPCOM_LIST_FIRST(&ifp->ipmip6.routers); router != IP_NULL; router = IPCOM_LIST_NEXT(&router->next))
{
for (prefix = IPCOM_LIST_FIRST(&router->prefixes); prefix != IP_NULL; prefix = IPCOM_LIST_NEXT(&prefix->next))
{
if (IP_BIT_ISSET(prefix->flags, IPMIP6_ND_OPT_PI_FLAG_ONLINK))
{
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6HA_CLI_ATTR_PREFIX);
/* */
ipmip_attr_put(&request->message, IPMIP6HA_CLI_ATTR_PREFIX_PREFIX, sizeof(prefix->prefix), &prefix->prefix);
ipmip_attr_put_inet6(&request->message, IPMIP6HA_CLI_ATTR_PREFIX_ROUTER, &router->addr);
ipmip_attr_put_str(&request->message, IPMIP6HA_CLI_ATTR_PREFIX_IFNAME, ifp->ipmip6.iff.ifname);
ipmip_attr_put_time_t(&request->message, IPMIP6HA_CLI_ATTR_PREFIX_VALID, prefix->valid);
ipmip_attr_put_time_t(&request->message, IPMIP6HA_CLI_ATTR_PREFIX_TIMESTAMP, prefix->stamp);
ipmip_attr_end(&request->message, rta);
}
}
}
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, ifp->ipmip6.iff_lock);
}
}
break;
case IPMIP6HA_CLI_MAG_GET:
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
{
Ipmip6ha_if_notify_t *notify;
/* Clear any old interfaces */
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
ipmip6ha_mag_attr_get(ctx, proc, (Ipmip6ha_if_t *)notify->ipmip6.ifp, &request->message);
}
break;
case IPMIP6HA_CLI_MAG_REVOKE:
/* Must locate MAG and */
{
const char *m_ifname = ipmip_attr_hdr_find_str(hdr, IPMIP6HA_CLI_ATTR_MAG_IFNAME);
struct Ip_in6_addr *m_addr = ipmip_attr_hdr_find_inet6(hdr, IPMIP6HA_CLI_ATTR_MAG_ADDR_V6);
Ipmip6ha_if_notify_t *notify;
Ipmip6ha_if_t *ife;
Ipmip6ha_mag_t *mag;
/**/
if (m_ifname == IP_NULL || m_addr == IP_NULL)
return -IP_ERRNO_EINVAL;
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
ife = (Ipmip6ha_if_t *)notify->ipmip6.ifp;
if (ipcom_strcasecmp(ife->ipmip6.iff.ifname, m_ifname) == 0)
break;
}
if (notify == IP_NULL)
return -IP_ERRNO_ENXIO;
/* Time to find the MAG */
mag = ipmip6ha_mag_get(ctx, proc, ife, m_addr, 0);
if (mag == IP_NULL)
return -IP_ERRNO_ENOENT;
/* Time to revoke */
ipmip6ha_mag_revoke(ctx, proc, mag, (Ip_u8)ipmip_attr_hdr_find_u32(hdr, IPMIP6HA_CLI_ATTR_MAG_REASON), ipmip_attr_hdr_find_str(hdr, IPMIP6HA_CLI_ATTR_MAG_MATCH));
/* Must release */
ipmip6ha_mag_release(ctx, proc, mag);
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
}
break;
default:
/**/
return ipmip6_attr_command(&ctx->ipmip6, proc, request);
}
/* If we have a reply header; terminate it */
ipmip_attr_hdr_finalize(&request->message, rhdr);
/* Commit the reply */
ipmip_cli_message_commit(&ctx->ipmip6.ipmip, proc, request);
return 0;
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,108 @@
/* ipmipfa_attr_h.h - ipmipfa_attr_h.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_attr_h.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_attr_h.h,v $
* $Author: jhorteli $ $Date: 2008-12-01 16:18:39 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_ATTR_H_H
#define IPMIP6HA_ATTR_H_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipmip6ha_attr.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_context;
struct Ipmip6ha_node;
struct Ipmip_proc;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip6ha_attr_command - ipmip6ha_attr_command
*
* Process an attribute command
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i request
* Issued command.
* \ie
*
* RETURNS: IPCOM_SUCCESS when successful
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmip6ha_attr_command
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_cli_message *request
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,517 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_cli.c,v $ $Revision: 1.8 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_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 "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_err.h>
#include <ipcom_inet.h>
#include <ipcom_ipd.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock.h>
#include <ipcom_sock2.h>
#include <ipcom_sysctl.h>
#include <ipcom_syslog.h>
#include <ipcom_route.h>
#include <ipmip.h>
#include <private/ipmip_buffer.h>
#include <private/ipmip_util.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_util.h>
#include <private/ipmip6_address.h>
#include "ipmip6ha.h"
#include "ipmip6ha_attr.h"
#include "ipmip6ha_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
ipmip6ha_cli_connect(Ipmip_cli_daemon_t *daemon_info)
{
ipmip_cli_daemon_init(daemon_info, "ipmip6ha", IPCOM_IPD_ID_IPMIP6HA);
return ipmip_cli_daemon_connect(daemon_info);
}
IP_PUBLIC int
ipmip6ha_cli_node_list(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req,
const char *ifname,
const struct Ip_in6_addr *hoa,
const char *nai)
{
ipmip_cli_daemon_request_start(req, IPMIP6HA_CLI_BC_X_LIST);
ipmip6ha_cli_request_set_ifname(req, ifname);
ipmip6ha_cli_request_set_nai(req, nai);
ipmip6ha_cli_request_set_hoa(req, hoa);
return ipmip_cli_daemon_request(daemon, req);
}
IP_PUBLIC void
ipmip6ha_cli_request_set_nai(Ipmip_cli_daemon_req_t *req,
const char *nai)
{
if (nai)
ipmip_attr_put_str(&req->reqbuf, IPMIP6HA_CLI_ATTR_BC_X_MOBILE_NAI, nai);
}
IP_PUBLIC void
ipmip6ha_cli_request_set_ifname(Ipmip_cli_daemon_req_t *req,
const char *ifname)
{
if (ifname)
ipmip_attr_put_str(&req->reqbuf, IPMIP6HA_CLI_ATTR_BC_X_IFNAME, ifname);
}
IP_PUBLIC void
ipmip6ha_cli_request_set_hoa(Ipmip_cli_daemon_req_t *req,
const struct Ip_in6_addr *hoa)
{
if (hoa)
ipmip_attr_put_inet6(&req->reqbuf, IPMIP6HA_CLI_ATTR_BC_X_HOA_V6, hoa);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC void
ipmip6ha_cli_request_set_inet_hoa(Ipmip_cli_daemon_req_t *req,
Ip_u32 inet_hoa)
{
if (inet_hoa)
ipmip_attr_put_inet(&req->reqbuf, IPMIP6HA_CLI_ATTR_BC_X_HOA_V4, inet_hoa);
}
#endif
IP_PUBLIC void
ipmip6ha_cli_request_set_handle(Ipmip_cli_daemon_req_t *req,
Ip_u32 handle)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6HA_CLI_ATTR_BC_X_HANDLE, handle);
}
IP_PUBLIC void
ipmip6ha_cli_request_set_revoke_reason(Ipmip_cli_daemon_req_t *req,
Ip_u32 reason)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6HA_CLI_ATTR_BC_X_REVOKE_REASON, reason);
}
IP_PUBLIC Ip_u32
ipmip6ha_cli_handle_next(Ipmip_attr_iter_t *iter)
{
return ipmip_attr_get_u32(ipmip_attr_iter_next(iter, IPMIP6HA_CLI_ATTR_BC_X_HANDLE));
}
IP_PUBLIC const char *
ipmip6ha_cli_node_get_ifname(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_str(node, IPMIP6HA_CLI_ATTR_BC_X_IFNAME);
}
IP_PUBLIC const char *
ipmip6ha_cli_node_get_nai(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_str(node, IPMIP6HA_CLI_ATTR_BC_X_MOBILE_NAI);
}
IP_PUBLIC const struct Ip_in6_addr *
ipmip6ha_cli_node_get_hoa(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_inet6(node, IPMIP6HA_CLI_ATTR_BC_X_HOA_V6);
}
IP_PUBLIC struct Ipmip_attr *
ipmip6ha_cli_node_get(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req,
Ip_u32 handle)
{
ipmip_cli_daemon_request_start(req, IPMIP6HA_CLI_BC_X_GET);
ipmip6ha_cli_request_set_handle(req, handle);
if (ipmip_cli_daemon_request(daemon, req) == IPCOM_SUCCESS)
return ipmip_cli_daemon_find_request(req, IPMIP6HA_CLI_ATTR_BC_X);
return IP_NULL;
}
IP_PUBLIC void
ipmip6ha_cli_node_delete(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6HA_CLI_BC_X_DELETE);
ipmip6ha_cli_request_set_handle(&req, handle);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
IP_PUBLIC void
ipmip6ha_cli_node_revoke(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle,
Ip_u32 reason)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6HA_CLI_BC_X_REVOKE_NODE);
ipmip6ha_cli_request_set_handle(&req, handle);
ipmip6ha_cli_request_set_revoke_reason(&req, reason);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC void
ipmip6ha_cli_node_revoke_inet(Ipmip_cli_daemon_t *daemon,
Ip_u32 handle,
Ip_u32 reason)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6HA_CLI_BC_X_REVOKE_NODE_INET);
ipmip6ha_cli_request_set_handle(&req, handle);
ipmip6ha_cli_request_set_revoke_reason(&req, reason);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
#endif
IP_PUBLIC Ip_time_t
ipmip6ha_cli_node_get_updated(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_time_t(node, IPMIP6HA_CLI_ATTR_BC_X_UPDATED);
}
IP_PUBLIC Ip_u32
ipmip6ha_cli_node_get_handle(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_u32(node, IPMIP6HA_CLI_ATTR_BC_X_HANDLE);
}
IP_PUBLIC Ip_u32
ipmip6ha_cli_node_get_regflags(struct Ipmip_attr *node)
{
/**/
return ipmip_attr_payload_find_u32(node, IPMIP6HA_CLI_ATTR_BC_X_REGFLAGS);
}
IP_PUBLIC const struct Ipmip6_address *
ipmip6ha_cli_node_get_home_prefix_list(struct Ipmip_attr *node,
Ip_u32 *sz)
{
struct Ipmip_attr *rta = ipmip_attr_payload_find(node, IPMIP6HA_CLI_ATTR_BC_X_PREFIX_V6);
if (rta)
{
*sz = (Ip_u32)(IPMIP_ATTR_PAYLOAD(rta) / sizeof(Ipmip6_address_t));
return *sz? (Ipmip6_address_t *)IPMIP_ATTR_DATA(rta) : IP_NULL;
}
return IP_NULL;
}
#ifdef IPMIP_USE_INET
IP_PUBLIC const Ip_u32 *
ipmip6ha_cli_node_get_inet_home_address_list(struct Ipmip_attr *node,
Ip_u32 *sz)
{
struct Ipmip_attr *rta = ipmip_attr_payload_find(node, IPMIP6HA_CLI_ATTR_BC_X_HOA_V4);
if (rta)
{
*sz = (Ip_u32)(IPMIP_ATTR_PAYLOAD(rta) / sizeof(Ip_u32));
return *sz? (Ip_u32 *)IPMIP_ATTR_DATA(rta) : IP_NULL;
}
return IP_NULL;
}
IP_PUBLIC const struct Ipmip6_inet *
ipmip6ha_cli_node_get_inet_home_prefix_list(struct Ipmip_attr *node,
Ip_u32 *sz)
{
struct Ipmip_attr *rta = ipmip_attr_payload_find(node, IPMIP6HA_CLI_ATTR_BC_X_PREFIX_V4);
if (rta)
{
*sz = (Ip_u32)(IPMIP_ATTR_PAYLOAD(rta) / sizeof(Ipmip6_inet_t));
return *sz? (Ipmip6_inet_t *)IPMIP_ATTR_DATA(rta) : IP_NULL;
}
return IP_NULL;
}
#endif
IP_PUBLIC const struct Ipmip6_mib_mip6NodeTrafficEntry *
ipmip6ha_cli_node_get_mip6NodeTrafficEntry(struct Ipmip_attr *node)
{
/**/
return (const struct Ipmip6_mib_mip6NodeTrafficEntry *)ipmip_attr_payload_find_data(node, IPMIP6HA_CLI_ATTR_BC_X_MIB_mip6NodeTrafficEntry);
}
IP_PUBLIC const struct Ipmip6_mib_mip6BindingCacheEntry *
ipmip6ha_cli_node_get_mip6BindingCacheEntry(struct Ipmip_attr *node)
{
/**/
return (const struct Ipmip6_mib_mip6BindingCacheEntry *)ipmip_attr_payload_find_data(node, IPMIP6HA_CLI_ATTR_BC_X_MIB_mip6BindingCacheEntry);
}
IP_PUBLIC int
ipmip6ha_cli_prefix_list(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req)
{
ipmip_cli_daemon_request_start(req, IPMIP6HA_CLI_PREFIX_GET);
return ipmip_cli_daemon_request(daemon, req);
}
IP_PUBLIC struct Ipmip_attr*
ipmip6ha_cli_prefix_next(Ipmip_attr_iter_t *iter)
{
/**/
return ipmip_attr_iter_next(iter, IPMIP6HA_CLI_ATTR_PREFIX);
}
IP_PUBLIC const char *
ipmip6ha_cli_prefix_get_ifname(struct Ipmip_attr *prefix)
{
return ipmip_attr_payload_find_str(prefix, IPMIP6HA_CLI_ATTR_PREFIX_IFNAME);
}
IP_PUBLIC const struct Ip_in6_addr *
ipmip6ha_cli_prefix_get_router(struct Ipmip_attr *prefix)
{
return ipmip_attr_payload_find_inet6(prefix, IPMIP6HA_CLI_ATTR_PREFIX_ROUTER);
}
IP_PUBLIC const Ipmip6_address_t *
ipmip6ha_cli_prefix_get_prefix(struct Ipmip_attr *prefix)
{
return (const Ipmip6_address_t *)ipmip_attr_payload_find_data(prefix, IPMIP6HA_CLI_ATTR_PREFIX_PREFIX);
}
IP_PUBLIC Ip_time_t
ipmip6ha_cli_prefix_get_prefix_valid(struct Ipmip_attr *prefix)
{
return ipmip_attr_payload_find_time_t(prefix, IPMIP6HA_CLI_ATTR_PREFIX_VALID);
}
IP_PUBLIC Ip_time_t
ipmip6ha_cli_prefix_get_prefix_timestamp(struct Ipmip_attr *prefix)
{
return ipmip_attr_payload_find_time_t(prefix, IPMIP6HA_CLI_ATTR_PREFIX_TIMESTAMP);
}
IP_PUBLIC int
ipmip6ha_cli_mag_list(Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req)
{
ipmip_cli_daemon_request_start(req, IPMIP6HA_CLI_MAG_GET);
return ipmip_cli_daemon_request(daemon, req);
}
IP_PUBLIC struct Ipmip_attr*
ipmip6ha_cli_mag_next(Ipmip_attr_iter_t *iter)
{
/**/
return ipmip_attr_iter_next(iter, IPMIP6HA_CLI_ATTR_MAG);
}
IP_PUBLIC const char *
ipmip6ha_cli_mag_get_ifname(struct Ipmip_attr *mag)
{
return ipmip_attr_payload_find_str(mag, IPMIP6HA_CLI_ATTR_MAG_IFNAME);
}
IP_PUBLIC const struct Ip_in6_addr *
ipmip6ha_cli_mag_get_addr_v6(struct Ipmip_attr *mag)
{
return ipmip_attr_payload_find_inet6(mag, IPMIP6HA_CLI_ATTR_MAG_ADDR_V6);
}
#ifdef IPMIP_USE_INET
IP_PUBLIC Ip_u32
ipmip6ha_cli_mag_get_addr_v4(struct Ipmip_attr *mag)
{
return ipmip_attr_payload_find_inet(mag, IPMIP6HA_CLI_ATTR_MAG_ADDR_V4);
}
#endif
IP_PUBLIC Ip_u32
ipmip6ha_cli_mag_get_references(struct Ipmip_attr *mag)
{
return ipmip_attr_payload_find_u32(mag, IPMIP6HA_CLI_ATTR_MAG_REFERENCES);
}
IP_PUBLIC Ip_u32
ipmip6ha_cli_mag_get_heartbeat(struct Ipmip_attr *mag)
{
return ipmip_attr_payload_find_u32(mag, IPMIP6HA_CLI_ATTR_MAG_HEARTBEAT);
}
IP_PUBLIC void
ipmip6ha_cli_mag_request_set_mag(Ipmip_cli_daemon_req_t *req,
const struct Ip_in6_addr *mag)
{
if (mag)
ipmip_attr_put_inet6(&req->reqbuf, IPMIP6HA_CLI_ATTR_MAG_ADDR_V6, mag);
}
IP_PUBLIC void
ipmip6ha_cli_mag_request_set_revoke_reason(Ipmip_cli_daemon_req_t *req,
Ip_u32 reason)
{
ipmip_attr_put_u32(&req->reqbuf, IPMIP6HA_CLI_ATTR_MAG_REASON, reason);
}
IP_PUBLIC void
ipmip6ha_cli_mag_request_set_ifname(Ipmip_cli_daemon_req_t *req,
const char *ifname)
{
if (ifname)
ipmip_attr_put_str(&req->reqbuf, IPMIP6HA_CLI_ATTR_MAG_IFNAME, ifname);
}
IP_PUBLIC void
ipmip6ha_cli_mag_request_set_match(Ipmip_cli_daemon_req_t *req,
const char *match)
{
if (match)
ipmip_attr_put_str(&req->reqbuf, IPMIP6HA_CLI_ATTR_MAG_MATCH, match);
}
IP_PUBLIC void
ipmip6ha_cli_mag_revoke(Ipmip_cli_daemon_t *daemon,
const char *ifname,
const struct Ip_in6_addr *mag,
Ip_u8 reason,
const char *nai_match)
{
Ipmip_cli_daemon_req_t req;
ipmip_cli_daemon_request_init(&req);
ipmip_cli_daemon_request_start(&req, IPMIP6HA_CLI_MAG_REVOKE);
ipmip6ha_cli_mag_request_set_mag(&req, mag);
ipmip6ha_cli_mag_request_set_revoke_reason(&req, reason);
ipmip6ha_cli_mag_request_set_match(&req, nai_match);
ipmip6ha_cli_mag_request_set_ifname(&req, ifname);
ipmip_cli_daemon_request(daemon, &req);
ipmip_cli_daemon_request_release(&req);
}
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,844 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_cmd_ha6.c,v $ $Revision: 1.21 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_cmd_ha6.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_list.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_err.h>
#include <ipcom_ipd.h>
#include <ipcom_syslog.h>
#include <ipcom_cmd.h>
#include <ipcom_getopt.h>
#include <ipmip.h>
#include <private/ipmip_context.h>
#include <private/ipmip_cli.h>
#include <private/ipmip_util.h>
#include <ipmip6.h>
#include <private/ipmip6_address.h>
#include <private/ipmip6_ntop.h>
#include <private/ipmip6_mh_pkt.h>
#include "ipmip6ha_attr.h"
#include "ipmip6ha_cli.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
IPMIP6HA_CMD_HA6_OP_LIST = 1,
IPMIP6HA_CMD_HA6_OP_SHOW,
IPMIP6HA_CMD_HA6_OP_DELETE,
IPMIP6HA_CMD_HA6_OP_REVOKE,
IPMIP6HA_CMD_HA6_OP_PREFIX,
IPMIP6HA_CMD_HA6_OP_REVOKE_NODE,
IPMIP6HA_CMD_HA6_OP_REVOKE_NODE_INET,
IPMIP6HA_CMD_HA6_OP_REVOKE_MAG,
IPMIP6HA_CMD_HA6_OP_MAG
};
#define IPMIP6HA_CMD_HDRSIZE 30
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_cmd_op_val
{
int cmd;
Ip_bool verbose;
Ip_u8 reason;
};
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
IP_STATIC Ipcom_cmd_int_str_map ipmip6ha_cmd_ha6_ops[] =
{
{ IPMIP6HA_CMD_HA6_OP_SHOW, "status" },
{ IPMIP6HA_CMD_HA6_OP_SHOW, "show" },
{ IPMIP6HA_CMD_HA6_OP_LIST, "list" },
{ IPMIP6HA_CMD_HA6_OP_DELETE, "delete" },
{ IPMIP6HA_CMD_HA6_OP_REVOKE, "revoke" },
{ IPMIP6HA_CMD_HA6_OP_PREFIX, "prefix" },
{ IPMIP6HA_CMD_HA6_OP_MAG, "mag" },
{ 0, 0 }
};
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6ha_cmd_ha6_print_usage
*===========================================================================
* Description: Prints the usage for the command.
* Parameters:
* Returns:
*
*/
IP_STATIC void
ipmip6ha_cmd_ha6_print_usage(Ipmip_proc_t *proc)
{
ipmip_util_identprintf(proc, 0, "NAME"IP_LF);
ipmip_util_identprintf(proc, 1, "ha6 - Displays Home Agent IPv6 bindings, statistics and status" IP_LF);
ipmip_util_identprintf(proc, 0, "SYNOPSIS"IP_LF);
ipmip_util_identprintf(proc, 1, "ha6 <command> [arguments]"IP_LF);
ipmip_util_identprintf(proc, 0, "DESCRIPTION"IP_LF);
ipmip_util_identprintf(proc, 1,
"The ha6 command is used to display current Home Agent MIPv6"IP_LF
"bindings, statistics and status"IP_LF);
ipmip_util_identprintf(proc, 0, "COMMANDS"IP_LF);
ipmip_util_cmdprintf(proc, 1, "list", "List all home agent bindings");
ipmip_util_cmdprintf(proc, 1, "mag", "List all MAGs currently seen by the LMA");
ipmip_util_cmdprintf(proc, 1, "prefix", "List all Prefixes currently seen by the Home Agent");
ipmip_util_cmdprintf(proc, 1, "show [-va] [hoa|nai]", "Display information for specified binding");
ipmip_util_identprintf(proc, 2, "-v Verbose information"IP_LF);
ipmip_util_identprintf(proc, 2, "-a All bindings"IP_LF);
ipmip_util_cmdprintf(proc, 1, "delete [-a] [hoa|nai]", "Delete specified binding");
ipmip_util_identprintf(proc, 2, "-v Verbose information"IP_LF);
ipmip_util_identprintf(proc, 2, "-a All bindings"IP_LF);
ipmip_util_cmdprintf(proc, 1, "revoke node [-a4] [hoa] [nai]", "Revoke the specified binding(s)");
ipmip_util_identprintf(proc, 2, "-a All bindings"IP_LF);
ipmip_util_identprintf(proc, 2, "-4 Only revoke INET bindings"IP_LF);
ipmip_util_identprintf(proc, 2, "[nai] NAI of the binding to revoke"IP_LF);
ipmip_util_identprintf(proc, 2, "[hoa] Home Address of the binding to revoke"IP_LF);
ipmip_util_cmdprintf(proc, 1, "revoke mag [-i <interface>] [-m <MAG Address>] [-r <reason>] [-n <NAI match>]", "Revoke all bindings attached to a MAG");
ipmip_util_identprintf(proc, 2, "-i <interface> Specify the interface to be globally revoked"IP_LF);
ipmip_util_identprintf(proc, 2, "-m <MAG address> Specify the exact MAG to revoke"IP_LF);
ipmip_util_identprintf(proc, 2, "-r <number> Specify the binding revocation reason. Will be per-peer policy if not specified"IP_LF);
ipmip_util_identprintf(proc, 2, "-n <NAI match> Specify a domain NAI match string such as *@domain.com that should be revoked"IP_LF);
ipmip6_cli_shell_usage(proc);
}
typedef void (*Ipmip6ha_cmd_foreach_func_t) (Ipmip_proc_t *proc,
Ipmip_cli_daemon_t *daemon,
Ip_u32 num,
Ip_u32 handle,
void *opaque);
IP_STATIC void
ipmip6ha_cmd_foreach_binding(Ipmip_proc_t *proc,
Ipmip_cli_daemon_t *daemon,
Ipmip_cli_daemon_req_t *req,
Ipmip6ha_cmd_foreach_func_t func,
void *opaque)
{
Ip_u32 num = 0;
Ipmip_attr_iter_t riter;
Ip_u32 handle;
/**/
ipmip_cli_daemon_iter_request_init(req, &riter);
while ((handle = ipmip6ha_cli_handle_next(&riter)) != 0)
(*func) (proc, daemon, num++, handle, opaque);
}
/*
*===========================================================================
* ipmipha_cmd_binding_flags
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC char *
ipmip6ha_cmd_binding_flags(char *buffer,
struct Ipmip_attr *node)
{
Ip_u32 flags = ipmip6ha_cli_node_get_regflags(node);
int p = 0;
if (IP_BIT_ISSET(flags, IPMIP6_MH_BU_P))
buffer[p++] = 'P';
if (IP_BIT_ISSET(flags, IPMIP6_MH_BU_R))
buffer[p++] = 'R';
if (IP_BIT_ISSET(flags, IPMIP6_MH_BU_H))
buffer[p++] = 'H';
buffer[p++] = '\0';
return buffer;
}
/*
*===========================================================================
* ipmipha_cmd_print_binding_fmt
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC void
ipmip6ha_cmd_print_binding_fmt(const char *hoa,
const char *coa,
const char *ifname,
const char *lifetime,
const char *flags)
{
/* */
ipcom_printf("%-20s %-20s %-16s %-15s %s"IP_LF,
hoa, coa, ifname, lifetime, flags);
}
/*
*===========================================================================
* ipmipha_cmd_print_binding
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC void
ipmip6ha_cmd_print_binding(Ipmip_proc_t *proc,
Ipmip_cli_daemon_t *daemon,
Ip_u32 num,
struct Ipmip_attr *node,
struct Ipmip6ha_cmd_op_val *ops)
{
char flags[16];
const struct Ipmip6_mib_mip6BindingCacheEntry *entry = ipmip6ha_cli_node_get_mip6BindingCacheEntry(node);
const char *name;
IPMIP_UNUSED_PARAMETER(ops);
IPMIP_UNUSED_PARAMETER(daemon);
IPMIP_UNUSED_PARAMETER(num);
ipcom_snprintf(proc->ntop.ntop_lla, sizeof(proc->ntop.ntop_lla),
"%d/%d",
IP_GET_32ON8(&entry->mip6BindingTimeRemaining),
IP_GET_32ON8(&entry->mip6BindingTimeGranted));
if ((name = ipmip6ha_cli_node_get_nai(node)) == IP_NULL)
{
const struct Ip_in6_addr *hoa;
if ((hoa = ipmip6ha_cli_node_get_hoa(node)) != IP_NULL)
name = ipmip_ntop_inet6(proc, hoa, IP_NULL);
}
if (name != IP_NULL)
{
ipmip6ha_cmd_print_binding_fmt(name,
ipmip6_ntop_InetAddress(proc, entry->mip6BindingCOAType, &entry->mip6BindingCOA),
ipmip6ha_cli_node_get_ifname(node),
proc->ntop.ntop_lla,
ipmip6ha_cmd_binding_flags(flags, node));
}
}
IP_STATIC void
ipmip6ha_cmd_delete_binding(Ipmip_proc_t *proc,
Ipmip_cli_daemon_t *daemon,
Ip_u32 num,
struct Ipmip_attr *node,
struct Ipmip6ha_cmd_op_val *ops)
{
IPMIP_UNUSED_PARAMETER(ops);
IPMIP_UNUSED_PARAMETER(num);
IPMIP_UNUSED_PARAMETER(proc);
ipmip6ha_cli_node_delete(daemon, ipmip6ha_cli_node_get_handle(node));
}
IP_STATIC void
ipmip6ha_cmd_revoke_node_binding(Ipmip_proc_t *proc,
Ipmip_cli_daemon_t *daemon,
Ip_u32 num,
struct Ipmip_attr *node,
struct Ipmip6ha_cmd_op_val *ops)
{
IPMIP_UNUSED_PARAMETER(ops);
IPMIP_UNUSED_PARAMETER(num);
IPMIP_UNUSED_PARAMETER(proc);
#ifdef IPMIP_USE_INET
if (ops->cmd == IPMIP6HA_CMD_HA6_OP_REVOKE_NODE_INET)
ipmip6ha_cli_node_revoke_inet(daemon, ipmip6ha_cli_node_get_handle(node), IPMIP6_MH_BRI_TRIGGER_ADMINISTRATIVE_REASON);
else
#endif
ipmip6ha_cli_node_revoke(daemon, ipmip6ha_cli_node_get_handle(node), IPMIP6_MH_BRI_TRIGGER_ADMINISTRATIVE_REASON);
}
/*
*===========================================================================
* ipmipha_cmd_show_binding
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC void
ipmip6ha_cmd_show_binding(Ipmip_proc_t *proc,
Ipmip_cli_daemon_t *daemon,
Ip_u32 num,
struct Ipmip_attr *node,
struct Ipmip6ha_cmd_op_val *ops)
{
const struct Ip_in6_addr *addr;
const char *nai;
const Ipmip6_address_t *prefix;
Ip_u32 sz;
Ip_u32 i;
#ifdef IPMIP_USE_INET
const Ip_u32 *inet_hoa;
const Ipmip6_inet_t *inet_prefix;
#endif
char flags[16];
const struct Ipmip6_mib_mip6NodeTrafficEntry *mip6NodeTrafficEntry = ipmip6ha_cli_node_get_mip6NodeTrafficEntry(node);
const struct Ipmip6_mib_mip6BindingCacheEntry *mip6BindingCacheEntry = ipmip6ha_cli_node_get_mip6BindingCacheEntry(node);
IPMIP_UNUSED_PARAMETER(daemon);
IPMIP_UNUSED_PARAMETER(ops);
IPMIP_UNUSED_PARAMETER(num);
/**/
ipmip_util_hdrprintf(proc, 0, "BCE", IPMIP6HA_CMD_HDRSIZE, IP_LF);
if ((addr = ipmip6ha_cli_node_get_hoa(node)) != IP_NULL)
ipmip_util_hdrprintf(proc, 1, "HoA", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, ipmip_ntop_inet6(proc, addr, IP_NULL));
if ((nai = ipmip6ha_cli_node_get_nai(node)) != IP_NULL)
ipmip_util_hdrprintf(proc, 1, "Mobile NAI", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, nai);
ipmip_util_hdrprintf(proc, 1, "CoA", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, ipmip6_ntop_InetAddress(proc, IP_GET_32ON8(&mip6BindingCacheEntry->mip6BindingCOAType), &mip6BindingCacheEntry->mip6BindingCOA));
ipmip_util_hdrprintf(proc, 1, "Creation", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, ipmip_ntop_tm(proc, ipmip_util_safe_time_t(&mip6BindingCacheEntry->mip6BindingTimeRegistered)));
ipmip_util_hdrprintf(proc, 1, "Last updated", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, ipmip_ntop_tm(proc, ipmip6ha_cli_node_get_updated(node)));
ipmip_util_hdrprintf(proc, 1, "Interface", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, ipmip6ha_cli_node_get_ifname(node));
ipmip_util_hdrprintf(proc, 1, "Lifetime requested", IPMIP6HA_CMD_HDRSIZE, "%u"IP_LF, IP_GET_32ON8(&mip6BindingCacheEntry->mip6BindingTimeGranted));
ipmip_util_hdrprintf(proc, 1, "Lifetime remaining", IPMIP6HA_CMD_HDRSIZE, "%u"IP_LF, IP_GET_32ON8(&mip6BindingCacheEntry->mip6BindingTimeRemaining));
ipmip_util_hdrprintf(proc, 1, "Registration Flags", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, ipmip6ha_cmd_binding_flags(flags, node));
if ((prefix = ipmip6ha_cli_node_get_home_prefix_list(node, &sz)) != IP_NULL)
{
for (i = 0; i < sz; i++)
ipmip_util_hdrprintf(proc, 1, "Allocated Prefix", IPMIP6HA_CMD_HDRSIZE, "%s/%d"IP_LF, ipmip_ntop_inet6(proc, &prefix[i].prefix, IP_NULL), prefix[i].len);
}
#ifdef IPMIP_USE_INET
/* */
if ((inet_hoa = ipmip6ha_cli_node_get_inet_home_address_list(node, &sz)) != 0)
{
for (i = 0; i < sz; i++)
ipmip_util_hdrprintf(proc, 1, "DSMIPv6 HoA", IPMIP6HA_CMD_HDRSIZE, "%s"IP_LF, ipmip_ntop_inet(proc, IP_GET_32ON8(&inet_hoa[i])));
}
if ((inet_prefix = ipmip6ha_cli_node_get_inet_home_prefix_list(node, &sz)) != IP_NULL)
{
for (i = 0; i < sz; i++)
ipmip_util_hdrprintf(proc, 1, "DSMIPv6 Prefix", IPMIP6HA_CMD_HDRSIZE, "%s/%d"IP_LF, ipmip_ntop_inet(proc, IP_GET_32ON8(&inet_prefix[i].prefix)), inet_prefix[i].len);
}
#endif
/**/
ipmip_util_hdrprintf(proc, 1, "Sent Bytes", IPMIP6HA_CMD_HDRSIZE, "%lld"IP_LF, ipmip_util_safe_u64(&mip6NodeTrafficEntry->mip6HCNodeOutOctets));
ipmip_util_hdrprintf(proc, 1, "Sent Packets", IPMIP6HA_CMD_HDRSIZE, "%lld"IP_LF, ipmip_util_safe_u64(&mip6NodeTrafficEntry->mip6HCNodeOutPkts));
ipmip_util_hdrprintf(proc, 1, "Receive Bytes", IPMIP6HA_CMD_HDRSIZE, "%lld"IP_LF, ipmip_util_safe_u64(&mip6NodeTrafficEntry->mip6HCNodeInOctets));
ipmip_util_hdrprintf(proc, 1, "Receive Packets", IPMIP6HA_CMD_HDRSIZE, "%lld"IP_LF, ipmip_util_safe_u64(&mip6NodeTrafficEntry->mip6HCNodeInPkts));
}
/*
*===========================================================================
* ipmipha_cmd_show_binding
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC void
ipmip6ha_cmd_do_binding(Ipmip_proc_t *proc,
Ipmip_cli_daemon_t *daemon,
Ip_u32 num,
Ip_u32 handle,
void *opaque)
{
struct Ipmip6ha_cmd_op_val *ops = opaque;
struct Ipmip_attr *node;
Ipmip_cli_daemon_req_t breq;
ipmip_cli_daemon_request_init(&breq);
if ((node = ipmip6ha_cli_node_get(daemon, &breq, handle)) != IP_NULL)
{
switch (ops->cmd)
{
case IPMIP6HA_CMD_HA6_OP_LIST:
ipmip6ha_cmd_print_binding(proc, daemon, num, node, ops);
break;
case IPMIP6HA_CMD_HA6_OP_SHOW:
/* OK; Got the node; print it */
ipmip6ha_cmd_show_binding(proc, daemon, num, node, ops);
break;
case IPMIP6HA_CMD_HA6_OP_DELETE:
/* OK; Got the node; print it */
ipmip6ha_cmd_delete_binding(proc, daemon, num, node, ops);
break;
case IPMIP6HA_CMD_HA6_OP_REVOKE_NODE_INET:
case IPMIP6HA_CMD_HA6_OP_REVOKE_NODE:
/* OK; Got the node; print it */
ipmip6ha_cmd_revoke_node_binding(proc, daemon, num, node, ops);
break;
}
}
/**/
ipmip_cli_daemon_request_release(&breq);
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipnet_cmd_mn6
*===========================================================================
* Description: Print status and statistics for networks
* Parameters: network - Network if one is specified, IP_NULL otherwise.
* Returns:
*
*/
IP_GLOBAL int ipmip6ha_cmd_ha6(int argc, char **argv);
IP_GLOBAL int
ipmip6ha_cmd_ha6(int argc, char **argv)
{
char *op;
int op_val;
int ret = -1;
Ipmip_proc_t *proc = IP_NULL;
Ipcom_getopt opt;
int i;
Ipmip_cli_daemon_t daemon;
Ipmip_cli_daemon_req_t req;
/**/
daemon.fd = IP_INVALID_SOCKET;
ipmip_cli_daemon_request_init(&req);
proc = ipmip_proc_alloc();
if (proc == IP_NULL)
{
ipcom_printf("ha6: failed to create process context"IP_LF);
return -1;
}
/* Get a connection to the home agent. */
for (i = 0; i < 10; i++)
{
if (ipmip6ha_cli_connect(&daemon))
break;
ipcom_sleep(1);
}
if (daemon.fd == IP_INVALID_SOCKET)
{
ipcom_printf("ha6: failed to connect to mobile node"IP_LF);
ipmip_proc_destroy(proc);
return -1;
}
if (argc < 2)
{
ipmip6ha_cmd_ha6_print_usage(proc);
goto exit_out;
}
op = argv[1];
op_val = ipcom_cmd_str_to_key(ipmip6ha_cmd_ha6_ops, op);
if (op_val == -1)
{
if (ipmip6_cli_shell_cmd(argc, argv, proc, &daemon) == -1)
ipcom_printf("'%s' is an invalid operation"IP_LF, op);
goto exit_out;
}
ipcom_getopt_clear_r(&opt);
/* Specified network? */
if (op_val == IPMIP6HA_CMD_HA6_OP_SHOW ||
op_val == IPMIP6HA_CMD_HA6_OP_DELETE ||
op_val == IPMIP6HA_CMD_HA6_OP_LIST)
{
struct Ipmip6ha_cmd_op_val opval;
Ip_bool all = IP_FALSE;
/**/
ipcom_memset(&opval, 0, sizeof(opval));
opval.cmd = op_val;
/* Time to retrieve data regarding this particular network */
while ((i = ipcom_getopt_r(argc - 1, argv + 1, "av", &opt)) != -1)
{
switch (i)
{
case 'v':
opval.verbose = IP_TRUE;
break;
case 'a':
all = IP_TRUE;
break;
default:
ipcom_printf("invalid option '%c'"IP_LF, i);
goto exit_out;
}
}
if (op_val == IPMIP6HA_CMD_HA6_OP_LIST)
ipmip6ha_cmd_print_binding_fmt("Home Address",
"Care of Address",
"Interface",
"Lifetime",
"Flags");
if (all)
{
/**/
if (ipmip6ha_cli_node_list(&daemon, &req, IP_NULL, IP_NULL, IP_NULL) == IPCOM_SUCCESS)
ipmip6ha_cmd_foreach_binding(proc, &daemon, &req, ipmip6ha_cmd_do_binding, &opval);
}
else
{
struct Ip_in6_addr hoa;
if (argc <= opt.optind + 1)
{
ipcom_printf("ha6: no node identifiers specified"IP_LF);
goto exit_out;
}
for (i = opt.optind + 1; i < argc; i++)
{
char *cptr;
Ip_u32 handle;
if ((handle = (Ip_u32)ipcom_strtoul(argv[i], &cptr, 0)) != 0 && *cptr == '\0')
ipmip6ha_cmd_do_binding(proc, &daemon, 0, handle, &opval);
else
{
int lret;
if (ipcom_inet_pton(IP_AF_INET6, argv[i], &hoa) == 1)
lret = ipmip6ha_cli_node_list(&daemon, &req, IP_NULL, &hoa, IP_NULL);
else
lret = ipmip6ha_cli_node_list(&daemon, &req, IP_NULL, IP_NULL, argv[i]);
if (lret == IPCOM_SUCCESS)
ipmip6ha_cmd_foreach_binding(proc, &daemon, &req, ipmip6ha_cmd_do_binding, &opval);
}
}
}
/* Success */
ret = 0;
}
else if (op_val == IPMIP6HA_CMD_HA6_OP_REVOKE)
{
struct Ipmip6ha_cmd_op_val opval;
ipcom_memset(&opval, 0, sizeof(opval));
if (argc < 3)
{
ipmip6ha_cmd_ha6_print_usage(proc);
goto exit_out;
}
if (ipcom_strcasecmp(argv[2], "node") == 0)
{
Ip_bool all = IP_FALSE;
opval.cmd = IPMIP6HA_CMD_HA6_OP_REVOKE_NODE;
/* Handle, NAI or HoA. May do DOMAIN as well */
while ((i = ipcom_getopt_r(argc - 2, argv + 2, "a4", &opt)) != -1)
{
switch (i)
{
case '4':
/**/
#ifdef IPMIP_USE_INET
opval.cmd = IPMIP6HA_CMD_HA6_OP_REVOKE_NODE_INET;
#endif
break;
case 'a':
all = IP_TRUE;
break;
default:
ipcom_printf("invalid option '%c'"IP_LF, i);
goto exit_out;
}
}
if (all)
{
/**/
if (ipmip6ha_cli_node_list(&daemon, &req, IP_NULL, IP_NULL, IP_NULL) == IPCOM_SUCCESS)
ipmip6ha_cmd_foreach_binding(proc, &daemon, &req, ipmip6ha_cmd_do_binding, &opval);
}
else
{
struct Ip_in6_addr hoa;
if (argc <= opt.optind + 1)
{
ipcom_printf("ha6: no node identifiers specified"IP_LF);
goto exit_out;
}
for (i = opt.optind + 1; i < argc; i++)
{
char *cptr;
Ip_u32 handle;
if ((handle = (Ip_u32)ipcom_strtoul(argv[i], &cptr, 0)) != 0 && *cptr == '\0')
ipmip6ha_cmd_do_binding(proc, &daemon, 0, handle, &opval);
else
{
int lret;
if (ipcom_inet_pton(IP_AF_INET6, argv[i], &hoa) == 1)
lret = ipmip6ha_cli_node_list(&daemon, &req, IP_NULL, &hoa, IP_NULL);
else
lret = ipmip6ha_cli_node_list(&daemon, &req, IP_NULL, IP_NULL, argv[i]);
if (lret == IPCOM_SUCCESS)
ipmip6ha_cmd_foreach_binding(proc, &daemon, &req, ipmip6ha_cmd_do_binding, &opval);
}
}
}
}
else if (ipcom_strcasecmp(argv[2], "mag") == 0)
{
struct Ip_in6_addr mag;
const char *ifname = IP_NULL;
const char *nai_match = IP_NULL;
Ip_u8 reason = 0;
opval.cmd = IPMIP6HA_CMD_HA6_OP_REVOKE_MAG;
ipcom_memset(&mag, 0, sizeof(mag));
/* Handle, NAI or HoA. May do DOMAIN as well */
while ((i = ipcom_getopt_r(argc - 2, argv + 2, "i:m:n:r:", &opt)) != -1)
{
switch (i)
{
case 'm':
/**/
if (ipcom_inet_pton(IP_AF_INET6, opt.optarg, &mag) != 1)
{
ipcom_printf("ha6: invalid MAG inet6 address '%s'"IP_LF, opt.optarg);
goto exit_out;
}
break;
case 'i':
ifname = opt.optarg;
break;
case 'n':
nai_match = opt.optarg;
break;
case 'r':
reason = (Ip_u8)ipcom_strtoul(opt.optarg, IP_NULL, 0);
break;
default:
ipcom_printf("invalid option '%c'"IP_LF, i);
goto exit_out;
}
}
if (reason == 0)
reason = (Ip_u8)(nai_match? IPMIP6_MH_BRI_TRIGGER_REVOKING_NODE_LOCAL_POLICY : IPMIP6_MH_BRI_TRIGGER_PER_PEER_POLICY);
if (ipmip6ha_cli_mag_list(&daemon, &req) == IPCOM_SUCCESS)
{
Ipmip_attr_iter_t riter;
struct Ipmip_attr *pattr;
ipmip_cli_daemon_iter_request_init(&req, &riter);
while ((pattr = ipmip6ha_cli_mag_next(&riter)) != IP_NULL)
{
const char *m_ifname = ipmip6ha_cli_mag_get_ifname(pattr);
const struct Ip_in6_addr *m_addr = ipmip6ha_cli_mag_get_addr_v6(pattr);
if (ifname && ipcom_strcmp(ifname, m_ifname) != 0)
continue;
if (!IP_IN6_IS_ADDR_UNSPECIFIED(&mag) && !IP_IN6_ARE_ADDR_EQUAL(&mag, m_addr))
continue;
/* Revoke me */
ipmip6ha_cli_mag_revoke(&daemon, m_ifname, m_addr, reason, nai_match);
}
}
/**/
}
else
{
ipmip6ha_cmd_ha6_print_usage(proc);
goto exit_out;
}
/* Success */
ret = 0;
}
else if (op_val == IPMIP6HA_CMD_HA6_OP_PREFIX)
{
if (ipmip6ha_cli_prefix_list(&daemon, &req) == IPCOM_SUCCESS)
{
Ipmip_attr_iter_t riter;
struct Ipmip_attr *pattr;
ipmip_cli_daemon_iter_request_init(&req, &riter);
while ((pattr = ipmip6ha_cli_prefix_next(&riter)) != IP_NULL)
{
const char *ifname = ipmip6ha_cli_prefix_get_ifname(pattr);
const struct Ip_in6_addr *router = ipmip6ha_cli_prefix_get_router(pattr);
const Ipmip6_address_t *prefix = ipmip6ha_cli_prefix_get_prefix(pattr);
Ip_time_t timestamp = ipmip6ha_cli_prefix_get_prefix_timestamp(pattr);
Ip_time_t valid = ipmip6ha_cli_prefix_get_prefix_valid(pattr);
Ip_time_t now = ipmip_util_time();
now -= timestamp;
valid -= now;
if (ifname && router && prefix)
ipcom_printf("%s - %s/%d@%s - %ld sec"IP_LF,
ifname,
ipmip_ntop_inet6(proc, &prefix->prefix, IP_NULL),
prefix->len,
ipmip_ntop_inet6(proc, router, IP_NULL),
valid);
}
}
}
else if (op_val == IPMIP6HA_CMD_HA6_OP_MAG)
{
if (ipmip6ha_cli_mag_list(&daemon, &req) == IPCOM_SUCCESS)
{
Ipmip_attr_iter_t riter;
struct Ipmip_attr *pattr;
ipmip_cli_daemon_iter_request_init(&req, &riter);
while ((pattr = ipmip6ha_cli_mag_next(&riter)) != IP_NULL)
{
const char *ifname = ipmip6ha_cli_mag_get_ifname(pattr);
const struct Ip_in6_addr *addr = ipmip6ha_cli_mag_get_addr_v6(pattr);
Ip_u32 hb = ipmip6ha_cli_mag_get_heartbeat(pattr);
Ip_u32 refcnt = ipmip6ha_cli_mag_get_references(pattr);
#ifdef IPMIP_USE_INET
Ip_u32 v4 = ipmip6ha_cli_mag_get_addr_v4(pattr);
#else
Ip_u32 v4 = 0;
#endif
ipcom_printf("MAG %s%s%s@%s"IP_LF,
ipmip_ntop_inet6(proc, addr, IP_NULL),
v4? "/" : "",
v4? ipmip_ntop_inet(proc, v4) : "",
ifname);
ipcom_printf(" HeartBeat : %s"IP_LF, hb? "enabled" : "disabled");
ipcom_printf(" References: %d"IP_LF, refcnt);
}
}
}
exit_out:
ipmip_cli_daemon_disconnect(&daemon);
ipmip_cli_daemon_request_release(&req);
if (proc)
ipmip_proc_destroy(proc);
/* No go */
return ret;
}
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,251 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_h.h,v $ $Revision: 1.15 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_h.h,v $
* $Author: jhorteli $ $Date: 2009-03-31 15:00:32 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_H_H
#define IPMIP6HA_H_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_route.h>
#include <ipcom_hash.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_nemo_pool;
struct Ipmip6ha_context;
struct Ipmip6ha_pktbuf;
struct Ipmip_proc;
struct Ipmip6ha_if;
struct Ipmip_cli_message;
struct Ipmip6ha_node;
struct Ipmip_timer;
struct Ipmip6ha_nemo_context;
struct Ipmip_buffer;
struct Ipmip_context_id;
typedef void (*Ipmip6ha_extension_config_global_t)
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
void *global_config,
struct Ipmip_cli_message *request
);
typedef void (*Ipmip6ha_extension_config_ifp_t)
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
struct Ipmip6ha_if *ifp,
void *global_config,
void *ifp_config,
struct Ipmip_cli_message *request
);
typedef int (*Ipmip6ha_extension_provide_t)
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6ha_node *node,
struct Ipmip_timer *service
);
typedef Ip_bool (*Ipmip6ha_extension_setup_t)
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
int action,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6ha_node *node,
struct Ipmip_cli_message *request
);
typedef Ip_bool (*Ipmip6ha_extension_pkt_req_validate_t)
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf,
struct Ipmip_timer *service
);
typedef Ip_bool (*Ipmip6ha_extension_pkt_req_accept_t)
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf,
struct Ipmip_timer *service
);
typedef void (*Ipmip6ha_extension_pkt_rep_apply_t)
(
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
void *global_config,
void *ifp_config,
void *node_config,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf_reply,
struct Ipmip6ha_pktbuf *pbuf_request
);
typedef struct Ipmip6ha_extension
{
const char *name;
Ip_u32 node_data_size;
Ip_u32 ifp_data_size;
Ip_u32 global_data_size;
/* Callbacks */
Ipmip6ha_extension_config_ifp_t config_ifp;
Ipmip6ha_extension_config_global_t config_global;
Ipmip6ha_extension_provide_t provide;
Ipmip6ha_extension_setup_t setup;
Ipmip6ha_extension_pkt_req_validate_t pkt_req_validate;
Ipmip6ha_extension_pkt_req_accept_t pkt_req_accept;
Ipmip6ha_extension_pkt_rep_apply_t pkt_rep_apply;
/* Set by PMIP */
Ip_u32 type;
} Ipmip6ha_extension_t;
typedef struct Ipmip6ha_context
{
Ipmip6_context_t ipmip6; /* Global context */
Ip_fd fd_ipd; /* ipd */
struct Ip_in6_addr link_local_prefix;
/* Mobile node specific information */
/* Current prefix lists */
Ipcom_mutex prefixes_lock;
Ipcom_route *prefixes;
Ipcom_hash *relay_map;
struct Ipmip_context_id *idents;
struct Ipmip_context_id *bri;
struct
{
Ip_u32 forward;
Ip_u32 tunnel;
} iftables;
/**/
Ipcom_list ifs;
Ipmip_timer_lock_t *ifs_lock;
/* NEMO */
Ipcom_mutex nemo_lock;
Ipcom_route *nemo_rtab;
struct Ipmip6ha_nemo_context *nemo;
Ipmip6ha_extension_t *extensions[32];
Ip_u32 extensions_num;
Ip_u32 extensions_P_mask;
Ip_u32 extensions_H_mask;
Ip_u32 extensions_node_P_data;
Ip_u32 extensions_node_H_data;
void *extdata[32];
}
Ipmip6ha_context_t;
typedef struct Ipmip6ha_relay_key
{
char *nai;
Ip_size_t nai_len;
struct Ipmip6ha_if *ifp;
} Ipmip6ha_relay_key_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL Ip_u32 ipmip6ha_context_register_extension(Ipmip6ha_context_t *ctx,
Ipmip6ha_extension_t *srv,
Ip_bool reg_H,
Ip_bool reg_P);
IP_GLOBAL void ipmip6ha_dump_relay_map(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_buffer *buffer);
IP_GLOBAL void ipmip6ha_main(void);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,402 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_icmp.c,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_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 "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_syslog.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_icmp_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_icmp.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_pktbuf.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6mn_icmp_homeagent_discovery
*===========================================================================
* Description: Sends a homeagent discovery request to the homeagent's anycast
* address using the src prefix as sender address.
* Parameters: instance - The mobile node instance
* home - The home address.
* src - The parameters to use as outbound source.
* id - The mobile node configuration entry ID.
* Returns: IP_TRUE if no network error occured
*
*/
IP_STATIC Ip_bool
ipmip6ha_icmp_homeagent_discovery_advertisement(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ifp,
Ip_bool mobile_router,
struct Ip_in6_addr *src,
Ip_u16 id)
{
Ipmip6ha_pktbuf_t *pkt;
/* Allocate the packet */
pkt = (Ipmip6ha_pktbuf_t *)ipmip6_icmp_pkt_alloc(&ctx->ipmip6,
proc,
0,
IPMIP6_ICMP6_HA_DISCOVERY_REPLY,
0);
/* Successful allocation? */
if (pkt != IP_NULL)
{
/* */
Ipmip_timer_lock_t *lock;
Ipmip6_if_router_t *router;
int err;
int cnt = 0;
/* Grab the payload */
Ipmip6_pkt_icmp6_t *icmp = (Ipmip6_pkt_icmp6_t *) IPMIP_BUFFER_PTR(&pkt->ipmip6.ipmip.packet);
/* Identifier */
icmp->icmp6_dataun.icmp6_un_data16[0] = id;
lock = ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, ifp->ipmip6.iff_lock);
if (mobile_router)
{
/* We have the address; do prefix matching */
for (router = IPCOM_LIST_FIRST(&ifp->ipmip6.routers); router != IP_NULL; router = IPCOM_LIST_NEXT(&router->next))
{
if (IP_BIT_ISTRUE(router->ifr_type, (1 << IPMIP6_IF_RTR_HOMEAGENT)) && IP_BIT_ISTRUE(router->ifr_type, (1 << IPMIP6_IF_RTR_MOBILE)))
{
Ipmip6_if_prefix_t *gaddr = ipmip6_if_prefix_lookup_global(router);
if (gaddr)
{
ipmip_buffer_append(&pkt->ipmip6.ipmip.packet, &gaddr->prefix.prefix, sizeof(struct Ip_in6_addr));
cnt++;
}
}
}
if (cnt)
{
icmp = (Ipmip6_pkt_icmp6_t *) IPMIP_BUFFER_PTR(&pkt->ipmip6.ipmip.packet);
icmp->icmp6_dataun.icmp6_un_data16[1] |= ip_ntohs(IPMIP6_DHAAD_MOBILE_ROUTER);
}
}
if (cnt == 0)
{
/* We have the address; do prefix matching */
for (router = IPCOM_LIST_FIRST(&ifp->ipmip6.routers); router != IP_NULL; router = IPCOM_LIST_NEXT(&router->next))
{
if (IP_BIT_ISTRUE(router->ifr_type, (1 << IPMIP6_IF_RTR_HOMEAGENT)))
{
Ipmip6_if_prefix_t *gaddr = ipmip6_if_prefix_lookup_global(router);
if (gaddr)
{
ipmip_buffer_append(&pkt->ipmip6.ipmip.packet, &gaddr->prefix.prefix, sizeof(struct Ip_in6_addr));
cnt++;
}
}
}
}
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
IPCOM_LOG2(INFO,
"%s: Homeagent Discovery containing %d home agents sent",
ctx->ipmip6.ipmip.name,
cnt);
/* Set the source address */
ipmip6_pkt_pktinfo_opt_add(&pkt->ipmip6,
&ifp->ifaddr.prefix,
&ifp->ipmip6);
/* Send */
if ((err = ipmip6_pkt_send(&ctx->ipmip6, proc, ctx->ipmip6.pkt->fd_icmp_out, &pkt->ipmip6, src)) != 0)
{
IPCOM_LOG2(WARNING,
"%s: Failed to send Homeagent Discovery = %d",
ctx->ipmip6.ipmip.name,
err);
return IP_FALSE;
}
}
/* */
return IP_TRUE;
}
/*
*===========================================================================
* ipmip6mn_icmp_mobile_prefix_solicitation
*===========================================================================
* Description: Sends a mobile prefix solicitation to the indicated homeagent.
* Parameters: instance - Mpbile node instance
* homeagent - The homeagent address.
* coa - The CoA to use
* home - The home address to use.
* id - The mobile node configuration entry ID.
* Returns: IP_TRUE if successful.
*
*/
IP_STATIC Ip_bool
ipmip6ha_icmp_mobile_prefix_advertisement(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
struct Ipmip6ha_if *ifp,
struct Ip_in6_addr *coa,
struct Ip_in6_addr *hoa,
Ip_u16 id)
{
Ipmip6ha_pktbuf_t *pkt;
/* Allocate the packet */
pkt = (Ipmip6ha_pktbuf_t *)ipmip6_icmp_pkt_alloc(&ctx->ipmip6,
proc,
0,
IPMIP6_ICMP6_PREFIX_ADVERT,
0);
/* Successful allocation? */
if (pkt != IP_NULL)
{
/* Grab the payload */
int err;
Ipmip6_pkt_icmp6_t *icmp = (Ipmip6_pkt_icmp6_t *) IPMIP_BUFFER_PTR(&pkt->ipmip6.ipmip.packet);
/* Identifier */
icmp->icmp6_dataun.icmp6_un_data16[0] = id;
/* Set the source address */
ipmip6_pkt_pktinfo_opt_add(&pkt->ipmip6,
&ifp->ifaddr.prefix,
&ifp->ipmip6);
ipmip6_pkt_rthdr2_opt_add(&pkt->ipmip6, hoa);
/* Need to add all routers & prefixes */
{
Ipmip_timer_lock_t *lock;
Ipmip6_if_prefix_t *prefix;
Ipmip6_if_router_t *router;
Ipmip6ha_if_route_entry_t *se;
if (ifp->RelayBindings)
{
ipcom_mutex_lock(ctx->prefixes_lock);
if (ipmip_route_lookup(ctx->prefixes, hoa, (Ipmip_route_t **)&se) != IPMIP_ROUTE_LOOKUP_MISS)
ifp = se->ifp;
ipcom_mutex_unlock(ctx->prefixes_lock);
}
lock = ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, ifp->ipmip6.iff_lock);
/* */
/* We have the address; do prefix matching */
for (router = IPCOM_LIST_FIRST(&ifp->ipmip6.routers); router != IP_NULL; router = IPCOM_LIST_NEXT(&router->next))
{
for (prefix = IPCOM_LIST_FIRST(&router->prefixes); prefix != IP_NULL; prefix = IPCOM_LIST_NEXT(&prefix->next))
{
/* Prefix */
Ipmip6_pkt_nd_opt_prefix_info_t pinfo;
pinfo.nd_opt_pi_type = IPMIP6_ND_OPT_PREFIX_INFORMATION;
pinfo.nd_opt_pi_len = 4;
pinfo.nd_opt_pi_prefix_len = prefix->prefix.len;
pinfo.nd_opt_pi_flags_reserved = prefix->flags;
pinfo.nd_opt_pi_valid_time = ip_htonl(((Ip_u32)prefix->valid));
pinfo.nd_opt_pi_preferred_time = ip_htonl(((Ip_u32)prefix->preferred));
pinfo.nd_opt_pi_reserved2 = 0;
ipcom_memcpy(&pinfo.nd_opt_pi_prefix, &prefix->prefix.prefix, sizeof(struct Ip_in6_addr));
ipmip_buffer_append(&pkt->ipmip6.ipmip.packet, &pinfo, sizeof(pinfo));
}
}
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
}
/* Send */
if ((err = ipmip6_pkt_send(&ctx->ipmip6, proc, ctx->ipmip6.pkt->fd_icmp_out, &pkt->ipmip6, coa)) != 0)
{
IPCOM_LOG2(WARNING,
"%s: Failed to send Mobile Prefix Advertisement = %d",
ctx->ipmip6.ipmip.name,
err);
return IP_FALSE;
}
}
return IP_TRUE;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6mn_icmp_dispatch
*===========================================================================
* Description: Process an ICMP packet.
* Parameters: context - The context.
* icmp - The ICMP packet
* icmp_len - The length of the ICMP packet.
* pktinfo - Packet info.
* src - The sender
* salist - List of SA's processed
* rthdr2 - Did this ICMP frame contain a RTHDR2.
* Returns: IP_TRUE if successfully processed.
*
*/
IP_GLOBAL Ip_bool
ipmip6ha_icmp_dispatch(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_pktbuf_t *pbuf)
{
Ipmip6_pkt_icmp6_t *icmp = IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
if ((pbuf->iff_home.priv = ipmip6ha_if_findbypktinfo(ctx, proc, pbuf->ipmip6.ipmip.srcinfo.dst)) == IP_NULL)
goto done_out;
/* Just link */
pbuf->iff_transport.priv = pbuf->iff_home.priv;
/* Determine what we've got */
switch (icmp->icmp6_type)
{
case IPMIP6_ICMP6_PREFIX_SOLICIT:
/* Sanity */
if (pbuf->ipmip6.recvinfo.home != IP_NULL)
ipmip6ha_icmp_mobile_prefix_advertisement(ctx,
proc,
pbuf->iff_home.priv,
&pbuf->ipmip6.ipmip.srcinfo.src->sin6.sin6_addr,
pbuf->ipmip6.recvinfo.home,
icmp->icmp6_dataun.icmp6_un_data16[0]);
break;
case IPMIP6_ICMP6_HA_DISCOVERY_REQUEST:
IPCOM_LOG2(DEBUG2,
"%s: ICMP6 Home Agent Discovery Request received(%d)",
ctx->ipmip6.ipmip.name,
icmp->icmp6_dataun.icmp6_un_data16[0]);
/* Do reply */
ipmip6ha_icmp_homeagent_discovery_advertisement(ctx,
proc,
pbuf->iff_home.priv,
(icmp->icmp6_dataun.icmp6_un_data16[1] & ip_ntohs(IPMIP6_DHAAD_MOBILE_ROUTER)) != 0,
&pbuf->ipmip6.ipmip.srcinfo.src->sin6.sin6_addr,
icmp->icmp6_dataun.icmp6_un_data16[0]);
break;
default:
return IP_FALSE;
}
done_out:
ipmip_pktbuf_free(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
return IP_TRUE;
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,91 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_icmp.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_icmp.h,v $
* $Author: jhorteli $ $Date: 2009-02-09 15:46:08 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_ICMP_H
#define IPMIP6HA_ICMP_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6_address;
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip6ha_pktbuf;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6ha_icmp_dispatch
*===========================================================================
* Description: Process an ICMP packet.
* Parameters: context - The context.
* icmp - The ICMP packet
* icmp_len - The length of the ICMP packet.
* pktinfo - Packet info.
* src - The sender
* salist - List of SA's processed
* rthdr2 - Did this ICMP frame contain a RTHDR2.
* Returns: IP_TRUE if successfully processed.
*
*/
IP_GLOBAL Ip_bool ipmip6ha_icmp_dispatch(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_pktbuf *pbuf);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,915 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_if.c,v $ $Revision: 1.27.10.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_if.c,v $
* $Author: svc-cmnet $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_if.c,v $ $Revision: 1.27.10.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_if.c,v $
* $Author: svc-cmnet $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_err.h>
#include <ipcom_sysvar.h>
#include <ipcom_syslog.h>
#include <ipcom_shell.h>
#include <ipcom_route.h>
#include <ipnet.h>
#include <ipnet_policy_routing.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <private/ipmip_sysvar.h>
#include <private/ipmip_dhcp.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_icmp.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_route.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_pktbuf.h"
#include "ipmip6ha_mag.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_nemo.h"
#include "ipmip6ha_nemo_dsmipv6.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC void
ipmip6ha_if_tunnel_cleanup(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife)
{
/* Delete the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_DELRULE,
ctx->iftables.forward,
IPMIP6HA_ROUTE_PRIORITY_TUNNEL,
ife->ipmip6.iff.ifindex,
&ip_in6addr_any,
0,
&ip_in6addr_any,
0,
0,
IP_FIB_RULE_FIND_SADDR);
}
IP_STATIC void
ipmip6ha_if_cleanup(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife)
{
int i;
unsigned int si;
ipmip6ha_node_if_destroy(ctx, proc, ife);
ipmip6ha_mag_unconfigure(ctx, proc, ife);
/**/
for (si = 0; si < ctx->extensions_num; si++)
{
if (ctx->extensions[si]->config_ifp != IP_NULL)
{
if (ife->extdata[si])
{
(*ctx->extensions[si]->config_ifp) (ctx, proc, IPMIP_CALLBACK_CONFIG_FREE, ife, ctx->extdata[si], ife->extdata[si], IP_NULL);
ipcom_free(ife->extdata[si]);
ife->extdata[si] = IP_NULL;
}
}
}
/* Join DHAAD */
ipmip6_icmp_mc_anycast_address(&ctx->ipmip6, proc, IP_FALSE, &ife->ipmip6, &ife->ifaddr, 126);
/* Remove this configuration */
ipmip6ha_nemo_unconfigure(ctx, proc, ife->nemo);
/* Do destroy any tunnels on this interface */
for (i = 0; i < IPMIP_TUNNELTYPE_MAX + 1; i++)
{
if (ife->iftunnels[i] != IP_NULL)
{
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ife->iftunnels[i]->ipmip6.iff);
ife->iftunnels[i] = IP_NULL;
}
}
if (ife->iftables.pending != IPCOM_ROUTE_TABLE_UNSPEC)
{
/* Delete the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_DELRULE,
ife->iftables.pending,
IPMIP6HA_ROUTE_PRIORITY_PENDING,
0,
&ife->ifaddr.prefix,
128,
&ip_in6addr_any,
0,
0,
0);
ipmip_util_route_table_free(&ctx->ipmip6.ipmip, proc, ife->iftables.pending);
}
if (ife->iftables.route_optimize != IPCOM_ROUTE_TABLE_UNSPEC)
{
/* Delete the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_DELRULE,
ife->iftables.route_optimize,
IPMIP6HA_ROUTE_PRIORITY_RO,
0,
&ife->ifaddr.prefix,
128,
&ip_in6addr_any,
0,
0,
0);
ipmip_util_route_table_free(&ctx->ipmip6.ipmip, proc, ife->iftables.route_optimize);
}
if (ife->iftables.tunnel != IPCOM_ROUTE_TABLE_UNSPEC)
{
#ifdef IPMIP_USE_INET
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET,
IP_RTM_DELRULE,
ife->iftables.tunnel,
IPMIP6HA_ROUTE_PRIORITY_FORWARD,
ife->ipmip6.iff.ifindex,
&ip_inaddr_any,
0,
&ip_inaddr_any,
0,
0,
0);
if (ife->ifaddr_v4)
{
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET,
IP_RTM_DELRULE,
ife->iftables.tunnel,
IPMIP6HA_ROUTE_PRIORITY_FORWARD,
0,
&ife->ifaddr_v4,
32,
&ip_inaddr_any,
0,
0,
0);
}
#endif
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_DELRULE,
ife->iftables.tunnel,
IPMIP6HA_ROUTE_PRIORITY_FORWARD,
ife->ipmip6.iff.ifindex,
&ip_in6addr_any,
0,
&ip_in6addr_any,
0,
0,
0);
ipmip_util_route_table_free(&ctx->ipmip6.ipmip, proc, ife->iftables.tunnel);
}
}
/*
*===========================================================================
* ipmip6mn_route_tunnel_create
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC Ipmip6ha_if_t *
ipmip6ha_if_tunnel_create(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
int type,
Ip_u8 family,
void *addr,
Ip_u8 addr_len,
Ip_u32 ifindex)
{
Ipmip6ha_if_t *ifp = IP_NULL;
char tname[IP_IFNAMSIZ];
struct Ip_ip_tunnel_param tun;
int ret;
ipcom_snprintf(tname, sizeof(tname), "%s%dha%x", ipmip_util_tunnel_to_bsdname((Ip_u8)type), type, ifindex);
if (ipcom_if_nametoindex(tname) != 0)
return IP_NULL;
ifp = (Ipmip6ha_if_t *)ipmip6_if_alloc_tunnel(&ctx->ipmip6,
proc,
sizeof(*ifp),
tname,
0,
(Ip_u8)type,
IP_FALSE,
(Ipmip_if_cleanup_t)ipmip6ha_if_tunnel_cleanup);
if (ifp == IP_NULL)
return IP_NULL;
/**/
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s created",
tname));
/**/
#ifdef IPMIP_USE_INET
if (family == IP_AF_INET)
ifp->ifaddr_v4 = IP_GET_32ON8(addr);
else
#endif
ipcom_memcpy(&ifp->ifaddr.prefix, addr, sizeof(struct Ip_in6_addr));
/* Assign the home address */
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, family, IP_RTM_NEWADDR, ifp->ipmip6.iff.ifindex, addr, addr_len, 0, 0) < 0)
{
IPCOM_LOG2(ERR,
"%s: ipcom_socketioctl(IP_SIOCADDROUTETAB) failed, errno = %d",
ctx->ipmip6.ipmip.name,
ipcom_errno);
goto fail;
}
/* Add the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_NEWRULE,
ctx->iftables.forward,
IPMIP6HA_ROUTE_PRIORITY_TUNNEL,
ifp->ipmip6.iff.ifindex,
&ip_in6addr_any,
0,
&ip_in6addr_any,
0,
0,
IP_FIB_RULE_FIND_SADDR);
/* Change tunnel */
ipcom_memset(&tun, 0, sizeof(tun));
ipcom_strncpy(tun.ifr_name, ifp->ipmip6.iff.ifname, sizeof(tun.ifr_name));
/* Set values */
#ifdef IPMIP_USE_INET
if (family == IP_AF_INET)
{
tun.local_addr.sin.sin_family = IP_AF_INET;
tun.local_addr.sin.sin_addr.s_addr = IP_GET_32ON8(addr);
IPCOM_SA_LEN_SET(&tun.local_addr.sin, sizeof(struct Ip_sockaddr_in));
tun.local_addr.sin.sin_port = ctx->ipmip6.pkt->s_udp_nat.sin6_port;
tun.remote_addr.sin.sin_family = IP_AF_INET;
tun.remote_addr.sin.sin_addr.s_addr = IP_INADDR_ANY;
IPCOM_SA_LEN_SET(&tun.remote_addr.sin, sizeof(struct Ip_sockaddr_in));
}
else
#endif
{
tun.local_addr.sin6.sin6_family = IP_AF_INET6;
tun.local_addr.sin6.sin6_addr = ifp->ifaddr.prefix;
IPCOM_SA_LEN_SET(&tun.local_addr.sin6, sizeof(struct Ip_sockaddr_in6));
tun.local_addr.sin6.sin6_port = ctx->ipmip6.pkt->s_udp_nat.sin6_port;
tun.remote_addr.sin6.sin6_family = IP_AF_INET6;
tun.remote_addr.sin6.sin6_addr = ip_in6addr_any;
IPCOM_SA_LEN_SET(&tun.remote_addr.sin6, sizeof(struct Ip_sockaddr_in6));
tun.remote_addr.sin6.sin6_scope_id = 3;
}
tun.ttl = 64;
/* Try set the tunnel values */
if (ipmip_util_ioctl(&ctx->ipmip6.ipmip, proc, IP_SIOCCHGTUNNEL, &tun) < 0)
{
IPCOM_LOG4(ERR,
"%s: ipcom_socketioctl(%s, IP_SIOCCHGTUNNEL) failed: %s [%d]",
ctx->ipmip6.ipmip.name,
tname,
ipcom_strerror(ipcom_errno),
ipcom_errno);
goto fail;
}
/* GO HUGE on MTU */
if ((ret = ipmip_netlink_link(&ctx->ipmip6.ipmip,
proc,
IP_RTM_SETLINK,
ifp->ipmip6.iff.ifindex,
0,
0,
IP_NULL,
IP_NULL,
0xFFFF) < 0))
{
IPCOM_LOG3(ERR,
"%s: Unable to set large MTU on %s, ret = %d",
ctx->ipmip6.ipmip.name,
tname,
-ret);
}
/**/
return ifp;
fail:
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ifp->ipmip6.iff);
return IP_NULL;
}
IP_STATIC Ip_bool
ipmip6ha_if_setup(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife)
{
unsigned int si;
char initfmt[IP_IFNAMSIZ + 1 + 20];
/**/
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"%s created",
ife->ipmip6.iff.ifname));
ipmip6ha_node_if_init(ctx, proc, ife);
/* Read some base values */
ife->lifetime = ipmip_sysvar_ushort(ipmip_sysvar_ushort(0, "ipmip6ha.lifetime"), "ipmip6ha.interface.%s.lifetime", ife->ipmip6.iff.ifname);
ife->refresh = ipmip_sysvar_ushort(ipmip_sysvar_ushort(0, "ipmip6ha.refresh"), "ipmip6ha.interface.%s.refresh", ife->ipmip6.iff.ifname);
ife->AlwaysVerifyTunnelSrc = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.AlwaysVerifyTunnelSrc"), "ipmip6ha.interface.%s.AlwaysVerifyTunnelSrc", ife->ipmip6.iff.ifname);
ife->RelayBindings = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.RelayBindings"), "ipmip6ha.interface.%s.RelayBindings", ife->ipmip6.iff.ifname);
ife->BindingRevocationEnabled = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.LMA.BindingRevocation"), "ipmip6ha.interface.%s.LMA.BindingRevocation", ife->ipmip6.iff.ifname);
if (ife->refresh >= 100)
ife->refresh = 0;
ife->BRIMaxRetriesNumber = ipmip_sysvar_u32(ipmip_sysvar_u32(1, "ipmip6ha.BRIMaxRetriesNumber"), "ipmip6ha.interface.%s.BRIMaxRetriesNumber", ife->ipmip6.iff.ifname);
ife->MINDelayBRIs = ipmip_sysvar_u32(ipmip_sysvar_u32(1000, "ipmip6ha.MINDelayBRIs"), "ipmip6ha.interface.%s.MINDelayBRIs", ife->ipmip6.iff.ifname);
ife->MinDelayBeforeBCEDelete = ipmip_sysvar_u32(ipmip_sysvar_u32(10000, "ipmip6ha.LMA.MinDelayBeforeBCEDelete"), "ipmip6ha.interface.%s.LMA.MinDelayBeforeBCEDelete", ife->ipmip6.iff.ifname);
ife->MaxDelayBeforeNewBCEAssign = ipmip_sysvar_u32(ipmip_sysvar_u32(1500, "ipmip6ha.LMA.MaxDelayBeforeNewBCEAssign"), "ipmip6ha.interface.%s.LMA.MaxDelayBeforeNewBCEAssign", ife->ipmip6.iff.ifname);
ife->TimestampValidityWindow = ipmip_sysvar_u32(ipmip_sysvar_u32(300, "ipmip6ha.LMA.TimestampValidityWindow"), "ipmip6ha.interface.%s.LMA.TimestampValidityWindow", ife->ipmip6.iff.ifname);
/* Create a timeval structure */
ife->TimestampValidityWindow_tv.tv_sec = (long) (ife->TimestampValidityWindow / 1000);
ife->TimestampValidityWindow_tv.tv_usec = (long) ((ife->TimestampValidityWindow % 1000) * 1000);
ife->TimestampBasedApproachInUse = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.LMA.TimestampBasedApproachInUse"), "ipmip6ha.interface.%s.LMA.TimestampBasedApproachInUse", ife->ipmip6.iff.ifname);
if (ife->TimestampBasedApproachInUse)
ife->MobileNodeGeneratedTimestampInUse = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.LMA.MobileNodeGeneratedTimestampInUse"), "ipmip6ha.interface.%s.LMA.MobileNodeGeneratedTimestampInUse", ife->ipmip6.iff.ifname);
/* Read the prefix list allowed for this interface */
if (!ipmip_sysvar_inet6(&ip_in6addr_any, &ife->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, &ife->FixedMAGLinkLocalAddressOnAllAccessLinks.len, "ipmip6ha.interface.%s.LMA.FixedMAGLinkLocalAddressOnAllAccessLinks", ife->ipmip6.iff.ifname))
ipmip_sysvar_inet6(&ip_in6addr_any, &ife->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, &ife->FixedMAGLinkLocalAddressOnAllAccessLinks.len, "ipmip6ha.LMA.FixedMAGLinkLocalAddressOnAllAccessLinks");
/* Check if its unspecified */
if (IP_IN6_IS_ADDR_UNSPECIFIED(&ife->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix))
ife->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO = IP_TRUE;
/* Read the prefix list allowed for this interface */
if (!ipmip_sysvar_inet6(&ip_in6addr_any, &ife->ifaddr.prefix, &ife->ifaddr.len, "ipmip6ha.interface.%s.homeagent", ife->ipmip6.iff.ifname))
{
Ipmip6_if_inet6_t *ifaddr;
/* No address found; resolve from interface */
for (ifaddr = IPCOM_LIST_FIRST(&ife->ipmip6.inet6); ifaddr != IP_NULL; ifaddr = IPCOM_LIST_NEXT(&ifaddr->ifa_next))
{
/* Only check UNIVERSE scope addresses; and addresses covered by a broadcasted prefix */
if (ifaddr->ifa_scope == IP_RT_SCOPE_UNIVERSE)
break;
}
if (!ifaddr)
{
IPMIP6_EVENT_IF(WARNING, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to retrieve global IPv6 address on interface %s - configuration aborted",
ife->ipmip6.iff.ifname));
return IP_FALSE;
}
ipcom_memcpy(&ife->ifaddr.prefix, &ifaddr->ifa_address.prefix, sizeof(ife->ifaddr.prefix));
ife->ifaddr.len = ifaddr->ifa_address.len;
}
#ifdef IPMIP_USE_INET
/* Read the prefix list allowed for this interface */
if (!ipmip_sysvar_inet(0, &ife->ifaddr_v4, IP_NULL, "ipmip6ha.interface.%s.inet.homeagent", ife->ipmip6.iff.ifname))
{
Ipmip6_if_inet_t *ifaddr;
/* No address found; resolve from interface */
ifaddr = IPCOM_LIST_FIRST(&ife->ipmip6.inet);
if (ifaddr)
ife->ifaddr_v4 = ifaddr->ifa_address;
}
ife->AcceptForcedIPv4UDPEncapsulationRequest = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.inet.AcceptForcedIPv4UDPEncapsulationRequest"), "ipmip6ha.interface.%s.inet.AcceptForcedIPv4UDPEncapsulationRequest", ife->ipmip6.iff.ifname);
ife->ForceIPv4UDPEncapsulation = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6ha.inet.ForceIPv4UDPEncapsulation"), "ipmip6ha.interface.%s.inet.ForceIPv4UDPEncapsulation", ife->ipmip6.iff.ifname);
ife->IPv4UDPEncapsulationNATTimeout = ipmip_sysvar_u32(ipmip_sysvar_u32(IPMIP6_NATKATIMEOUT, "ipmip6ha.inet.IPv4UDPEncapsulationNATTimeout"), "ipmip6ha.interface.%s.inet.IPv4UDPEncapsulationNATTimeout", ife->ipmip6.iff.ifname);
#endif
/**/
ife->AcceptUDPTLVEncapsulation = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.AcceptUDPTLVEncapsulation"), "ipmip6ha.interface.%s.AcceptUDPTLVEncapsulation", ife->ipmip6.iff.ifname);
/* SETUP THE IFTABLES */
ife->iftables.pending = ipmip_util_route_table_alloc(&ctx->ipmip6.ipmip, proc);
/* Add the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_NEWRULE,
ife->iftables.pending,
IPMIP6HA_ROUTE_PRIORITY_PENDING,
0,
&ife->ifaddr.prefix,
128,
&ip_in6addr_any,
0,
0,
0);
ife->iftables.route_optimize = ipmip_util_route_table_alloc(&ctx->ipmip6.ipmip, proc);
/* Add the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_NEWRULE,
ife->iftables.route_optimize,
IPMIP6HA_ROUTE_PRIORITY_RO,
0,
&ife->ifaddr.prefix,
128,
&ip_in6addr_any,
0,
0,
0);
ife->iftables.tunnel = ipmip_util_route_table_alloc(&ctx->ipmip6.ipmip, proc);
#ifdef IPMIP_USE_INET
/* Add the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET,
IP_RTM_NEWRULE,
ife->iftables.tunnel,
IPMIP6HA_ROUTE_PRIORITY_FORWARD,
ife->ipmip6.iff.ifindex,
&ip_inaddr_any,
0,
&ip_inaddr_any,
0,
0,
0);
/* Add the policy rule */
if (ife->ifaddr_v4)
{
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET,
IP_RTM_NEWRULE,
ife->iftables.tunnel,
IPMIP6HA_ROUTE_PRIORITY_FORWARD,
0,
&ife->ifaddr_v4,
32,
&ip_inaddr_any,
0,
0,
0);
}
#endif
/* Add the policy rule */
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
proc,
IP_AF_INET6,
IP_RTM_NEWRULE,
ife->iftables.tunnel,
IPMIP6HA_ROUTE_PRIORITY_FORWARD,
ife->ipmip6.iff.ifindex,
&ip_in6addr_any,
0,
&ip_in6addr_any,
0,
0,
0);
/* Join DHAAD */
ipmip6_icmp_mc_anycast_address(&ctx->ipmip6, proc, IP_TRUE, &ife->ipmip6, &ife->ifaddr, 126);
#ifdef IPMIP_USE_INET
if (ife->ifaddr_v4 != 0)
{
ife->ifenabled_P[IPMIP_TUNNELTYPE_GRE] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.LMA.inet.tunnel.gre"), "ipmip6ha.interface.%s.LMA.inet.tunnel.gre", ife->ipmip6.iff.ifname);
ife->ifenabled_P[IPMIP_TUNNELTYPE_IPIP] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.LMA.inet.tunnel.ipip"), "ipmip6ha.interface.%s.LMA.inet.tunnel.ipip", ife->ipmip6.iff.ifname);
ife->ifenabled_H[IPMIP_TUNNELTYPE_IPIP] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.inet.tunnel.ipip"), "ipmip6ha.interface.%s.inet.tunnel.ipip", ife->ipmip6.iff.ifname);
/* IPIP allowed */
if (ife->ifenabled_P[IPMIP_TUNNELTYPE_GRE] || ife->ifenabled_P[IPMIP_TUNNELTYPE_IPIP] || ife->ifenabled_H[IPMIP_TUNNELTYPE_IPIP])
ife->iftunnels[IPMIP_TUNNELTYPE_IPIP] = ipmip6ha_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_IPIP, IP_AF_INET, &ife->ifaddr_v4, 32, ife->ipmip6.iff.ifindex);
if (ife->ifenabled_P[IPMIP_TUNNELTYPE_GRE])
ife->iftunnels[IPMIP_TUNNELTYPE_GRE] = ipmip6ha_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_GRE, IP_AF_INET, &ife->ifaddr_v4, 32, ife->ipmip6.iff.ifindex);
}
#endif
/* GRE allowed? */
ife->ifenabled_H[IPMIP_TUNNELTYPE_IP6IP6] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.tunnel.ip6ip6"), "ipmip6ha.interface.%s.tunnel.ip6ip6", ife->ipmip6.iff.ifname);
ife->ifenabled_P[IPMIP_TUNNELTYPE_IP6IP6] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.LMA.tunnel.ip6ip6"), "ipmip6ha.interface.%s.LMA.tunnel.ip6ip6", ife->ipmip6.iff.ifname);
ife->ifenabled_P[IPMIP_TUNNELTYPE_GRE6] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6ha.LMA.tunnel.gre"), "ipmip6ha.interface.%s.LMA.tunnel.gre", ife->ipmip6.iff.ifname);
if (ife->ifenabled_H[IPMIP_TUNNELTYPE_IP6IP6] || ife->ifenabled_P[IPMIP_TUNNELTYPE_IP6IP6])
ife->iftunnels[IPMIP_TUNNELTYPE_IP6IP6] = ipmip6ha_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_IP6IP6, IP_AF_INET6, &ife->ifaddr.prefix, 128, ife->ipmip6.iff.ifindex);
if (ife->ifenabled_P[IPMIP_TUNNELTYPE_GRE6])
ife->iftunnels[IPMIP_TUNNELTYPE_GRE6] = ipmip6ha_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_GRE6, IP_AF_INET6, &ife->ifaddr.prefix, 128, ife->ipmip6.iff.ifindex);
/**/
for (si = 0; si < ctx->extensions_num; si++)
{
if (ctx->extensions[si]->config_ifp != IP_NULL)
{
if (ctx->extensions[si]->ifp_data_size)
{
ife->extdata[si] = ipcom_calloc(1, ctx->extensions[si]->ifp_data_size);
(*ctx->extensions[si]->config_ifp) (ctx, proc, IPMIP_CALLBACK_CONFIG_READ, ife, ctx->extdata[si], ife->extdata[si], IP_NULL);
}
}
}
ipcom_snprintf(initfmt, sizeof(initfmt), "ipmip6ha.interface.%s", ife->ipmip6.iff.ifname);
ipmip6ha_nemo_configure(ctx, proc, &ife->nemo, ife->ipmip6.iff.ifname);
/**/
ipmip6ha_mag_configure(ctx, proc, ife);
return IP_TRUE;
}
/*
*===========================================================================
* ipmip6mn_route_tunnel_create
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC Ip_bool
ipmip6ha_if_create(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_notify_t *notify)
{
Ipmip_timer_lock_t *lock;
/* Attach to the IFP */
ipmip6_if_attach(&ctx->ipmip6,
proc,
sizeof(struct Ipmip6ha_if),
notify,
(Ipmip_if_cleanup_t)ipmip6ha_if_cleanup);
lock = notify->ifp->iff_lock;
/**/
if (!ipmip6ha_if_setup(ctx, proc, (Ipmip6ha_if_t*)notify->ifp))
{
ipmip6_if_detach_iflocked(&ctx->ipmip6, proc, notify);
notify->ifp = IP_NULL;
}
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
return notify->ifp != IP_NULL;
}
/*
*===========================================================================
* ipmip6mn_event_handler
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_STATIC int
ipmip6ha_if_event_handler(int event,
Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
void *ifn,
void *unused)
{
IPMIP_UNUSED_PARAMETER(unused);
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ifn);
IPMIP_UNUSED_PARAMETER(unused);
/* Event on this particular interface */
if (event == IPMIP_TIMER_EVENT_RUN)
{
}
return IPMIP_TIMER_RET_DONE;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6mn_route_tunnel_create
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_GLOBAL void
ipmip6ha_if_unconfigure(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
Ipmip6ha_if_notify_t *notify;
/* Clear any old interfaces */
while ((notify = IPCOM_LIST_FIRST(&ctx->ifs)) != IP_NULL)
{
Ipmip_timer_lock_t *lock;
lock = ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, notify->ipmip6.ifp->iff_lock);
ipmip6_if_detach_iflocked(&ctx->ipmip6, proc, &notify->ipmip6);
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
ipcom_list_remove(&notify->next);
ipcom_free(notify);
}
}
/*
*===========================================================================
* ipmip6mn_route_tunnel_create
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_GLOBAL void
ipmip6ha_if_configure(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
Ip_u8 *dptr, *ptr;
/* Find all interfaces */
dptr = ipmip_sysvar_strlist("ipmip6ha.interfaces");
if (dptr == IP_NULL || *dptr == 0)
{
IPCOM_LOG0(ERR, "ipmip6ha_if_configure() failed : invalid/missing \"ipmip6ha.interfaces\"");
goto fail;
}
ptr = dptr + 1;
while (*ptr != 0)
{
Ipmip6ha_if_notify_t *notify = ipcom_calloc(1, sizeof(*notify));
ipcom_strcpy(notify->ipmip6.ifname, (char *)(ptr + 1));
notify->ipmip6.opaque = notify;
notify->ipmip6.func = (Ipmip_timer_func_t)ipmip6ha_if_event_handler;
notify->ipmip6.lock = ctx->ifs_lock;
if (!ipmip6ha_if_create(ctx, proc, &notify->ipmip6))
{
/* Just log for notifications sake */
IPMIP6_EVENT_IF(WARNING, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"unable to configure interface \"%s\"",
(char *)(ptr + 1)));
ipcom_free(notify);
}
else
{
/**/
ipcom_list_insert_last(&ctx->ifs, &notify->next);
}
/* Go to next item */
ptr += *ptr;
}
fail:
if (dptr)
ipcom_free(dptr);
}
IP_GLOBAL Ipmip6ha_if_t *
ipmip6ha_if_findbypktinfo(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_pktbuf_pktinfo *dst)
{
Ipmip6ha_if_notify_t *notify;
IPMIP_UNUSED_PARAMETER(proc);
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6ha_if_t *ifp = (Ipmip6ha_if_t *)notify->ipmip6.ifp;
if (ifp->ipmip6.iff.ifindex == dst->ifindex)
return ifp;
}
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6ha_if_t *ifp = (Ipmip6ha_if_t *)notify->ipmip6.ifp;
if (IP_IN6_ARE_ADDR_EQUAL(&ifp->ifaddr.prefix, &dst->dst.sin6.sin6_addr))
return ifp;
}
return IP_NULL;
}
IP_GLOBAL Ipmip6ha_if_t *
ipmip6ha_if_findbyname(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
const char *name)
{
Ipmip6ha_if_notify_t *notify;
IPMIP_UNUSED_PARAMETER(proc);
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6ha_if_t *ifp = (Ipmip6ha_if_t *)notify->ipmip6.ifp;
if (ipcom_strcasecmp(name, ifp->ipmip6.iff.ifname) == 0)
return ifp;
}
return IP_NULL;
}
IP_GLOBAL Ipmip6ha_if_t *
ipmip6ha_if_findbyifindex(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 ifindex)
{
Ipmip6ha_if_notify_t *notify;
IPMIP_UNUSED_PARAMETER(proc);
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(&notify->next))
{
Ipmip6ha_if_t *ifp = (Ipmip6ha_if_t *)notify->ipmip6.ifp;
if (ifindex == ifp->ipmip6.iff.ifindex)
return ifp;
}
return IP_NULL;
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,184 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_if.h,v $ $Revision: 1.15 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_if.h,v $
* $Author: jhorteli $ $Date: 2009-12-02 15:33:16 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_IF_H
#define IPMIP6HA_IF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_rtab.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip6ha_node;
struct Ipmip_pktbuf_pktinfo;
struct Ipmip6ha_pktbuf;
struct Ipmip6ha_nemo_context;
typedef struct Ipmip6ha_if_notify
{
Ipcom_list next;
Ipmip6_if_notify_t ipmip6;
} Ipmip6ha_if_notify_t;
typedef struct Ipmip6ha_if
{
Ipmip6_if_t ipmip6;
/* Home agent specific configuration */
Ipmip6_address_t ifaddr;
#ifdef IPMIP_USE_INET
Ip_u32 ifaddr_v4;
Ip_bool AcceptForcedIPv4UDPEncapsulationRequest;
Ip_bool ForceIPv4UDPEncapsulation;
Ip_u32 IPv4UDPEncapsulationNATTimeout;
#endif
Ip_bool AcceptUDPTLVEncapsulation;
/**/
Ip_bool ifenabled_P[IPMIP_TUNNELTYPE_MAX + 1];
Ip_bool ifenabled_H[IPMIP_TUNNELTYPE_MAX + 1];
struct Ipmip6ha_if *iftunnels[IPMIP_TUNNELTYPE_MAX + 1];
Ip_u16 lifetime;
Ip_u16 refresh;
Ip_u32 BRIMaxRetriesNumber;
Ip_u32 MINDelayBRIs;
Ip_u32 MinDelayBeforeBCEDelete;
Ip_u32 MaxDelayBeforeNewBCEAssign;
Ip_u32 TimestampValidityWindow;
struct Ip_timeval TimestampValidityWindow_tv;
Ip_bool TimestampBasedApproachInUse;
Ip_bool MobileNodeGeneratedTimestampInUse;
Ip_bool AlwaysVerifyTunnelSrc;
Ip_bool FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO;
Ipmip6_address_t FixedMAGLinkLocalAddressOnAllAccessLinks;
Ip_bool RelayBindings;
Ip_u32 HeartBeatInterval;
Ip_u32 HeartBeatMissAllowed;
Ip_bool HeartBeatEnabled;
Ip_bool BindingRevocationEnabled;
/* Contains the current MAG's */
Ipcom_hash *mag_table;
struct Ipmip6ha_nemo_context *nemo;
Ipcom_hash *node_name;
Ipcom_hash *node_addr;
struct
{
Ip_u32 pending;
Ip_u32 route_optimize;
Ip_u32 tunnel;
Ip_u32 forward;
} iftables;
/* */
Ipcom_route *prefixes;
void *extdata[32];
void *extensions[32];
} Ipmip6ha_if_t;
typedef struct Ipmip6ha_if_route_entry
{
Ipmip_route_t ipmip;
/* Key & Mask */
struct Ip_in6_addr subnet;
struct Ip_in6_addr mask;
Ip_u8 mask_len;
Ip_u32 refcnt;
/**/
Ip_time_t valid;
Ip_time_t timestamp;
Ipmip6ha_if_t *ifp;
} Ipmip6ha_if_route_entry_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6ha_if_configure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6ha_if_unconfigure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL Ipmip6ha_if_t *ipmip6ha_if_findbypktinfo(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_pktbuf_pktinfo *dst);
IP_GLOBAL Ipmip6ha_if_t *ipmip6ha_if_findbyname(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
const char *name);
IP_GLOBAL Ipmip6ha_if_t *ipmip6ha_if_findbyifindex(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 ifindex);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,355 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_ifevent.c,v $ $Revision: 1.12 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_ifevent.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_err.h>
#include <ipcom_sysvar.h>
#include <ipcom_syslog.h>
#include <ipcom_shell.h>
#include <ipmip.h>
#include <private/ipmip_timer.h>
#include <private/ipmip_util.h>
#include <ipmip6.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_netlink.h>
#include <private/ipmip6_icmp_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha_h.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_attr_h.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
IP_STATIC void ipmip6ha_ifevent_router_new(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router);
IP_STATIC void ipmip6ha_ifevent_router_expire(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router);
IP_STATIC void ipmip6ha_ifevent_prefix_new(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife,
Ipmip6_if_prefix_t *prefix);
IP_STATIC void ipmip6ha_ifevent_prefix_expire(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife,
Ipmip6_if_prefix_t *prefix);
IP_STATIC void ipmip6ha_ifevent_prefix_advertise(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix);
IP_STATIC void ipmip6ha_ifevent_prefix_update(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife,
Ipmip6_if_prefix_t *prefix);
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
Ipmip6_if_event_table_t ipmip6ha_ifevent_table =
{
(Ipmip6_if_event_t)IP_NULL,
(Ipmip6_if_event_t)IP_NULL,
(Ipmip6_if_event_t)ipmip6ha_ifevent_router_new,
(Ipmip6_if_event_t)ipmip6ha_ifevent_router_expire,
(Ipmip6_if_event_t)ipmip6ha_ifevent_prefix_new,
(Ipmip6_if_event_t)ipmip6ha_ifevent_prefix_expire,
(Ipmip6_if_event_t)ipmip6ha_ifevent_prefix_advertise,
(Ipmip6_if_event_t)ipmip6ha_ifevent_prefix_update
};
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC void
ipmip6ha_ifevent_router_new(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(router);
}
IP_STATIC void
ipmip6ha_ifevent_router_expire(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_router_t *router)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(router);
}
IP_STATIC void
ipmip6ha_ifevent_prefix_new(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
if (IP_BIT_ISSET(prefix->flags, IPMIP6_ND_OPT_PI_FLAG_ONLINK))
{
Ipmip6ha_if_route_entry_t *se;
struct Ip_in6_addr lkey;
ipmip6_address_create_prefix(&lkey, &prefix->prefix.prefix, prefix->prefix.len);
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
ipcom_mutex_lock(ctx->prefixes_lock);
/* Found, already in the table */
if ((se = (Ipmip6ha_if_route_entry_t *)ipmip_route_lookup_exact(ctx->prefixes, &lkey, prefix->prefix.len)) != IP_NULL)
{
if (se->ifp != ife)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"On-link prefix %s/%d seen on both %s and %s -- may cause problems",
ipmip_ntop_inet6(proc, &lkey, IP_NULL),
se->ifp->ipmip6.iff.ifname,
ife->ipmip6.iff.ifname));
/* Switch to last seen */
se->ifp = ife;
}
se->refcnt++;
}
else
{
se = ipcom_calloc(1, sizeof(*se));
if (se != IP_NULL)
{
ipmip_util_create_mask((Ip_u8 *)&se->mask, prefix->prefix.len);
ipmip6_address_create_prefix(&se->subnet, &prefix->prefix.prefix, prefix->prefix.len);
se->mask_len = prefix->prefix.len;
/* Create the entry */
se->ipmip.hdr.key = &se->subnet;
se->ipmip.hdr.mask = &se->mask;
/**/
se->refcnt = 1;
se->timestamp = prefix->stamp;
se->valid = prefix->valid;
se->ifp = ife;
if (ipmip_route_add(ctx->prefixes, &se->ipmip) != IPCOM_SUCCESS)
ipcom_free(se);
}
}
ipcom_mutex_unlock(ctx->prefixes_lock);
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Adding on-link prefix %s/%d@%s to configuration %s",
ipmip_ntop_inet6(proc, &lkey, IP_NULL),
prefix->prefix.len,
ipmip_ntop_inet6(proc, &prefix->router->addr, IP_NULL),
ife->ipmip6.iff.ifname));
}
}
IP_STATIC void
ipmip6ha_ifevent_prefix_expire(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
Ipmip6ha_if_route_entry_t *se;
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
if (IP_BIT_ISSET(prefix->flags, IPMIP6_ND_OPT_PI_FLAG_ONLINK))
{
struct Ip_in6_addr lkey;
ipmip6_address_create_prefix(&lkey, &prefix->prefix.prefix, prefix->prefix.len);
ipcom_mutex_lock(ctx->prefixes_lock);
/* Found, already in the table */
if ((se = (Ipmip6ha_if_route_entry_t *)ipmip_route_lookup_exact(ctx->prefixes, &prefix->prefix.prefix, prefix->prefix.len)) != IP_NULL)
{
if (--se->refcnt == 0)
ipmip_route_delete(ctx->prefixes, &se->ipmip);
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Removing on-link prefix %s/%d@%s from configuration %s",
ipmip_ntop_inet6(proc, &lkey, IP_NULL),
prefix->prefix.len,
ipmip_ntop_inet6(proc, &prefix->router->addr, IP_NULL),
ife->ipmip6.iff.ifname));
}
ipcom_mutex_unlock(ctx->prefixes_lock);
}
}
IP_STATIC void
ipmip6ha_ifevent_prefix_advertise(Ipmip6_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(ife);
IPMIP_UNUSED_PARAMETER(prefix);
/* ipmip6m_coa_advertise_prefix(prefix); */
}
IP_STATIC void
ipmip6ha_ifevent_prefix_update(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_if_t *ife,
Ipmip6_if_prefix_t *prefix)
{
Ipmip6ha_if_route_entry_t *se;
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
if (IP_BIT_ISSET(prefix->flags, IPMIP6_ND_OPT_PI_FLAG_ONLINK))
{
struct Ip_in6_addr lkey;
ipmip6_address_create_prefix(&lkey, &prefix->prefix.prefix, prefix->prefix.len);
ipcom_mutex_lock(ctx->prefixes_lock);
/* Found, already in the table */
if ((se = (Ipmip6ha_if_route_entry_t *)ipmip_route_lookup_exact(ctx->prefixes, &lkey, prefix->prefix.len)) != IP_NULL)
{
se->timestamp = prefix->stamp;
se->valid = prefix->valid;
se->ifp = ife;
#if 0
IPMIP6_EVENT_IF(DEBUG2, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Updating on-link prefix %s/%d@%s in configuration %s (%s - %d)",
ipmip_ntop_inet6(proc, &lkey, IP_NULL),
prefix->prefix.len,
ipmip_ntop_inet6(proc, &prefix->router->addr, IP_NULL),
ife->ipmip6.iff.ifname,
ipmip_ntop_time(proc, se->timestamp)));
#endif
}
else
{
IPMIP6_EVENT_IF(INFO, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"On-link prefix %s/%d@%s not found in configuration %s",
ipmip_ntop_inet6(proc, &lkey, IP_NULL),
prefix->prefix.len,
ipmip_ntop_inet6(proc, &prefix->router->addr, IP_NULL),
ife->ipmip6.iff.ifname));
}
ipcom_mutex_unlock(ctx->prefixes_lock);
}
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,69 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_ifevent.h,v $ $Revision: 1.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_ifevent.h,v $
* $Author: jhorteli $ $Date: 2008-05-21 12:49:06 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_IFEVENT_H
#define IPMIP6HA_IFEVENT_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
extern Ipmip6_if_event_table_t ipmip6ha_ifevent_table;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,160 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_mag.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_mag.h,v $
* $Author: jhorteli $ $Date: 2010-02-15 13:27:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_MAG_H
#define IPMIP6HA_MAG_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_MAG_CREATE (1 << 0)
#define IPMIP6HA_MAG_PERMANENT (1 << 1)
#define IPMIP6HA_MAG_HEARTBEAT_SEEN (1 << 0)
#define IPMIP6HA_MAG_HEARTBEAT_DISABLED (1 << 1)
#define IPMIP6HA_MAG_REVOCATION_SEEN (1 << 2)
#define IPMIP6HA_MAG_REVOCATION_DISABLED (1 << 3)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip6ha_if;
struct Ipmip6ha_pktbuf;
struct Ipmip_buffer;
union Ipmip6_mib_InetAddress;
typedef struct Ipmip6ha_mag
{
struct Ip_in6_addr endpoint;
Ipmip_timer_t timer;
Ip_u32 sequence;
Ip_u32 unacked;
Ip_u32 restart_counter;
Ip_bool have_restart_counter;
/**/
Ip_u32 references;
Ip_bool permanent;
Ip_u32 flags;
struct Ipmip6ha_if *ifp;
Ipcom_list bri;
/* If we've got a NAT */
union Ipmip6_mib_InetAddress tunnel_endpoint;
Ip_u32 tunnel_endpoint_type;
Ip_u16 port;
} Ipmip6ha_mag_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL Ipmip6ha_mag_t *ipmip6ha_mag_get(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ifp,
struct Ip_in6_addr *endpoint,
unsigned flags);
IP_GLOBAL void ipmip6ha_mag_release(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_mag_t *mag);
IP_GLOBAL void ipmip6ha_mag_reference(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_mag_t *mag);
IP_GLOBAL void ipmip6ha_mag_set_tunnel(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_mag_t *mag,
union Ipmip6_mib_InetAddress *tunnel_endpoint,
Ip_u32 tunnel_endpoint_type,
Ip_u16 port);
IP_GLOBAL void ipmip6ha_mag_configure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ifp);
IP_GLOBAL void ipmip6ha_mag_unconfigure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ifp);
IP_GLOBAL void ipmip6ha_mag_configure_dump(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ife,
struct Ipmip_buffer *buffer);
IP_GLOBAL Ip_bool ipmip6ha_mag_heartbeat_input(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_pktbuf *pbuf);
IP_GLOBAL Ip_bool ipmip6ha_mag_binding_error_input(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_pktbuf *pbuf,
Ipmip6ha_mag_t *mag);
IP_GLOBAL void ipmip6ha_mag_attr_get(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ife,
struct Ipmip_buffer *buffer);
IP_GLOBAL void ipmip6ha_mag_revoke(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_mag_t *mag,
Ip_u8 reason,
const char *match);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,657 @@
/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_main.c,v $ $Revision: 1.8 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_main.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6ha_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_ipd.h>
#include <ipcom_syslog.h>
#include <ipmip.h>
#include <private/ipmip_util.h>
#include <private/ipmip_dhcp.h>
#include <private/ipmip_dhcp6.h>
#include <private/ipmip_sysvar.h>
#include <ipmip6.h>
#include <private/ipmip6_context.h>
#include <private/ipmip6_pkt.h>
#include <private/ipmip6_if.h>
#include <private/ipmip6_mh.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6ha.h"
#include "ipmip6ha_h.h"
#include "ipmip6ha_node.h"
#include "ipmip6ha_nemo.h"
#include "ipmip6ha_attr_h.h"
#include "ipmip6ha_cli.h"
#include "ipmip6ha_ifevent.h"
#include "ipmip6ha_mh.h"
#include "ipmip6ha_icmp.h"
#include "ipmip6ha_if.h"
#include "ipmip6ha_route.h"
#include "ipmip6ha_pktbuf.h"
#include "ipmip6ha_mag.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
IP_PUBLIC Ip_err ipmip6ha_exit(void);
IP_PUBLIC Ip_err ipmip6ha_init(void);
IP_PUBLIC Ip_err ipmip6ha_start(void);
IP_PUBLIC const char *ipmip6ha_version(void);
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
static int ipmip6ha_instances = 0;
/* Dispatch function callbacks */
static Ipmip6_pkt_context_dispatch_t ipmip6ha_dispatch_table =
{
(Ipmip6_pkt_dispatch_t)ipmip6ha_mh_dispatch,
(Ipmip6_pkt_dispatch_t)ipmip6ha_icmp_dispatch
};
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
IP_STATIC unsigned
ipmip6ha_relay_nai_obj_hash(Ipmip6ha_relay_key_t *obj)
{
return ipcom_hash_update(obj->nai, (int)obj->nai_len, 0);
}
IP_STATIC Ip_bool
ipmip6ha_relay_nai_key_cmp(Ipmip6ha_relay_key_t *obj,
Ipmip6ha_relay_key_t *key)
{
/**/
return ipmip_util_strnncmp(obj->nai, obj->nai_len, key->nai, key->nai_len);
}
IP_STATIC void
ipmip6ha_relay_map_sysvar_nai_foreach(struct Ipmip_proc *proc,
char *name,
char *subkey,
const char *value,
Ipmip6ha_context_t *ctx)
{
Ipmip6ha_relay_key_t *nkey;
Ip_size_t slen = ipcom_strlen(subkey);
Ipmip6ha_if_t *ifp = ipmip6ha_if_findbyname(ctx, proc, value);
if (ifp == IP_NULL)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to allocate to MAP %s to %s -- no such interface",
subkey, value));
return;
}
IPMIP_UNUSED_PARAMETER(name);
nkey = ipcom_calloc(1, sizeof(*nkey) + slen + 1);
if (!nkey)
{
IPMIP6_EVENT_IF(ERR, proc,
ipmip_log_event_add(&ctx->ipmip6.ipmip,
proc,
"Unable to allocate NAI entry"));
return;
}
nkey->nai = (char *)(nkey + 1);
ipcom_strcpy(nkey->nai, subkey);
nkey->nai_len = slen;
nkey->ifp = ifp;
/* Overload? */
ipcom_hash_add(ctx->relay_map, nkey);
}
IP_STATIC void
ipmip6ha_configure_relay_map(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
ipmip_sysvar_foreach(proc,
(Ipmip_sysvar_foreach_t) ipmip6ha_relay_map_sysvar_nai_foreach,
ctx,
"ipmip6ha.relay_map.*");
}
IP_STATIC void
ipmip6ha_unconfigure_relay_map_cb(Ipmip6ha_relay_key_t *obj,
Ipcom_hash *htable)
{
ipcom_hash_remove(htable, obj);
ipcom_free(obj);
}
IP_STATIC void
ipmip6ha_unconfigure_relay_map(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
IPMIP_UNUSED_PARAMETER(proc);
ipcom_hash_for_each(ctx->relay_map, (Ipcom_hash_foreach_cb_func)ipmip6ha_unconfigure_relay_map_cb, ctx->relay_map);
}
IP_STATIC void
ipmip6ha_dump_relay_map_cb(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip6ha_relay_key_t *obj,
Ipmip_buffer_t *buffer,
void *unused)
{
IPMIP_UNUSED_PARAMETER(ctx);
IPMIP_UNUSED_PARAMETER(proc);
IPMIP_UNUSED_PARAMETER(unused);
ipmip_cli_config_printf(buffer,
"ipmip6ha.relay_map.%s=%s",
obj->nai, obj->ifp->ipmip6.iff.ifname);
}
IP_STATIC void
ipmip6ha_services_clear(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
unsigned si;
for (si = 0; si < ctx->extensions_num; si++)
{
if (ctx->extensions[si]->config_global != IP_NULL && ctx->extdata[si] != IP_NULL)
{
(*ctx->extensions[si]->config_global) (ctx, proc, IPMIP_CALLBACK_CONFIG_FREE, ctx->extdata[si], IP_NULL);
ipcom_free(ctx->extdata[si]);
ctx->extdata[si] = IP_NULL;
}
}
}
IP_STATIC void
ipmip6ha_services_read(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
unsigned si;
for (si = 0; si < ctx->extensions_num; si++)
{
if (ctx->extensions[si]->config_global != IP_NULL && ctx->extensions[si]->global_data_size)
{
ctx->extdata[si] = ipcom_calloc(1, ctx->extensions[si]->global_data_size);
(*ctx->extensions[si]->config_global) (ctx, proc, IPMIP_CALLBACK_CONFIG_READ, ctx->extdata[si], IP_NULL);
}
}
}
/*
*===========================================================================
* ipmipha_config_init
*===========================================================================
* Description: Initialize the configuration for the specified instance
* Parameters: instance - The HA instance
* Returns: 0 on success
*
*/
IP_STATIC int
ipmip6ha_update_config(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
ipmip6_pkt_context_stop(&ctx->ipmip6, proc);
/* Free all mobile nodes */
ipmip6ha_node_clear(ctx, proc);
/* Stop the current context */
ipmip6_context_stop(&ctx->ipmip6, proc);
/* Clear global service config */
ipmip6ha_services_clear(ctx, proc);
#ifdef IPMIP_USE_INET
ipmip_dhcp_context_destroy(&ctx->ipmip6.ipmip, proc);
#endif
ipmip6ha_unconfigure_relay_map(ctx, proc);
/* Unconfigure IF */
ipmip6ha_if_unconfigure(ctx, proc);
/* Restart Counter */
ipmip6_context_restart_counter_update(&ctx->ipmip6, proc);
/* Clear global service config */
ipmip6ha_services_read(ctx, proc);
if (ctx->prefixes != IP_NULL)
ipcom_route_free_table(ctx->prefixes);
ctx->prefixes = ipcom_route_new_table(sizeof(struct Ip_in6_addr) * 8,
(Ipcom_route_notify_func) ipmip_route_notify);
/* Re-read them */
ipmip6ha_if_configure(ctx, proc);
/* Configure relay map */
ipmip6ha_configure_relay_map(ctx, proc);
/**/
ipmip6_context_start(&ctx->ipmip6, proc);
return 0;
}
/*
*===========================================================================
* ipmip6mn_destroy
*===========================================================================
* Description: Shutdown the mobile node portion of the context.
* Parameters: ctx - The MIP6 context.
* Returns:
*
*/
IP_STATIC void
ipmip6ha_context_destroy(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
/* Only if we actually got a context. */
if (ctx != IP_NULL)
{
/* Stop the packet context; for starters */
ipmip6_pkt_context_stop(&ctx->ipmip6, proc);
/* Destroy the entries that has been removed */
ipmip6ha_node_clear(ctx, proc);
/* Stop the rest */
ipmip6_context_stop(&ctx->ipmip6, proc);
/**/
ipmip6ha_unconfigure_relay_map(ctx, proc);
ipmip6ha_if_unconfigure(ctx, proc);
ipmip6ha_nemo_unconfigure(ctx, proc, ctx->nemo);
ipmip6ha_services_clear(ctx, proc);
/* Close the IPD */
if (ctx->fd_ipd == IP_INVALID_SOCKET)
(void)ipcom_ipd_init("ipmip6ha", IPCOM_ERR_FAILED, &ctx->fd_ipd);
ipcom_hash_delete(ctx->relay_map);
/**/
ipcom_ipd_exit("ipmip6ha", ctx->fd_ipd);
/**/
ipmip_timer_lock_destroy(&ctx->ipmip6.ipmip, proc, ctx->ifs_lock);
/* Free the lock */
ipmip6ha_nemo_context_destroy(ctx, proc);
ipcom_mutex_delete(&ctx->prefixes_lock);
ipmip6ha_route_context_destroy(ctx, proc);
/* Free the identity contexts */
ipmip_context_id_destroy(ctx->idents);
ipmip_context_id_destroy(ctx->bri);
/* Shutdown the 'mip6' context */
ipmip6_context_destroy(&ctx->ipmip6, proc);
}
}
/*
*===========================================================================
* ipmip6ha_context_allocate
*===========================================================================
* Description: Initialize the mobile node portion of the context.
* Parameters: ctx - The MIP6 context.
* Returns:
*
*/
IP_STATIC Ipmip6ha_context_t *
ipmip6ha_context_allocate(Ipmip_proc_t *proc)
{
Ipmip6ha_context_t *ctx = (Ipmip6ha_context_t *)ipmip_context_alloc(proc, sizeof(*ctx), "ipmip6ha", IPMIP6_SYSTEM_PRIORITY, IPMIP6HA_EVENT_BACKLOG);
int i;
/* */
if (ctx == IP_NULL)
return IP_NULL;
/* For LAS */
ipmip_dhcp6_embedded_server_init(&ctx->ipmip6.ipmip, proc);
ipmip6ha_route_context_init(ctx, proc);
/* Initialize */
ipmip6ha_nemo_context_init(ctx, proc);
ipcom_list_init(&ctx->ifs);
ipcom_mutex_create(&ctx->prefixes_lock);
ctx->ifs_lock = ipmip_timer_lock_alloc(&ctx->ipmip6.ipmip, proc, IP_NULL, IP_NULL);
ctx->idents = ipmip_context_id_create(ip_offsetof(Ipmip6ha_node_t, identity), 0xFFFFFFFF);
ctx->bri = ipmip_context_id_create(ip_offsetof(Ipmip6ha_br_t, sequence), 0x0000FFFF);
/* Initialize the global information */
if (ipmip6_context_initialize(&ctx->ipmip6,
proc,
&ipmip6ha_ifevent_table) == IP_FALSE)
goto failure;
/* Server side; don't do solicitations */
ctx->ipmip6.iff.no_solicitation = IP_TRUE;
/**/
ctx->relay_map = ipcom_hash_new((Ipcom_hash_obj_func) ipmip6ha_relay_nai_obj_hash,
(Ipcom_hash_key_func) ipmip6ha_relay_nai_obj_hash,
(Ipcom_hash_cmp_func) ipmip6ha_relay_nai_key_cmp);
if (ipmip6_pkt_context_create(&ctx->ipmip6,
proc,
&ipmip6ha_dispatch_table,
IPMIP6_DSMIP_UDP_PORT,
(Ipmip_pkt_buf_alloc_t)ipmip6ha_pktbuf_alloc,
(Ipmip_pkt_buf_free_t)ipmip6ha_pktbuf_free) == IP_FALSE)
{
IPCOM_LOG0(ERR, "Unable to create IPMIP6HA Packet Context");
goto failure;
}
ipmip_cli_context_create(&ctx->ipmip6.ipmip,
proc,
"ipmip6ha",
IPCOM_IPD_ID_IPMIP6HA,
(Ipmip_cli_callback_t)ipmip6ha_attr_command);
/* IPD init */
if (ipcom_ipd_init("ipmip6ha", IPCOM_SUCCESS, &ctx->fd_ipd) != IPCOM_SUCCESS)
{
IPCOM_LOG1(ERR, "Unable to create IPMIP6MN IPD pipe = %d", ipcom_errno);
goto failure;
}
(void) ipcom_inet_pton(IP_AF_INET6, "FE80::", &ctx->link_local_prefix);
for (i = 0; ipmip6ha_service_registrations[i] != IP_NULL; i++)
(*ipmip6ha_service_registrations[i]) (ctx);
/* Update configuration */
ipmip6ha_update_config(ctx, proc);
/* Return the mobile node instance */
return ctx;
failure:
ipmip6ha_context_destroy(ctx, proc);
return IP_NULL;
}
/*
*===========================================================================
* ipmipha_data_process
*===========================================================================
* Description: Process any file descriptors set by the platform.
* Parameters: data - The data structure
* rset - The read set.
* Returns: IP_FALSE if we should exit the process.
*
*/
IP_STATIC Ip_bool
ipmip6ha_ipd_process(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc)
{
/* IPD input. */
int event;
Ip_ssize_t len;
Ipmip6ha_pktbuf_t *pbuf = (Ipmip6ha_pktbuf_t *)ipmip_pktbuf_alloc(&ctx->ipmip6.ipmip, proc, 512);
if (pbuf == IP_NULL)
return IP_TRUE;
len = ipcom_ipd_read(ctx->fd_ipd, IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet), 512, &event);
if (len < 0)
{
IPCOM_LOG2(ERR, "ipcom_socketread(IPD) failed : %s [%d]",
ipcom_strerror(ipcom_errno), ipcom_errno);
ipmip_util_sock_clear(ctx->fd_ipd);
}
else
{
/* Advance past */
ipmip_buffer_append(&pbuf->ipmip6.ipmip.packet, IP_NULL, (Ip_size_t)len);
switch (event)
{
case IPCOM_IPD_EVENT_RECONFIGURE:
IPCOM_LOG0(INFO, "Received IPD reconfigure message");
ipmip6ha_update_config(ctx, proc);
break;
case IPCOM_IPD_EVENT_KILL:
IPCOM_LOG0(INFO, "Received IPD kill message");
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
return IP_FALSE;
default:
/* Ignore all other IPD messages */
break;
}
}
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
return IP_TRUE;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void
ipmip6ha_main(void)
{
int num;
int max_fd;
Ipmip6ha_context_t *ctx = IP_NULL;
Ipmip_proc_t *proc;
ipcom_proc_init();
proc = ipmip_proc_alloc();
IPCOM_LOG0(INFO,
"ipmip6ha: starting");
/* Init the configuration */
if (ipmip6ha_configure() != IPCOM_SUCCESS)
goto done;
/* Init IPMIP6MN */
if ((ctx = ipmip6ha_context_allocate(proc)) == IP_NULL)
goto done;
if (ipmip6ha_instances++ == 0)
if (ipmip6ha_init() != IPCOM_SUCCESS)
goto end;
for (;;)
{
Ip_fd_set read_set;
IP_FD_ZERO(&read_set);
/* Set the IPD */
max_fd = ctx->fd_ipd;
IP_FD_SET(ctx->fd_ipd, &read_set);
/* Select */
num = ipcom_socketselect(max_fd + 1, &read_set, IP_NULL, IP_NULL, IP_NULL);
switch(num)
{
case -1: /* socket error. */
IPCOM_LOG2(WARNING, "ipcom_socketselect() failed : %s [%d]", ipcom_strerror(ipcom_errno), ipcom_errno);
(void)ipcom_sleep(1);
break;
case 0: /* timeout, not used. triggered by bug in linux glibc if compiled with nptl */
(void)ipcom_millisleep(1);
break;
default:
/* Process IPD */
if (IP_FD_ISSET(ctx->fd_ipd, &read_set))
{
if (ipmip6ha_ipd_process(ctx, proc) == IP_FALSE)
goto end;
}
}
}
end:
ipmip6ha_context_destroy(ctx, proc);
/**/
if (--ipmip6ha_instances == 0)
ipmip6ha_exit();
done:
/* Free the context process */
ipmip_proc_destroy(proc);
IPCOM_LOG0(NOTICE,
"ipmip6ha: ending");
ipcom_proc_exit();
}
IP_GLOBAL Ip_u32
ipmip6ha_context_register_extension(Ipmip6ha_context_t *ctx,
Ipmip6ha_extension_t *srv,
Ip_bool reg_H,
Ip_bool reg_P)
{
srv->type = ctx->extensions_num++;
ctx->extensions[srv->type] = srv;
if (reg_H)
{
ctx->extensions_H_mask |= (1 << srv->type);
ctx->extensions_node_H_data += srv->node_data_size;
}
if (reg_P)
{
ctx->extensions_P_mask |= (1 << srv->type);
ctx->extensions_node_P_data += srv->node_data_size;
}
return srv->type;
}
IP_GLOBAL void
ipmip6ha_dump_relay_map(Ipmip6ha_context_t *ctx,
Ipmip_proc_t *proc,
Ipmip_buffer_t *buffer)
{
ipmip_util_hash_foreach(&ctx->ipmip6.ipmip,
proc,
ctx->relay_map,
(Ipmip_util_hash_foreach_t)ipmip6ha_dump_relay_map_cb,
buffer,
IP_NULL);
}
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,88 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_mh.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_mh.h,v $
* $Author: jhorteli $ $Date: 2009-06-18 12:53:11 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_MH_H
#define IPMIP6HA_MH_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip6ha_pktbuf;
struct Ipmip6ha_br;
struct Ipmip6ha_node;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL Ip_bool ipmip6ha_mh_dispatch(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_pktbuf *pbuf);
IP_GLOBAL Ip_bool ipmip6ha_mh_bri_send(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
struct Ipmip6ha_br *br);
IP_GLOBAL Ip_bool ipmip6ha_mh_bra_send(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_pktbuf *pbuf,
Ip_u8 status);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,178 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_nemo.h,v $ $Revision: 1.9 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_nemo.h,v $
* $Author: jhorteli $ $Date: 2009-02-25 14:33:56 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_NEMO_H
#define IPMIP6HA_NEMO_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipmip6ha_nemo_dsmipv6.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_NEMO_ACL_DELETED (1 << 0)
#define IPMIP6HA_NEMO_ACL_ADDED (1 << 1)
#define IPMIP6HA_NEMO_ACL_ROUTE (1 << 2)
#define IPMIP6HA_NEMO_ACL_HOA_PROXY (1 << 3)
#define IPMIP6HA_NEMO_ACL_STATIC (1 << 4)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_node;
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip_buffer;
typedef struct Ipmip6ha_nemo_pool_slice
{
Ipcom_list next;
struct Ip_in6_addr prefix;
Ip_u8 prefix_length;
Ip_u8 addr_bit;
Ip_u64 addr_hi;
Ip_u64 addr_hi_mask;
Ip_u64 addr_lo;
Ip_u64 addr_lo_mask;
} Ipmip6ha_nemo_pool_slice_t;
typedef struct Ipmip6ha_nemo_pool
{
Ipcom_list slices;
struct Ipmip6ha_nemo_pool *npool;
const char *pool_name;
Ip_size_t pool_name_size;
} Ipmip6ha_nemo_pool_t;
typedef struct Ipmip6ha_nemo
{
Ipcom_list next;
struct Ipmip6ha_nemo *acl_next;
struct Ip_in6_addr prefix;
Ip_u8 len;
Ip_u8 flags;
} Ipmip6ha_nemo_t;
typedef struct Ipmip6ha_nemo_acl
{
Ipmip6ha_nemo_pool_t *pool;
Ipmip6ha_nemo_t *nemo;
Ip_size_t limit;
Ip_bool nemo_copy;
} Ipmip6ha_nemo_acl_t;
typedef struct Ipmip6ha_nemo_context
{
struct Ipmip6ha_nemo_pool *nemo_pools;
Ipcom_hash *nemo_mr_acl_hoa;
Ipcom_hash *nemo_mr_acl_nai;
Ipcom_hash *nemo_lma_acl_nai;
#ifdef IPMIP_USE_INET
Ipmip6ha_nemo_dsmipv6_context_t *nemo_dsmipv6;
#endif
} Ipmip6ha_nemo_context_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL int ipmip6ha_nemo_verify(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6_mh_option_array_t *mo,
Ip_bool *changed);
IP_GLOBAL int ipmip6ha_nemo_pmipv6_verify(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6_mh_option_array_t *mo);
IP_GLOBAL void ipmip6ha_nemo_free(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6ha_nemo_t *nemo);
IP_GLOBAL void ipmip6ha_nemo_free_list(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipcom_list *nemos);
IP_GLOBAL void ipmip6ha_nemo_unconfigure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_context_t *nemo);
IP_GLOBAL void ipmip6ha_nemo_configure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_context_t **nemop,
const char *ifname);
IP_GLOBAL void ipmip6ha_nemo_context_init(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6ha_nemo_context_destroy(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6ha_nemo_dump_config(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_context_t *nemo,
const char *ifname,
struct Ipmip_buffer *buffer);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,174 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_nemo_dsmipv6.h,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_nemo_dsmipv6.h,v $
* $Author: jhorteli $ $Date: 2009-02-25 14:33:56 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_NEMO_DSMIPV6_H
#define IPMIP6HA_NEMO_DSMIPV6_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef IPMIP_USE_INET
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_node;
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip_dhcp_pool;
struct Ipmip_dhcp_option;
typedef struct Ipmip6ha_nemo_dsmipv6
{
Ipcom_list next;
struct Ipmip6ha_nemo_dsmipv6 *acl_next;
Ip_u32 prefix;
Ip_u32 len;
Ip_u32 netmask;
Ip_u8 flags;
} Ipmip6ha_nemo_dsmipv6_t;
typedef struct Ipmip6ha_nemo_dsmipv6_config
{
Ip_u32 netmask;
Ipcom_list opts;
struct Ipmip6ha_nemo_dsmipv6_config *parent;
} Ipmip6ha_nemo_dsmipv6_config_t;
typedef struct Ipmip6ha_nemo_dsmipv6_acl
{
Ipmip6ha_nemo_dsmipv6_t *hoa;
Ipmip6ha_nemo_dsmipv6_t *pd;
struct Ipmip_dhcp_pool *pool;
Ip_bool mobile_router;
Ip_u32 limit_prefix;
Ip_u32 limit_hoa;
} Ipmip6ha_nemo_dsmipv6_acl_t;
typedef struct Ipmip6ha_nemo_dsmipv6_context
{
struct Ipmip_dhcp_rtab *nemo_dhcp_rtab;
Ipcom_list nemo_dsmipv6_pools;
Ipcom_route *nemo_dsmipv6_acl_mr_hoa;
Ipcom_hash *nemo_dsmipv6_acl_mr_nai;
Ipcom_route *nemo_inet_config;
Ipcom_hash *nemo_dsmipv6_acl_lma_nai;
} Ipmip6ha_nemo_dsmipv6_context_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL Ipmip6ha_nemo_dsmipv6_config_t *ipmip6ha_nemo_dsmipv6_subnet_config_get(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_dsmipv6_context_t *nctx,
Ip_u32 addr);
IP_GLOBAL Ip_u32 ipmip6ha_nemo_dsmipv6_subnet_config_gateway(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_dsmipv6_context_t *nemo,
Ip_u32 addr);
IP_GLOBAL Ip_u32 ipmip6ha_nemo_dsmipv6_subnet_config_netmask(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_dsmipv6_context_t *nemo,
Ip_u32 addr);
IP_GLOBAL void ipmip6ha_nemo_dsmipv6_free(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6ha_nemo_dsmipv6_t *nemo);
IP_GLOBAL void ipmip6ha_nemo_dsmipv6_free_list(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipcom_list *nemos);
IP_GLOBAL int ipmip6ha_nemo_dsmipv6_verify(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf,
Ip_bool *changed);
IP_GLOBAL void ipmip6ha_nemo_dsmipv6_dump_config(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_dsmipv6_context_t *nemo,
const char *ifname,
struct Ipmip_buffer *buffer);
IP_GLOBAL void ipmip6ha_nemo_dsmipv6_unconfigure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_dsmipv6_context_t *nemo);
IP_GLOBAL void ipmip6ha_nemo_dsmipv6_configure(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_nemo_dsmipv6_context_t **nemop,
const char *ifname);
IP_GLOBAL void ipmip6ha_nemo_dsmipv6_context_init(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6ha_nemo_dsmipv6_context_destroy(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
#ifdef __cplusplus
}
#endif
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,383 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_node.h,v $ $Revision: 1.19 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_node.h,v $
* $Author: jhorteli $ $Date: 2010-02-15 13:27:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_NODE_H
#define IPMIP6HA_NODE_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip6_nd_proxy.h>
#include <private/ipmip6_nd_nud.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6HA_NODE_STATE_HOME_AGENT (1 << 0)
#define IPMIP6HA_NODE_STATE_HOME_ADDRESS (1 << 1)
#define IPMIP6HA_NODE_STATE_PROXY_NDP (1 << 2)
#define IPMIP6HA_NODE_STATE_PROXY_ARP (1 << 3)
#define IPMIP6HA_NODE_STATE_DAD_FAILED (1 << 4)
#define IPMIP6HA_NODE_STATE_SHUTDOWN (1 << 5)
#define IPMIP6HA_NODE_STATE_PROXY_LL_NDP (1 << 6)
#define IPMIP6HA_NODE_STATE_NDP_HOA (1 << 7)
#define IPMIP6HA_NODE_STATE_NDP_LLOCAL (1 << 8)
#define IPMIP6HA_NODE_STATE_SRCMAC (1 << 9)
#define IPMIP6HA_NODE_STATE_GRE_KEY (1 << 10)
#define IPMIP6HA_NODE_HASH_HOA (1 << 0)
#define IPMIP6HA_NODE_HASH_NAI (1 << 1)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip6ha_if;
struct Ipmip6ha_pktbuf;
struct Ipmip6ha_nemo_acl;
struct Ipmip6ha_nemo_dsmipv6_acl;
struct Ipmip6ha_mag;
struct Ipmip6ha_node;
struct Ipmip6ha_br;
typedef int (*Ipmip6ha_bri_done_t) (struct Ipmip6ha_context *ctx, struct Ipmip_proc *proc, struct Ipmip6ha_node *node, struct Ipmip6ha_br *bri, Ip_bool timeout, Ip_u8 status);
typedef struct Ipmip6ha_br
{
Ipcom_list next;
Ip_u32 sequence;
Ip_u8 xmits;
Ip_u8 reason;
Ip_u8 state;
Ip_u16 flags;
Ip_bool inet;
char *match;
Ip_size_t match_len;
Ipmip_timer_t retransmit;
Ipmip_timer_func_t reply;
void *opaque;
Ipmip_timer_lock_t *lock;
struct Ipmip6ha_mag *mag;
Ipmip6ha_bri_done_t completion;
/**/
} Ipmip6ha_br_t;
typedef struct Ipmip6ha_node_coa
{
Ip_u32 mip6BindingTunnelType;
Ip_u32 mip6BindingCOAType;
union Ipmip6_mib_InetAddress mip6BindingCOA;
Ip_u32 mip6BindingUDPEncapType;
} Ipmip6ha_node_coa_t;
typedef struct Ipmip6ha_node
{
struct Ipmip6ha_node *next;
struct Ipmip6ha_node *prev;
/**/
Ipmip_timer_lock_t *lock;
Ipmip6_mh_mo_hdr_t *nai_mn;
struct Ipmip6ha_if *ifp_transport;
struct Ipmip6ha_if *ifp_home;
Ipcom_list bri_list;
/**/
Ipmip_timer_t expire;
Ipmip_timer_t revocation;
Ipmip_timer_t service;
Ip_u16 termstate;
Ip_u16 bristate;
Ip_time_t updated;
Ip_u32 state;
Ip_u32 route_state;
Ip_u32 route_change;
Ip_u32 identity;
Ip_u32 *gre_keys[2];
Ip_u16 sequence;
Ip_u16 flags;
Ip_u16 regflags;
Ipcom_list nemo_v6;
struct Ipmip6ha_nemo_acl *nemo_acl_v6;
#ifdef IPMIP_USE_INET
Ipcom_list nemo_prefix_v4;
Ipcom_list nemo_hoa_v4;
struct Ipmip6ha_nemo_dsmipv6_acl *nemo_acl_v4;
#endif
/* Information required to deal with BA */
Ipmip6ha_node_coa_t pending;
Ipmip6ha_node_coa_t registered;
/* Statistics */
struct Ipmip6_mib_mip6BindingCacheEntry mip6BindingCacheEntry;
struct Ipmip6_mib_mip6NodeTrafficEntry mip6NodeTrafficEntry;
/**/
void **extdata;
Ip_u32 service_enabled;
Ip_u32 service_supported;
} Ipmip6ha_node_t;
typedef struct Ipmip6ha_node_H
{
struct Ipmip6ha_node node;
struct Ip_in6_addr link_local;
Ipmip6_nd_proxy_t link_local_proxy;
Ipmip6_nd_nud_t link_local_nud;
Ipmip6_nd_proxy_t proxy;
Ipmip6_nd_nud_t nud;
/**/
} Ipmip6ha_node_H_t;
typedef struct Ipmip6ha_node_P
{
struct Ipmip6ha_node node;
Ipmip6_mh_mo_pmipv6_handoff_indicator_t pmipv6_handoff_indicator;
Ipmip6_mh_mo_pmipv6_access_technology_type_t pmipv6_access_technology;
Ipmip6_mh_mo_pmipv6_link_local_address_t pmipv6_link_local_address;
struct Ip_timeval timestamp;
Ipmip6_mh_mo_pmipv6_mn_link_layer_id_t *pmipv6_mn_link_layer_id;
/**/
struct Ip_in6_addr pendingBAEndpoint;
Ip_u32 gre_down_link;
/**/
struct Ipmip6ha_pktbuf *delayed_BU;
struct Ip_timeval delayed_start;
#ifdef IPMIP_USE_INET
Ip_u32 router;
#endif
struct Ipmip6ha_mag *mag;
} Ipmip6ha_node_P_t;
typedef struct Ipmip6ha_node_key
{
struct Ip_in6_addr *hoa;
const char *nai;
Ip_size_t nai_len;
} Ipmip6ha_node_key_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6ha_node_clear(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6ha_node_if_init(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ife);
IP_GLOBAL void ipmip6ha_node_if_destroy(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ife);
IP_GLOBAL int ipmip6ha_node_terminate(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node,
const char *reason,
Ip_bool immediate);
IP_GLOBAL void ipmip6ha_node_silence(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node);
IP_GLOBAL void ipmip6ha_node_update(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node,
struct Ipmip6ha_pktbuf *pbuf);
IP_GLOBAL Ipmip6ha_node_t *ipmip6ha_node_create_H(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *head,
struct Ipmip6ha_if *iff_home,
struct Ipmip6ha_if *iff_transport,
struct Ip_in6_addr *hoa,
Ipmip6_mh_mo_nai_t *nai,
Ip_u16 regflags);
IP_GLOBAL Ipmip6ha_node_t *ipmip6ha_node_create_P(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *head,
struct Ipmip6ha_if *iff_home,
struct Ipmip6ha_if *iff_transport,
Ipmip6_mh_options_t *opts,
Ip_u16 regflags);
IP_GLOBAL void ipmip6ha_node_lookup(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ifp,
struct Ip_in6_addr *hoa,
Ipmip6_mh_mo_nai_t *nai,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg);
IP_GLOBAL void ipmip6ha_node_search(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ifp,
Ipmip6ha_node_key_t *key,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg);
IP_GLOBAL void ipmip6ha_node_lookup_handle(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 handle,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg);
IP_GLOBAL void ipmip6ha_node_delete(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node,
const char *reason);
IP_GLOBAL int ipmip6ha_node_revoke(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node,
Ip_bool inet,
Ip_u8 reason,
Ipmip6ha_bri_done_t completion);
IP_GLOBAL const char *ipmip6ha_node_describe(struct Ipmip_proc *proc,
Ipmip6ha_node_t *node);
IP_GLOBAL Ip_bool ipmip6ha_node_enable_service(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node);
IP_GLOBAL Ip_bool ipmip6ha_node_disable_service(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node);
IP_GLOBAL Ip_bool ipmip6ha_node_update_service(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
Ipmip6ha_node_t *node);
IP_GLOBAL Ip_bool ipmip6ha_node_extension_pkt_req_validate(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf);
IP_GLOBAL Ip_bool ipmip6ha_node_extension_pkt_req_accept(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf);
IP_GLOBAL Ip_bool ipmip6ha_node_refresh_request(struct Ipmip6ha_node *node,
struct Ipmip6ha_pktbuf *pbuf);
IP_GLOBAL int ipmip6ha_node_timeout(int event,
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
const char *reason);
IP_GLOBAL int ipmip6ha_node_bri_accept(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6ha_br_t *bri,
Ip_bool timeout,
Ip_u8 status);
IP_GLOBAL void ipmip6ha_node_bri_cancel(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6ha_bri_done_t completion);
IP_GLOBAL void ipmip6ha_node_bri_cancel_mag(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6ha_bri_done_t completion,
struct Ipmip6ha_mag *mag);
IP_GLOBAL void ipmip6ha_node_bri_free(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ipmip6ha_br_t *bri);
#ifdef IPMIP_USE_INET
IP_GLOBAL int ipmip6ha_node_bri_inet_process(int event,
struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
void *extarg);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,158 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6ha_route.h,v $ $Revision: 1.10 $
* $Source: /home/interpeak/CVSRoot/ipmip6ha/src/ipmip6ha_route.h,v $
* $Author: jhorteli $ $Date: 2010-12-08 12:52:37 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6HA_ROUTE_H
#define IPMIP6HA_ROUTE_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
IPMIP6HA_ROUTE_BIT_IPV6 = 0,
IPMIP6HA_ROUTE_BIT_TUNNEL_IPV6,
IPMIP6HA_ROUTE_BIT_IPV6_NEMO,
IPMIP6HA_ROUTE_BIT_IPV4_NEMO,
IPMIP6HA_ROUTE_BIT_IPV4,
IPMIP6HA_ROUTE_BIT_MAX
};
#define IPMIP6HA_ROUTE_STATE_BIT(x) (1 << (x))
#define IPMIP6HA_ROUTE_STATE_CHECK(s,i) ((s) & IPMIP6HA_ROUTE_STATE_BIT(i))
#define IPMIP6HA_ROUTE_STATE_ALL 0xFFFFFFFF
#define IPMIP6HA_ROUTE_STATE_IPV6 IPMIP6HA_ROUTE_STATE_BIT(IPMIP6HA_ROUTE_BIT_IPV6)
#define IPMIP6HA_ROUTE_STATE_TUNNEL_IPV6 IPMIP6HA_ROUTE_STATE_BIT(IPMIP6HA_ROUTE_BIT_TUNNEL_IPV6)
#define IPMIP6HA_ROUTE_STATE_NEMO_IPV6 IPMIP6HA_ROUTE_STATE_BIT(IPMIP6HA_ROUTE_BIT_IPV6_NEMO)
#define IPMIP6HA_ROUTE_STATE_IPV4_NEMO IPMIP6HA_ROUTE_STATE_BIT(IPMIP6HA_ROUTE_BIT_IPV4_NEMO)
#define IPMIP6HA_ROUTE_STATE_IPV4 IPMIP6HA_ROUTE_STATE_BIT(IPMIP6HA_ROUTE_BIT_IPV4)
#define IPMIP6HA_ROUTE_STATE_TRANSPORT (IPMIP6HA_ROUTE_STATE_ALL)
#define IPMIP6HA_ROUTE_PRIORITY_TUNNEL 98
#define IPMIP6HA_ROUTE_PRIORITY_RO 99
#define IPMIP6HA_ROUTE_PRIORITY_FORWARD 100
#define IPMIP6HA_ROUTE_PRIORITY_PENDING 101
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6ha_context;
struct Ipmip_proc;
struct Ipmip6ha_node;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_GLOBAL void ipmip6ha_route_state_del(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ip_u32 states);
IP_GLOBAL void ipmip6ha_route_state_add(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node,
Ip_u32 states);
IP_GLOBAL void ipmip6ha_route_add_outbound(struct Ipmip6ha_context *ctx,
struct Ipmip6ha_node *node,
Ip_u64 octets,
Ip_u64 pkts);
IP_GLOBAL void ipmip6ha_route_add_inbound(struct Ipmip6ha_context *ctx,
struct Ipmip6ha_node *node,
Ip_u64 octets,
Ip_u64 pkts);
IP_GLOBAL Ip_bool ipmip6ha_route_update_temporary(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_pktbuf *pbuf,
Ip_bool route_direct);
IP_GLOBAL void ipmip6ha_route_rthdr_temporary(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ifp,
struct Ip_in6_addr *hoa,
union Ipmip6_mib_InetAddress *coa,
Ip_u32 coa_type,
Ip_u16 port);
IP_GLOBAL void ipmip6ha_route_direct_temporary(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_if *ifp,
struct Ip_in6_addr *endpoint,
union Ipmip6_mib_InetAddress *tunnel_endpoint,
Ip_u32 tunnel_endpoint_type,
Ip_u16 port);
IP_GLOBAL int ipmip6ha_netlink_new_handle(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node);
IP_GLOBAL int ipmip6ha_netlink_del_handle(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node);
IP_GLOBAL Ip_bool ipmip6ha_netlink_get_handle_stat(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6ha_node *node);
IP_GLOBAL void ipmip6ha_route_context_init(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
IP_GLOBAL void ipmip6ha_route_context_destroy(struct Ipmip6ha_context *ctx,
struct Ipmip_proc *proc);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/