original files of m241
This commit is contained in:
@@ -0,0 +1,588 @@
|
||||
/* 00comp_ipnet_mobility_pm6.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_IPMIP6PM
|
||||
|
||||
|
||||
Component INCLUDE_IPMIP6PM {
|
||||
NAME IPv6 Mobility Access Gateway Agent
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Agent
|
||||
REQUIRES INCLUDE_IPCOM_USE_INET6 INCLUDE_IPMIP6 SELECT_IPMIP6PM
|
||||
MODULES ipmip6pm.o
|
||||
CONFIGLETTES ipmip6pm_config.c
|
||||
CFG_PARAMS MIP6PM_INTERFACES \
|
||||
MIP6PM_LIFETIME_ENUM \
|
||||
MIP6PM_INITIAL_REGISTRATION_TIMEOUT_ENUM \
|
||||
MIP6PM_TIMESTAMP_BASED_APPROACH_IN_USE_ENUM \
|
||||
MIP6PM_CARE_OF_ADDRESS_ENUM \
|
||||
MIP6PM_TUNNEL_IP6IP6_ENUM \
|
||||
MIP6PM_TUNNEL_GRE_ENUM \
|
||||
MIP6PM_TUNNEL_GRE_PREFERRED_ENUM \
|
||||
MIP6PM_TUNNEL_GRE_KEYED_ENUM \
|
||||
MIP6PM_HEARTBEAT_ENABLED_ENUM \
|
||||
MIP6PM_HEARTBEAT_INTERVAL_ENUM \
|
||||
MIP6PM_MISSING_HEARTBEATS_ALLOWED_ENUM \
|
||||
MIP6PM_LMA_ENUM \
|
||||
MIP6PM_BINDING_REVOCATION_MIN_DELAY_ENUM \
|
||||
MIP6PM_BINDING_REVOCATION_MAX_RETRIES_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LAYER_ADDRESS {
|
||||
NAME IPv6 Mobility Access Gateway Link Feature FixedMAGLinkLayerAddressOnAllAccessLinks
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Link Feature FixedMAGLinkLayerAddressOnAllAccessLinks
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_FIXED_MAG_LINK_LAYER_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LOCAL_ADDRESS {
|
||||
NAME IPv6 Mobility Access Gateway Link Feature FixedMAGLinkLocalAddressOnAllAccessLinks
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Link Feature FixedMAGLinkLocalAddressOnAllAccessLinks
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_FIXED_MAG_LINK_LOCAL_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM
|
||||
}
|
||||
|
||||
|
||||
Component INCLUDE_IPMIP6PM_DUAL_STACK {
|
||||
NAME IPv6 Mobility Access Gateway Agent Dual Stack Support
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Agent Dual Stack Support
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_INET_CARE_OF_ADDRESS_ENUM \
|
||||
MIP6PM_INET_USE_IPV4_UDP_ENCAP_FOR_SIGNALING_MESSAGES_ENUM \
|
||||
MIP6PM_INET_FORCE_IPV4_UDP_ENCAPSULATION_SUPPORT_ENUM \
|
||||
MIP6PM_INET_IPV4UDPENCAPSULATIONNATTIMEOUT_ENUM \
|
||||
MIP6PM_INET_TUNNEL_IPIP_ENUM \
|
||||
MIP6PM_INET_TUNNEL_GRE_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_SERVICE_FEATURE_DHCP_RELAY {
|
||||
NAME IPv6 Mobility Access Gateway Agent Service Feature DHCP Relay Support
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Agent Service Feature DHCP Relay Support
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_DHCP_RELAY_MODE_ENUM \
|
||||
MIP6PM_DHCP_RELAY_SERVER_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_SERVICE_FEATURE_RADVD {
|
||||
NAME IPv6 Mobility Access Gateway Agent Service Feature RADVD Support
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Agent Service Feature RADVD Support. \
|
||||
Will provide RADVD functionality on the access links. Unless \
|
||||
you implement another address assignment feature, this \
|
||||
service should always be included.
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_RADVD_MANAGED_ENUM \
|
||||
MIP6PM_RADVD_OTHER_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_SERVICE_FEATURE_SERVICE_SELECTION {
|
||||
NAME IPv6 Mobility Access Gateway Agent Service Feature Service Selection Support
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Agent Service Feature Service Selection Support
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_SERVICE_SELECTION_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_SERVICE_FEATURE_VENDOR_EXTENSION {
|
||||
NAME IPv6 Mobility Access Gateway Agent Service Feature Generic Vendor Extension Support
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Agent Service Feature Generic Vendor Extension Support
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_VENDOR_EXTENSION_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_RELAY_SUPPORT {
|
||||
NAME IPv6 Mobility Access Gateway Dual Stack Internal DHCP Relay Support
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Dual Stack Internal DHCP Relay includes \
|
||||
the integrated DHCP relay feature.
|
||||
REQUIRES INCLUDE_IPMIP6PM_DUAL_STACK
|
||||
CFG_PARAMS MIP6PM_INET_DHCP_RELAY_SERVER_ENUM \
|
||||
MIP6PM_INET_DHCP_RELAY_SERVER_OVERRIDE_ENUM
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_SERVER_SUPPORT {
|
||||
NAME IPv6 Mobility Access Gateway Dual Stack Internal DHCP Server Support
|
||||
SYNOPSIS IPv6 Mobility Access Gateway Dual Stack Internal DHCP includes \
|
||||
the integrated DHCP server feature.
|
||||
REQUIRES INCLUDE_IPMIP6PM_DUAL_STACK
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_SERVICE_FEATURE_EXTENSION {
|
||||
NAME IPv6 Mobility Access Gateway Service Feature Extension
|
||||
SYNOPSIS This feature should be included if one wants to add \
|
||||
a new service feature to the mobility access gateway, and have the \
|
||||
feature hook being registered during initialization.
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_SERVICE_FEATURE_INITIALIZATION_HOOK
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_LINK_FEATURE_EXTENSION {
|
||||
NAME IPv6 Mobility Access Gateway Link Feature Extension
|
||||
SYNOPSIS This feature should be included if one wants to add \
|
||||
a new link feature to the mobility access gateway, and have the \
|
||||
feature hook being registered during initialization.
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
CFG_PARAMS MIP6PM_LINK_FEATURE_INITIALIZATION_HOOK
|
||||
}
|
||||
|
||||
Selection SELECT_IPMIP6PM {
|
||||
NAME Ipv6 Mobility Access Gateway Components
|
||||
SYNOPSIS Ipv6 Mobility Access Gateway Components
|
||||
COUNT 0-
|
||||
REQUIRES INCLUDE_IPMIP6PM
|
||||
_CHILDREN FOLDER_MOBILITY_V6
|
||||
CHILDREN INCLUDE_IPMIP6PM \
|
||||
INCLUDE_IPMIP6PM_CMD \
|
||||
INCLUDE_IPMIP6PM_DUAL_STACK \
|
||||
INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_RELAY_SUPPORT \
|
||||
INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_SERVER_SUPPORT \
|
||||
INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LAYER_ADDRESS \
|
||||
INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LOCAL_ADDRESS \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_DHCP_RELAY \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_RADVD \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_SERVICE_SELECTION \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_VENDOR_EXTENSION \
|
||||
INCLUDE_IPMIP6PM_LINK_FEATURE_EXTENSION \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_EXTENSION
|
||||
DEFAULTS INCLUDE_IPMIP6PM \
|
||||
INCLUDE_IPMIP6PM_CMD \
|
||||
INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LAYER_ADDRESS \
|
||||
INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LOCAL_ADDRESS \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_DHCP_RELAY \
|
||||
INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_SERVER_SUPPORT \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_RADVD \
|
||||
INCLUDE_IPMIP6PM_SERVICE_FEATURE_SERVICE_SELECTION \
|
||||
INCLUDE_IPMIP6PM_DUAL_STACK \
|
||||
INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_RELAY_SUPPORT
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6PM_CMD {
|
||||
NAME IPv6 Mobility Access Gateway IPCOM commands
|
||||
SYNOPSIS IPv6 Mobility Access Gateway IPCOM commands
|
||||
MODULES ipmip6pm_cmd_pm6.o
|
||||
REQUIRES INCLUDE_IPCOM_SHELL_CMD INCLUDE_IPMIP6PM
|
||||
}
|
||||
|
||||
|
||||
Parameter MIP6PM_INTERFACES {
|
||||
NAME Interface list
|
||||
SYNOPSIS The interface list specifies what interfaces \
|
||||
should be configured for ;AG operation. This \
|
||||
parameter is a comma separated list of interfaces such \
|
||||
as "<ifname1>,<ifname2>" etc.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_LIFETIME_ENUM {
|
||||
NAME Interface requested lifetime
|
||||
SYNOPSIS The lifetime in seconds that the MAG will request from the LMA. \
|
||||
This value indicates the maximum lifetime length, since the LMA \
|
||||
may lower it. The default value is "60". 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 MIP6PM_INITIAL_REGISTRATION_TIMEOUT_ENUM {
|
||||
NAME Interface Initial Registration Timeout
|
||||
SYNOPSIS Specifies the amount of time (in milliseconds) to wait for \
|
||||
the initial binding acknowledgement from the home agent. \
|
||||
The initial binding acknowledgement may take additional time \
|
||||
compared to subsequent ones, due to the requirement to \
|
||||
verify address usability. The default value is "1500". Format for \
|
||||
this configuration item is a semi-colon separated list of \
|
||||
interfaces and lifetime values as specified by the following \
|
||||
format string "<ifname1>=<timeout1>;<ifnameN>=<timeoutN>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_TIMESTAMP_BASED_APPROACH_IN_USE_ENUM {
|
||||
NAME Interface Timestamp Based Approach In Use
|
||||
SYNOPSIS Specifies whether or not an interface should be using Timestamps \
|
||||
or Sequence numbers for replay and out-of-order protection. \
|
||||
By default the MAG will use Timestamps. The format for this \
|
||||
parameter is "<ifname1>=<enabled|disabled>;<ifnameN>=<enabled|disabled>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_CARE_OF_ADDRESS_ENUM {
|
||||
NAME Interface Care of Address
|
||||
SYNOPSIS Specifies the INET6 Care-of-address that should be used by the MAG \
|
||||
for communication with the Home Agent/LMA. If not specified, the MAG. \
|
||||
will attempt to resolve it from the interface. If no address is \
|
||||
available, the interface will be disabled.. The format for this \
|
||||
parameter is "<ifname1>=<address1>;<ifnameN>=<addressN>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_TUNNEL_IP6IP6_ENUM {
|
||||
NAME Interface IPv6 tunneling
|
||||
SYNOPSIS This configuration item specifies whether or not IPv6 tunneling \
|
||||
is allowed by the MAG. By default it 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 MIP6PM_TUNNEL_GRE_ENUM {
|
||||
NAME Interface IPv6 GRE tunneling
|
||||
SYNOPSIS This configuration item specifies whether or not IPv6 GRE tunneling \
|
||||
is allowed by the MAG. By default it 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 MIP6PM_TUNNEL_GRE_PREFERRED_ENUM {
|
||||
NAME Interface IPv6 GRE Preferred tunneling
|
||||
SYNOPSIS This configuration item specifies whether or not GRE tunneling \
|
||||
is preferred by the MAG. If preferred, the MAG will try to use \
|
||||
GRE initially, and if the LMA either forbids it or is unable \
|
||||
to handle it, revert to IPIP. By default this parameter is \
|
||||
"disabled". 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 MIP6PM_TUNNEL_GRE_KEYED_ENUM {
|
||||
NAME Interface IPv6 GRE Keyed tunneling
|
||||
SYNOPSIS This configuration item specifies whether or not GRE tunneling \
|
||||
is keyed. By default Keyed GRE is "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 MIP6PM_HEARTBEAT_ENABLED_ENUM {
|
||||
NAME Interface 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 MIP6PM_HEARTBEAT_INTERVAL_ENUM {
|
||||
NAME Interface 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 MIP6PM_MISSING_HEARTBEATS_ALLOWED_ENUM {
|
||||
NAME Interface 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 MIP6PM_LMA_ENUM {
|
||||
NAME Proxy Mobility Local Mobility Anchor Definitions
|
||||
SYNOPSIS This configuration item specifies what LMAs \
|
||||
should be permanently added to the LMA database, \
|
||||
and whether or not they support HeartBeat. The MAG will \
|
||||
send an unsolicited HeartBeat response to each HeartBeat \
|
||||
enabled LMA during startup and reconfiguration. \
|
||||
The format for this configuration item is a semi-colon \
|
||||
separated list of "<LMA address>=<enabled|disabled>", where \
|
||||
<LMA Address> has the form <LMA INET6 Address>[/<LMA INET Address>]
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_FIXED_MAG_LINK_LAYER_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM {
|
||||
NAME Interface Fixed MAG Link Layer Address on all Access Links
|
||||
SYNOPSIS This parameter specifies what Link Layer address should be \
|
||||
used on all access links belonging to this proxy domain. The \
|
||||
format is specified as a link layer address. For example \
|
||||
ethernet would use XX:XX:XX:XX:XX:XX. The format for this \
|
||||
configuration item is a semi-colon \
|
||||
separated list of "<ifname1>=<Link Layer Address>". For example \
|
||||
"eth0=00:00:0a:0a:0a:0a"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_FIXED_MAG_LINK_LOCAL_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM {
|
||||
NAME Interface Fixed MAG Link Local Address on all Access Links
|
||||
SYNOPSIS This configuration item specifies the Link Local Address that \
|
||||
should be used on all access links in this proxy mobility \
|
||||
domain. If not specified or set to "::", the LMA will allocate \
|
||||
a link local address for each session. The format for this \
|
||||
configuration item is a semi-colon separated list of \
|
||||
"<ifname1>=<Link Local Address>". For example "eth0=fe80::1/64"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_SERVICE_FEATURE_INITIALIZATION_HOOK {
|
||||
NAME Mobility Access Gateway Service Feature Initialization Hook
|
||||
SYNOPSIS This is the function hook that you may define in order to \
|
||||
register extra functional extensions to the Mobility Access \
|
||||
Gateway. The Service Features are provided after the \
|
||||
Link Features have been completed, so that the access \
|
||||
link should be fully up and running.
|
||||
TYPE FUNCPTR
|
||||
DEFAULT your_function_here
|
||||
}
|
||||
|
||||
Parameter MIP6PM_LINK_FEATURE_INITIALIZATION_HOOK {
|
||||
NAME Mobility Access Gateway Link Feature Initialization Hook
|
||||
SYNOPSIS This is the function hook that you may define in order to \
|
||||
register extra functional extensions to the Mobility Access \
|
||||
Gateway. The Link Features are used to setup the access link \
|
||||
and will be invoked and provided prior to service features.
|
||||
TYPE FUNCPTR
|
||||
DEFAULT your_function_here
|
||||
}
|
||||
|
||||
|
||||
Parameter MIP6PM_DHCP_RELAY_MODE_ENUM {
|
||||
NAME Mobility Access Gateway Service Feature DHCP Relay Mode
|
||||
SYNOPSIS This option specifies the mode of the DHCP Relay. It may be \
|
||||
set to "disabled", "optional" or "required". If "required", \
|
||||
the relay will always be configured, if "optional" it may \
|
||||
be enabled by node specific arguments. Format for this \
|
||||
parameter is a semi-colon separated list of \
|
||||
"<ifname>=<disabled|optional|required>". Default value is \
|
||||
"optional".
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_DHCP_RELAY_SERVER_ENUM {
|
||||
NAME Mobility Access Gateway Service Feature DHCP Relay Server
|
||||
SYNOPSIS This option specifies the DHCP server to be used. It may be \
|
||||
overriden by node specific arguments. If no server has been \
|
||||
specified, the home agent address will be used. Format for this \
|
||||
parameter is a semi-colon separated list of \
|
||||
"<ifname>=<address>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_RADVD_MANAGED_ENUM {
|
||||
NAME RADVD Managed Flag
|
||||
SYNOPSIS Enable or disable the MANAGED flag for RADVD.Format for this \
|
||||
parameter is a semi-colon separated list of \
|
||||
"<ifname>=<true|false>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_RADVD_OTHER_ENUM {
|
||||
NAME RADVD Other Config Flag
|
||||
SYNOPSIS Enable or disable the Other configuration flag for RADVD.\
|
||||
Format for this parameter is a semi-colon separated list of \
|
||||
"<ifname>=<true|false>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_SERVICE_SELECTION_ENUM {
|
||||
NAME Service Selection
|
||||
SYNOPSIS Specify the Service Selection parameter. If specified, the.\
|
||||
MAG will provide the string to the LMA in order for the LMA \
|
||||
to setup the correct services. This configuration parameter \
|
||||
may be overriden by node specific arguments. Format for this \
|
||||
parameter is a semi-colon separated list of \
|
||||
"<ifname>=<service selection string>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_INET_CARE_OF_ADDRESS_ENUM {
|
||||
NAME Interface INET Care of Address
|
||||
SYNOPSIS Specifies the INET Care-of-address that should be used by the MAG \
|
||||
for communication with the Home Agent/LMA. If not specified, the MAG. \
|
||||
will attempt to resolve it from the interface. The format for this \
|
||||
parameter is "<ifname1>=<address1>;<ifnameN>=<addressN>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_INET_USE_IPV4_UDP_ENCAP_FOR_SIGNALING_MESSAGES_ENUM {
|
||||
NAME Interface INET UseIPv4UDPEncapForSignalingMessages
|
||||
SYNOPSIS This flag indicates whether or not the mobile access gateway \
|
||||
should use IPv4-UDP encapsulation mode for the signaling messages. \
|
||||
The default value for this flag is set to value of 0, indicating \
|
||||
that the mobile access gateway MUST NOT use IPv4-UDP encapsulation \
|
||||
mode, but MUST use native IPv4 encapsulation mode for sending the \
|
||||
Proxy Mobile IPv6 signaling messages. \
|
||||
When the value for this flag is set to value of 1, the mobile \
|
||||
access gateway MUST use IPv4-UDP encapsulation mode for sending \
|
||||
the Proxy Mobile IPv6 signaling messages. The format for this \
|
||||
parameter is "<ifname1>=<0|1>;<ifnameN>=<0|1>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
|
||||
Parameter MIP6PM_INET_FORCE_IPV4_UDP_ENCAPSULATION_SUPPORT_ENUM {
|
||||
NAME Interface INET ForceIPv4UDPEncapsulationSupport
|
||||
SYNOPSIS This flag indicates whether or not the mobile access gateway \
|
||||
should request the mobile node's local mobility anchor for forcing \
|
||||
IPv4 UDP encapsulation support for the mobile node's data traffic, \
|
||||
even when NAT is not detected in the path. \
|
||||
The default value for this flag is set to value of 0, indicating \
|
||||
that the mobile access gateway MUST NOT request the mobile node's \
|
||||
local mobility anchor for forcing IPv4 UDP encapsulation support \
|
||||
even when NAT is not detected in path. \
|
||||
When the value for this flag is set to value of 1, the mobile \
|
||||
access gateway MUST force the mobile node's local mobility anchor \
|
||||
for IPv4 UDP encapsulation support. \
|
||||
This flag is applicable only when the flag \
|
||||
UseIPv4UDPEncapForSignalingMessages is set to a value of 1. \
|
||||
The format for this parameter is "<ifname1>=<0|1>;<ifnameN>=<0|1>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_INET_IPV4UDPENCAPSULATIONNATTIMEOUT_ENUM {
|
||||
NAME Interface INET UDP Encapsulation NAT Timeout
|
||||
SYNOPSIS This parameter specifies the maximum time in seconds that the \
|
||||
MAG must send BUs to a LMA in order to maintain NAT translations \
|
||||
in the path. The default value is 110. The format for this \
|
||||
parameter is "<ifname1>=<timeout1>;<ifnameN>=<timeoutN>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_INET_TUNNEL_IPIP_ENUM {
|
||||
NAME INET IPIP tunneling
|
||||
SYNOPSIS This configuration item specifies whether or not v4 IPIP tunneling \
|
||||
is allowed by the MAG 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 MIP6PM_INET_TUNNEL_GRE_ENUM {
|
||||
NAME INET GRE tunneling
|
||||
SYNOPSIS This configuration item specifies whether v4 GRE tunneling \
|
||||
is allowed by the MAG 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 MIP6PM_INET_DHCP_RELAY_SERVER_ENUM {
|
||||
NAME INET DHCP Relay Server
|
||||
SYNOPSIS This configuration item specifies the DHCP server that DHCP \
|
||||
requests should be forwarded to. If this parameter is not \
|
||||
specified, the INET home agent is used. These parameters may \
|
||||
be overriden by node specific parameters. This parameter is \
|
||||
specified by using a semi-colon separated list of interface \
|
||||
names and INET address values, as specified by the format string \
|
||||
"<ifname1>=<DHCP server1>;<ifnameN>=<DHCP serverN>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_INET_DHCP_RELAY_SERVER_OVERRIDE_ENUM {
|
||||
NAME INET DHCP Relay Server Override
|
||||
SYNOPSIS This configuration item specifies if the DHCP Relay should \
|
||||
request the use of DHCP server override. DHCP server override \
|
||||
may be required if the DHCP server is not co-located or \
|
||||
integrated with the Home Agent. This item is "true" by default. \
|
||||
This parameter is specified by using a semi-colon separated list \
|
||||
of interface names and true/false values, as specified by the \
|
||||
format string "<ifname1>=<true|false>;<ifnameN>=<true|false>"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_VENDOR_EXTENSION_ENUM {
|
||||
NAME Generic Vendor Extension Configuration
|
||||
SYNOPSIS If configured, will add Vendor Extension options to the \
|
||||
registration messages. The Generic vendor extension feature \
|
||||
does not do anything beyond providing the information in the \
|
||||
binding update. Extra features or functionalities acting upon \
|
||||
the vendor extensions are beyond the current scope of this \
|
||||
product. The format of the configuration parameter is a semi-colon\
|
||||
separated list of <SMI Number>.<SubType>=<value1>[,<valueN>]. \
|
||||
SMI Number is the IANA assigned SMI number. Subtype is the \
|
||||
vendor specified subtype. Value is defined as a string, or as \
|
||||
a comma separated array of hexadecimal numbers. The number of \
|
||||
hexadecimal figures in the value will define how the value is \
|
||||
interpreted. For example 0xaa is 1 byte, 0x00aa is two bytes, \
|
||||
0x0000aa will be interpreted as a four byte value. Values \
|
||||
larger than 1 byte will be converted to network byte order.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6PM_BINDING_REVOCATION_MIN_DELAY_ENUM {
|
||||
NAME MAG 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 MIP6PM_BINDING_REVOCATION_MAX_RETRIES_ENUM {
|
||||
NAME MAG 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.6 $
|
||||
# $Source: /home/interpeak/CVSRoot/ipmip6pm/config/common.vxconfig,v $
|
||||
# $Author: myakan $
|
||||
# $State: Exp $ $Locker: $
|
||||
#
|
||||
# INTERPEAK_COPYRIGHT_STRING
|
||||
|
||||
#hidden option that enables IPMIP6PM
|
||||
config SUPPORTS_MIP6PM
|
||||
bool
|
||||
default y
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK CONFIGURATION SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_config.c,v $ $Revision: 1.16 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_config.c,v $
|
||||
* $Author: jonas $
|
||||
* $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_shell.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef void (*Ipmip6pm_config_func_t) (void *);
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL int ipmip6pm_cmd_pm6(int argc, char **argv);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDE_IPMIP6MN)
|
||||
|
||||
#define INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LAYER_ADDRESS 1
|
||||
#define INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LOCAL_ADDRESS 1
|
||||
#define INCLUDE_IPMIP6PM_SERVICE_FEATURE_DHCP_RELAY 1
|
||||
#define INCLUDE_IPMIP6PM_SERVICE_FEATURE_RADVD 1
|
||||
#define INCLUDE_IPMIP6PM_SERVICE_FEATURE_SERVICE_SELECTION 1
|
||||
#define INCLUDE_IPMIP6PM_SERVICE_FEATURE_VENDOR_EXTENSION 1
|
||||
#define INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_RELAY_SUPPORT 1
|
||||
#define INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_SERVER_SUPPORT 1
|
||||
#define INCLUDE_IPMIP6PM_DUAL_STACK 1
|
||||
|
||||
#define INCLUDE_IPMIP6PM_CMD
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Basic MIP6 Mobile Node(mn) sysvar Configuration
|
||||
*===========================================================================
|
||||
*/
|
||||
|
||||
IP_STATIC IP_CONST Ipcom_sysvar ipmip6pm_conf_sysvar[] =
|
||||
{
|
||||
|
||||
/* Configuration delimiter - DO NOT EDIT! */
|
||||
{ IP_NULL, IP_NULL }
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
IP_STATIC IP_CONST Ipcom_sysvar ipmip6pm_conf_sysvar[] =
|
||||
{
|
||||
/* Basic configuration entries */
|
||||
{ "ipmip6pm.interfaces", MIP6PM_INTERFACES },
|
||||
|
||||
|
||||
/* Configuration delimiter - DO NOT EDIT! */
|
||||
{ IP_NULL, IP_NULL }
|
||||
};
|
||||
|
||||
/* Interface specific list configurations */
|
||||
IP_CONST Ipcom_sysvar_ext ipmip6pm_conf_sysvar_ext[] =
|
||||
{
|
||||
/* Configuration delimiter - DO NOT EDIT! */
|
||||
{ "ipmip6pm.interface", "lifetime", MIP6PM_LIFETIME_ENUM },
|
||||
{ "ipmip6pm.interface", "InitialBindackTimeoutFirstReg", MIP6PM_INITIAL_REGISTRATION_TIMEOUT_ENUM },
|
||||
{ "ipmip6pm.interface", "TimestampBasedApproachInUse", MIP6PM_TIMESTAMP_BASED_APPROACH_IN_USE_ENUM },
|
||||
{ "ipmip6pm.interface", "care_of_address", MIP6PM_CARE_OF_ADDRESS_ENUM },
|
||||
{ "ipmip6pm.interface", "tunnel.gre", MIP6PM_TUNNEL_GRE_ENUM },
|
||||
{ "ipmip6pm.interface", "tunnel.ip6ip6", MIP6PM_TUNNEL_IP6IP6_ENUM },
|
||||
{ "ipmip6pm.interface", "tunnel.gre.Preferred", MIP6PM_TUNNEL_GRE_PREFERRED_ENUM },
|
||||
{ "ipmip6pm.interface", "tunnel.gre.UseKeys", MIP6PM_TUNNEL_GRE_KEYED_ENUM },
|
||||
{ "ipmip6pm.interface", "HeartBeatEnabled", MIP6PM_HEARTBEAT_ENABLED_ENUM },
|
||||
{ "ipmip6pm.interface", "HeartBeatInterval", MIP6PM_HEARTBEAT_INTERVAL_ENUM },
|
||||
{ "ipmip6pm.interface", "MissingHeartBeatsAllowed", MIP6PM_MISSING_HEARTBEATS_ALLOWED_ENUM },
|
||||
{ "ipmip6pm.LMA", IP_NULL, MIP6PM_LMA_ENUM },
|
||||
|
||||
{ "ipmip6pm.interface", "BRIMaxRetriesNumber", MIP6PM_BINDING_REVOCATION_MAX_RETRIES_ENUM },
|
||||
{ "ipmip6pm.interface", "MINDelayBRIs", MIP6PM_BINDING_REVOCATION_MIN_DELAY_ENUM },
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_DUAL_STACK)
|
||||
{ "ipmip6pm.interface", "inet.care_of_address", MIP6PM_INET_CARE_OF_ADDRESS_ENUM },
|
||||
{ "ipmip6pm.interface", "inet.UseIPv4UDPEncapForSignalingMessages", MIP6PM_INET_USE_IPV4_UDP_ENCAP_FOR_SIGNALING_MESSAGES_ENUM },
|
||||
{ "ipmip6pm.interface", "inet.ForceIPv4UDPEncapsulationSupport", MIP6PM_INET_FORCE_IPV4_UDP_ENCAPSULATION_SUPPORT_ENUM },
|
||||
{ "ipmip6pm.interface", "inet.IPv4UDPEncapsulationNATTimeout", MIP6PM_INET_IPV4UDPENCAPSULATIONNATTIMEOUT_ENUM },
|
||||
{ "ipmip6pm.interface", "inet.tunnel.gre", MIP6PM_INET_TUNNEL_GRE_ENUM },
|
||||
{ "ipmip6pm.interface", "inet.tunnel.ipip", MIP6PM_INET_TUNNEL_IPIP_ENUM },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_RELAY_SUPPORT)
|
||||
{ "ipmip6pm.interface", "inet.dhcp.relay.enabled", "enabled" },
|
||||
{ "ipmip6pm.interface", "inet.dhcp.relay.server", MIP6PM_INET_DHCP_RELAY_SERVER_ENUM },
|
||||
{ "ipmip6pm.interface", "inet.dhcp.relay.server.override", MIP6PM_INET_DHCP_RELAY_SERVER_OVERRIDE_ENUM },
|
||||
#else
|
||||
{ "ipmip6pm.interface", "inet.dhcp.relay.enabled", "disabled" },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_SERVER_SUPPORT)
|
||||
{ "ipmip6pm.interface", "inet.dhcp.server.enabled", "enabled" },
|
||||
#else
|
||||
{ "ipmip6pm.interface", "inet.dhcp.server.enabled", "disabled" },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LAYER_ADDRESS)
|
||||
{ "ipmip6pm.interface", "FixedMAGLinkLayerAddressOnAllAccessLinks", MIP6PM_FIXED_MAG_LINK_LAYER_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM },
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LOCAL_ADDRESS)
|
||||
{ "ipmip6pm.interface", "FixedMAGLinkLayerAddressOnAllAccessLinks", MIP6PM_FIXED_MAG_LINK_LOCAL_ADDRESS_ON_ALL_ACCESS_LINKS_ENUM },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_DHCP_RELAY)
|
||||
{ "ipmip6pm.interface", "dhcpv6_relay.mode", MIP6PM_DHCP_RELAY_MODE_ENUM },
|
||||
{ "ipmip6pm.interface", "dhcpv6_relay.server", MIP6PM_DHCP_RELAY_SERVER_ENUM },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_RADVD)
|
||||
{ "ipmip6pm.interface", "radvd.AdvManagedFlag", MIP6PM_RADVD_MANAGED_ENUM },
|
||||
{ "ipmip6pm.interface", "radvd.AdvOtherConfigFlag", MIP6PM_RADVD_OTHER_ENUM },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_SERVICE_SELECTION)
|
||||
{ "ipmip6pm.interface", "service_selection", MIP6PM_SERVICE_SELECTION_ENUM },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_VENDOR_EXTENSION)
|
||||
{ "ipmip6pm.service_selection", IP_NULL, MIP6PM_VENDOR_EXTENSION_ENUM },
|
||||
#endif
|
||||
|
||||
{ IP_NULL, IP_NULL, IP_NULL }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_DHCP_RELAY)
|
||||
extern void ipmip6pm_service_dhcpv6_relay_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_RADVD)
|
||||
extern void ipmip6pm_service_radvd_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_SERVICE_SELECTION)
|
||||
extern void ipmip6pm_service_selection_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_VENDOR_EXTENSION)
|
||||
extern void ipmip6pm_service_vendor_extension_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_RELAY_SUPPORT) || defined(INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_SERVER_SUPPORT)
|
||||
extern void ipmip6pm_service_dsmipv6_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_EXTENSION)
|
||||
extern void MIP6PM_SERVICE_FEATURE_INITIALIZATION_HOOK(void *);
|
||||
#endif
|
||||
|
||||
|
||||
Ipmip6pm_config_func_t ipmip6pm_service_registrations[] =
|
||||
{
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_DHCP_RELAY)
|
||||
ipmip6pm_service_dhcpv6_relay_install,
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_RADVD)
|
||||
ipmip6pm_service_radvd_install,
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_SERVICE_SELECTION)
|
||||
ipmip6pm_service_selection_install,
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_VENDOR_EXTENSION)
|
||||
ipmip6pm_service_vendor_extension_install,
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_RELAY_SUPPORT) || defined(INCLUDE_IPMIP6PM_DUAL_STACK_DHCP_SERVER_SUPPORT)
|
||||
ipmip6pm_service_dsmipv6_install,
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_SERVICE_FEATURE_EXTENSION)
|
||||
MIP6PM_SERVICE_FEATURE_INITIALIZATION_HOOK,
|
||||
#endif
|
||||
IP_NULL
|
||||
};
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LAYER_ADDRESS)
|
||||
extern void ipmip6pm_link_address_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LOCAL_ADDRESS)
|
||||
extern void ipmip6pm_link_local_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_EXTENSION)
|
||||
extern void MIP6PM_LINK_FEATURE_INITIALIZATION_HOOK(void *);
|
||||
#endif
|
||||
|
||||
|
||||
Ipmip6pm_config_func_t ipmip6pm_link_registrations[] =
|
||||
{
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LAYER_ADDRESS)
|
||||
ipmip6pm_link_address_install,
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_LINK_LOCAL_ADDRESS)
|
||||
ipmip6pm_link_local_install,
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6PM_LINK_FEATURE_EXTENSION)
|
||||
MIP6PM_LINK_FEATURE_INITIALIZATION_HOOK,
|
||||
#endif
|
||||
IP_NULL
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_configure
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6pm_configure(void);
|
||||
IP_PUBLIC Ip_err
|
||||
ipmip6pm_configure(void)
|
||||
{
|
||||
/* Initialize IPMIPMN system variables. */
|
||||
/* Initialize IPMIPMN system variables. */
|
||||
if (ipcom_sysvar_setv(ipmip6pm_conf_sysvar, 0) == IPCOM_SUCCESS)
|
||||
{
|
||||
/* now configure the interface-specific sysvars */
|
||||
#if defined(INCLUDE_IPMIP6MN)
|
||||
return ipcom_sysvar_ext_setv (ipmip6pm_conf_sysvar_ext, 0);
|
||||
#else
|
||||
return IPCOM_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
ipcom_sysvar_setv(ipmip6pm_conf_sysvar, 0);
|
||||
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_init
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6pm_init(void);
|
||||
IP_PUBLIC Ip_err
|
||||
ipmip6pm_init(void)
|
||||
{
|
||||
#if defined(INCLUDE_IPMIP6PM_CMD) && !defined(IP_PORT_LAS)
|
||||
ipcom_shell_add_cmd("pm6", "pm6 <command> [modifiers]", "Mobile IPv6 Proxy Mobility",
|
||||
ipmip6pm_cmd_pm6,
|
||||
IPCOM_PRIORITY_DEFAULT, IPCOM_PROC_STACK_SMALL);
|
||||
#endif
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_exit
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6pm_exit(void);
|
||||
IP_PUBLIC Ip_err
|
||||
ipmip6pm_exit(void)
|
||||
{
|
||||
#if defined(INCLUDE_IPMIP6PM_CMD) && !defined(IP_PORT_LAS)
|
||||
/* Remove the shell command */
|
||||
ipcom_shell_remove_cmd("pm6", ipmip6pm_cmd_pm6);
|
||||
#endif
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK CONFIGURATION HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_config.h,v $ $Revision: 1.8 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_config.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-03-02 11:44:40 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_CONFIG_H
|
||||
#define IPMIP6PM_CONFIG_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#ifdef IP_DEBUG
|
||||
#define IPMIP6PM_EVENT_BACKLOG 300
|
||||
#else
|
||||
#define IPMIP6PM_EVENT_BACKLOG 100
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MULTICAST status changes over CLI sockets that has requested
|
||||
* it.
|
||||
*/
|
||||
#define IPMIP6PM_MULTICAST_STATUS 1
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip_proc;
|
||||
|
||||
typedef Ip_bool (*Ipmip6pm_init_func_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx
|
||||
);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/* Callbacks */
|
||||
extern Ipmip6pm_init_func_t ipmip6pm_service_registrations[];
|
||||
extern Ipmip6pm_init_func_t ipmip6pm_link_registrations[];
|
||||
|
||||
IP_PUBLIC Ip_err ipmip6pm_init(void);
|
||||
IP_PUBLIC Ip_err ipmip6pm_exit(void);
|
||||
IP_PUBLIC Ip_err ipmip6pm_configure(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,370 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_link_address.c,v $ $Revision: 1.9 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_link_address.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipnet.h>
|
||||
#include <ipnet_policy_routing.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_LINK_ADDRESS_NAME "LINK-ADDRESS"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipmip6pm_link_address_config_global
|
||||
{
|
||||
Ipmip_lladdr_t *FixedMAGLinkLayerAddressOnAllAccessLinks;
|
||||
} Ipmip6pm_link_address_config_global_t;
|
||||
|
||||
typedef struct Ipmip6pm_link_address_config
|
||||
{
|
||||
Ipmip_lladdr_t *FixedMAGLinkLayerAddressOnAllAccessLinks;
|
||||
} Ipmip6pm_link_address_config_t;
|
||||
|
||||
typedef struct Ipmip6pm_link_address_node_config
|
||||
{
|
||||
Ipmip_lladdr_t *LinkLayerAddress;
|
||||
} Ipmip6pm_link_address_node_config_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_link_address_config_global(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_link_address_config_global_t *gcfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
char *dptr;
|
||||
|
||||
dptr = ipmip_sysvar("ipmip6pm.FixedMAGLinkLayerAddressOnAllAccessLinks");
|
||||
|
||||
/**/
|
||||
if (dptr != IP_NULL)
|
||||
{
|
||||
gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks = ipmip_lladdr_parse(proc, 0, 0, dptr);
|
||||
/**/
|
||||
ipcom_free(dptr);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
if (gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks)
|
||||
{
|
||||
ipcom_free(gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks);
|
||||
gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.FixedMAGLinkLayerAddressOnAllAccessLinks=%s",
|
||||
ipmip_ntop_lladdr(proc, gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_link_address_config(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6pm_link_address_config_global_t *gcfg,
|
||||
Ipmip6pm_link_address_config_t *cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
char *dptr;
|
||||
|
||||
dptr = ipmip_sysvar("ipmip6pm.interface.%s.FixedMAGLinkLayerAddressOnAllAccessLinks", ifp->ipmip6.iff.ifname);
|
||||
|
||||
/**/
|
||||
if (dptr != IP_NULL)
|
||||
{
|
||||
cfg->FixedMAGLinkLayerAddressOnAllAccessLinks = ipmip_lladdr_parse(proc, 0, 0, dptr);
|
||||
/**/
|
||||
ipcom_free(dptr);
|
||||
}
|
||||
else if (gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks)
|
||||
{
|
||||
cfg->FixedMAGLinkLayerAddressOnAllAccessLinks = ipmip_lladdr_dup(gcfg->FixedMAGLinkLayerAddressOnAllAccessLinks);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
if (cfg->FixedMAGLinkLayerAddressOnAllAccessLinks)
|
||||
{
|
||||
ipcom_free(cfg->FixedMAGLinkLayerAddressOnAllAccessLinks);
|
||||
cfg->FixedMAGLinkLayerAddressOnAllAccessLinks = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (cfg->FixedMAGLinkLayerAddressOnAllAccessLinks)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.FixedMAGLinkLayerAddressOnAllAccessLinks=%s",
|
||||
ifp->ipmip6.iff.ifname, ipmip_ntop_lladdr(proc, cfg->FixedMAGLinkLayerAddressOnAllAccessLinks));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_link_address_provide(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_link_address_config_global_t *gcfg,
|
||||
Ipmip6pm_link_address_config_t *ifcfg,
|
||||
Ipmip6pm_link_address_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_ENABLE)
|
||||
{
|
||||
int ret;
|
||||
Ipmip_lladdr_t *lla = nodecfg->LinkLayerAddress? nodecfg->LinkLayerAddress : ifcfg->FixedMAGLinkLayerAddressOnAllAccessLinks;
|
||||
|
||||
/* Must stop interface for assignment */
|
||||
#if 0
|
||||
ipmip_if_clear_flags(&ctx->ipmip6.ipmip, proc, &node->ifp_private.ipmip6.ifp->iff, IP_IFF_UP);
|
||||
#endif
|
||||
|
||||
/* Assign LLADDR */
|
||||
if ((ret = ipmip_netlink_link(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_RTM_SETLINK,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
0,
|
||||
0,
|
||||
IPMIP_LLADDR_DATA(lla),
|
||||
IPMIP_LLADDR_LEN_LLA(lla),
|
||||
0)) != 0)
|
||||
{
|
||||
/* Do something */
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Proxy Mobile node %s interface %s unable to assign Link-Layer address (%d)",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
node->ifp_private.ipmip6.ifp->iff.ifname,
|
||||
-ret));
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
ipmip_if_set_flags(&ctx->ipmip6.ipmip, proc, &node->ifp_private.ipmip6.ifp->iff, IP_IFF_UP);
|
||||
#endif
|
||||
/* Re-resolve LLA */
|
||||
ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, node->ifp_private.ipmip6.ifp->iff_lock);
|
||||
ipmip_if_resolve_lla(&ctx->ipmip6.ipmip, proc, &node->ifp_private.ipmip6.ifp->iff);
|
||||
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, node->ifp_private.ipmip6.ifp->iff_lock);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE)
|
||||
{
|
||||
}
|
||||
|
||||
/* Don't delay */
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_link_address_setup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_link_address_config_global_t *gcfg,
|
||||
Ipmip6pm_link_address_config_t *ifcfg,
|
||||
Ipmip6pm_link_address_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* Turned off in configuration */
|
||||
if (value == IP_NULL)
|
||||
return ifcfg->FixedMAGLinkLayerAddressOnAllAccessLinks != IP_NULL;
|
||||
|
||||
if (nodecfg->LinkLayerAddress)
|
||||
ipcom_free(nodecfg->LinkLayerAddress);
|
||||
nodecfg->LinkLayerAddress = ipmip_lladdr_parse(proc, 0, 0, value);
|
||||
return nodecfg->LinkLayerAddress != IP_NULL;
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
if (nodecfg->LinkLayerAddress)
|
||||
{
|
||||
ipcom_free(nodecfg->LinkLayerAddress);
|
||||
nodecfg->LinkLayerAddress = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (nodecfg->LinkLayerAddress)
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_LINK);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_LINK_ADDRESS_NAME);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
ipmip_ntop_lladdr(proc, nodecfg->LinkLayerAddress));
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_link_address_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_link_address_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
static Ipmip6pm_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6PM_LINK_ADDRESS_NAME;
|
||||
srv.syntax = "<MAC ADDRESS>";
|
||||
srv.node_data_size = sizeof(Ipmip6pm_link_address_node_config_t);
|
||||
srv.ifp_data_size = sizeof(Ipmip6pm_link_address_config_t);
|
||||
srv.global_data_size= sizeof(Ipmip6pm_link_address_config_global_t);
|
||||
|
||||
srv.config_global = (Ipmip6pm_extension_config_global_t)ipmip6pm_link_address_config_global;
|
||||
srv.config_ifp = (Ipmip6pm_extension_config_ifp_t)ipmip6pm_link_address_config;
|
||||
srv.provide = (Ipmip6pm_extension_provide_t)ipmip6pm_link_address_provide;
|
||||
srv.setup = (Ipmip6pm_extension_setup_t)ipmip6pm_link_address_setup;
|
||||
|
||||
ipmip6pm_context_register_extension(ctx, &srv, IPMIP6PM_FUNCTION_LINK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,440 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_link_local.c,v $ $Revision: 1.5 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_link_local.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipnet.h>
|
||||
#include <ipnet_policy_routing.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_LINK_LOCAL_NAME "LINK-LOCAL"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct Ipmip6pm_link_local_config_global
|
||||
{
|
||||
Ipmip6_address_t FixedMAGLinkLocalAddressOnAllAccessLinks;
|
||||
Ip_bool FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO;
|
||||
} Ipmip6pm_link_local_config_global_t;
|
||||
|
||||
typedef struct Ipmip6pm_link_local_config
|
||||
{
|
||||
Ipmip6_address_t FixedMAGLinkLocalAddressOnAllAccessLinks;
|
||||
Ip_bool FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO;
|
||||
} Ipmip6pm_link_local_config_t;
|
||||
|
||||
typedef struct Ipmip6pm_link_local_node_config
|
||||
{
|
||||
Ipmip6_address_t FixedMAGLinkLocalAddressOnAllAccessLinks;
|
||||
} Ipmip6pm_link_local_node_config_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_link_local_request_req_accept(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_link_local_config_global_t *gcfg,
|
||||
Ipmip6pm_link_local_config_t *ifcfg,
|
||||
Ipmip6pm_link_local_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (ifcfg->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO)
|
||||
{
|
||||
if (pbuf->ipmip6.mo.pmipv6_link_local_address != IP_NULL)
|
||||
ipcom_memcpy(&nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, &pbuf->ipmip6.mo.pmipv6_link_local_address->prefix, sizeof(struct Ip_in6_addr));
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_link_local_request_rep_apply(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_link_local_config_global_t *gcfg,
|
||||
Ipmip6pm_link_local_config_t *ifcfg,
|
||||
Ipmip6pm_link_local_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (ifcfg->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO)
|
||||
{
|
||||
Ipmip6_mh_mo_pmipv6_link_local_address_t ll;
|
||||
|
||||
ll.hdr.val = IPMIP6_MH_MO_PMIPV6_LINK_LOCAL_ADDRESS_OPTION;
|
||||
ll.hdr.len = 16;
|
||||
ipcom_memcpy(&ll.prefix, &nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, sizeof(nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix));
|
||||
|
||||
/* Refresh */
|
||||
ipmip6_mh_pkt_opt_add_mo(&ctx->ipmip6,
|
||||
proc,
|
||||
&pbuf->ipmip6,
|
||||
&ll.hdr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_link_local_config_global(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_link_local_config_global_t *gcfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* Read the prefix list allowed for this interface */
|
||||
ipmip_sysvar_inet6(&ip_in6addr_any, &gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, &gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len, "ipmip6pm.FixedMAGLinkLocalAddressOnAllAccessLinks");
|
||||
|
||||
/* Check if its unspecified */
|
||||
if (IP_IN6_IS_ADDR_UNSPECIFIED(&gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix))
|
||||
gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO = IP_TRUE;
|
||||
|
||||
/**/
|
||||
if (gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len == 0)
|
||||
gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len = 64;
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.FixedMAGLinkLocalAddressOnAllAccessLinks=%s/%d",
|
||||
ipmip_ntop_inet6(proc, &gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, IP_NULL), gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_link_local_config(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6pm_link_local_config_global_t *gcfg,
|
||||
Ipmip6pm_link_local_config_t *cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* Read the prefix list allowed for this interface */
|
||||
if (!ipmip_sysvar_inet6(&gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, &cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, &cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len, "ipmip6pm.interface.%s.FixedMAGLinkLocalAddressOnAllAccessLinks", ifp->ipmip6.iff.ifname))
|
||||
{
|
||||
cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len = gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len;
|
||||
cfg->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO = gcfg->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check if its unspecified */
|
||||
if (IP_IN6_IS_ADDR_UNSPECIFIED(&cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix))
|
||||
cfg->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO = IP_TRUE;
|
||||
|
||||
/**/
|
||||
if (cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len == 0)
|
||||
cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len = 64;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.FixedMAGLinkLocalAddressOnAllAccessLinks=%s/%d",
|
||||
ifp->ipmip6.iff.ifname, ipmip_ntop_inet6(proc, &cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, IP_NULL), cfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_link_local_provide(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_link_local_config_global_t *gcfg,
|
||||
Ipmip6pm_link_local_config_t *ifcfg,
|
||||
Ipmip6pm_link_local_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
IPMIP_UNUSED_PARAMETER(ifcfg);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_ENABLE)
|
||||
{
|
||||
if (!IP_IN6_IS_ADDR_UNSPECIFIED(&nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix))
|
||||
{
|
||||
Ipmip6_if_inet6_t *addr;
|
||||
|
||||
ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, node->ifp_private.ipmip6.ifp->iff_lock);
|
||||
for (addr = IPCOM_LIST_FIRST(&node->ifp_private.ipmip6.ifp->inet6); addr != IP_NULL; addr = IPCOM_LIST_NEXT(&addr->ifa_next))
|
||||
{
|
||||
if (addr->ifa_scope == IP_RT_SCOPE_LINK)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET6,
|
||||
IP_RTM_DELADDR,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
&addr->ifa_address.prefix,
|
||||
addr->ifa_address.len,
|
||||
0,
|
||||
0)) != 0)
|
||||
{
|
||||
/**/
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Proxy Mobile node %s interface %s unable to delete link local address %s/%d = %d",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
node->ifp_private.ipmip6.ifp->iff.ifname,
|
||||
ipmip_ntop_inet6(proc,&addr->ifa_address.prefix, IP_NULL),
|
||||
addr->ifa_address.len,
|
||||
ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET6,
|
||||
IP_RTM_NEWADDR,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
&nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix,
|
||||
nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len,
|
||||
0,
|
||||
0) != 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Proxy Mobile node %s interface %s unable to add link local address %s/%d",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
node->ifp_private.ipmip6.ifp->iff.ifname,
|
||||
ipmip_ntop_inet6(proc, &nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, IP_NULL),
|
||||
nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len));
|
||||
}
|
||||
|
||||
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, node->ifp_private.ipmip6.ifp->iff_lock);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* Don't delay */
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_link_local_setup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_link_local_config_global_t *gcfg,
|
||||
Ipmip6pm_link_local_config_t *ifcfg,
|
||||
Ipmip6pm_link_local_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len = 64;
|
||||
|
||||
if (value == IP_NULL)
|
||||
{
|
||||
if (!ifcfg->FixedMAGLinkLocalAddressOnAllAccessLinks_ALL_ZERO)
|
||||
ipcom_memcpy(&nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks, &ifcfg->FixedMAGLinkLocalAddressOnAllAccessLinks, sizeof(Ipmip6_address_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
ipmip_util_inet6(value, &nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, &nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len);
|
||||
}
|
||||
|
||||
return IP_TRUE;
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do Nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (!IP_IN6_IS_ADDR_UNSPECIFIED(&nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix))
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_LINK);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_LINK_LOCAL_NAME);
|
||||
|
||||
ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf), "%s/%d",
|
||||
ipmip_ntop_inet6(proc, &nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.prefix, IP_NULL),
|
||||
nodecfg->FixedMAGLinkLocalAddressOnAllAccessLinks.len);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
proc->ntop.ntop_pbuf);
|
||||
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_link_local_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_link_local_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
static Ipmip6pm_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6PM_LINK_LOCAL_NAME;
|
||||
srv.syntax = "<link-local address>";
|
||||
srv.node_data_size = sizeof(Ipmip6pm_link_local_node_config_t);
|
||||
srv.ifp_data_size = sizeof(Ipmip6pm_link_local_config_t);
|
||||
srv.global_data_size= sizeof(Ipmip6pm_link_local_config_global_t);
|
||||
|
||||
srv.config_global = (Ipmip6pm_extension_config_global_t)ipmip6pm_link_local_config_global;
|
||||
srv.config_ifp = (Ipmip6pm_extension_config_ifp_t)ipmip6pm_link_local_config;
|
||||
srv.provide = (Ipmip6pm_extension_provide_t)ipmip6pm_link_local_provide;
|
||||
srv.setup = (Ipmip6pm_extension_setup_t)ipmip6pm_link_local_setup;
|
||||
srv.pkt_rep_accept = (Ipmip6pm_extension_pkt_rep_accept_t)ipmip6pm_link_local_request_req_accept;
|
||||
srv.pkt_req_apply = (Ipmip6pm_extension_pkt_req_apply_t)ipmip6pm_link_local_request_rep_apply;
|
||||
|
||||
ipmip6pm_context_register_extension(ctx, &srv, IPMIP6PM_FUNCTION_LINK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,166 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_pktbuf.c,v $ $Revision: 1.6 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_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 "ipmip6pm_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 "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_pktbuf_alloc
|
||||
*===========================================================================
|
||||
* Description: Allocate a packet buffer
|
||||
* Parameters:
|
||||
* Returns: A newly allocated packet buffer
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipmip_pktbuf_t *
|
||||
ipmip6pm_pktbuf_alloc(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ip_size_t extra)
|
||||
{
|
||||
Ipmip6pm_pktbuf_t *pbuf;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
pbuf = ipcom_calloc(1, sizeof(Ipmip6pm_pktbuf_t) + extra);
|
||||
if (pbuf)
|
||||
{
|
||||
pbuf->ipmip6.ipmip.pktend = (void *) (pbuf + 1);
|
||||
return &pbuf->ipmip6.ipmip;
|
||||
}
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_pktbuf_free
|
||||
*===========================================================================
|
||||
* Description: Free a packet buffer
|
||||
* Parameters: pbuf - The packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_pktbuf_free(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_pktbuf_t *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
/* Free the data */
|
||||
ipcom_free(pbuf);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,149 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_pktbuf.h,v $ $Revision: 1.10 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_pktbuf.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-12-02 15:33:30 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_PKTBUF_H
|
||||
#define IPMIP6PM_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 Ipmip6pm_if;
|
||||
struct Ipmip6_if;
|
||||
struct Ipmip6pm_context;
|
||||
|
||||
typedef struct Ipmip6pm_pktbuf_pktinfo
|
||||
{
|
||||
struct Ip_in6_addr *src;
|
||||
struct Ip_in6_addr *home;
|
||||
|
||||
Ip_u8 iperr;
|
||||
Ip_u8 pmBindingStatus;
|
||||
Ip_u16 pmMobilityBindingTimeGranted;
|
||||
|
||||
Ip_u16 pmMobilityBindingSequenceNumber;
|
||||
Ip_u16 pmMobilityBindingFlags;
|
||||
|
||||
Ip_time_t pmBindingLastUpdated;
|
||||
|
||||
Ip_bool pmMobilityDeregistration;
|
||||
Ip_u32 pmMobilityBindingRefresh;
|
||||
Ip_u32 pmMobilityTransport;
|
||||
Ip_bool pmMobilityTransportChanged;
|
||||
Ip_u32 *pmMobilityTransportGREUplink;
|
||||
|
||||
} Ipmip6pm_pktbuf_pktinfo_t;
|
||||
|
||||
typedef struct Ipmip6pm_pktbuf
|
||||
{
|
||||
Ipmip6_pktbuf_t ipmip6;
|
||||
|
||||
Ip_u32 state;
|
||||
|
||||
Ip_u32 processed[IPMIP6PM_FUNCTION_MAX];
|
||||
|
||||
Ipmip6pm_pktbuf_pktinfo_t pktinfo;
|
||||
|
||||
union
|
||||
{
|
||||
struct Ipmip6pm_if *priv;
|
||||
struct Ipmip6_if *pub;
|
||||
} iff;
|
||||
|
||||
void **extdata[IPMIP6PM_FUNCTION_MAX];
|
||||
} Ipmip6pm_pktbuf_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_pktbuf_alloc
|
||||
*===========================================================================
|
||||
* Description: Allocate a packet buffer
|
||||
* Parameters: ctx - Context
|
||||
* proc - Process
|
||||
* Returns: A newly allocated packet buffer
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipmip_pktbuf_t *ipmip6pm_pktbuf_alloc(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ip_size_t extra);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_pktbuf_free
|
||||
*===========================================================================
|
||||
* Description: Free a packet buffer
|
||||
* Parameters: ctx - Context
|
||||
* proc - Process
|
||||
* pbuf - The packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipmip6pm_pktbuf_free(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_pktbuf_t *pbuf);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,496 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_service_dhcpv6_relay.c,v $ $Revision: 1.7 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_service_dhcpv6_relay.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
#include <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_inet6.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 "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_SERVICE_DHCPV6_RELAY_NAME "DHCPV6_RELAY"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct Ipmip6pm_service_dhcpv6_relay_fwd
|
||||
{
|
||||
Ip_u32 ifindex;
|
||||
struct Ip_in6_addr srv;
|
||||
} Ipmip6pm_service_dhcpv6_relay_fwd_t;
|
||||
|
||||
typedef struct Ipmip6pm_service_dhcpv6_relay_config
|
||||
{
|
||||
int mode;
|
||||
Ip_u32 ifscope;
|
||||
struct Ip_in6_addr *srv;
|
||||
} Ipmip6pm_service_dhcpv6_relay_config_t;
|
||||
|
||||
typedef struct Ipmip6pm_service_dhcpv6_relay_handle
|
||||
{
|
||||
Ipmip_dhcp6_node_t relay;
|
||||
Ip_u32 ifscope;
|
||||
struct Ip_in6_addr *srv;
|
||||
Ipmip6_address_t link_address;
|
||||
Ip_bool enabled;
|
||||
Ip_bool registered;
|
||||
} Ipmip6pm_service_dhcpv6_relay_handle_t;
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_service_dhcpv6_relay(int event,
|
||||
Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_service_dhcpv6_relay_handle_t *dnode,
|
||||
Ipmip6pm_pktbuf_t *pbuf)
|
||||
{
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
Ipmip_dhcp6_hdr_t *pkt = (Ipmip_dhcp6_hdr_t *)IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
|
||||
Ipmip_dhcp6_relay_hdr_t *rpkt = (Ipmip_dhcp6_relay_hdr_t *)IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
|
||||
Ip_u8 hc = 0;
|
||||
|
||||
/* Sanity process */
|
||||
switch (pkt->msg_type)
|
||||
{
|
||||
/**/
|
||||
case IPMIP_DHCP6_MSG_RELAY_REPLY:
|
||||
/* Must forward to client */
|
||||
{
|
||||
Ipmip_dhcp6_option_hdr_t *rmsg = ipmip_dhcp6_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP6_OPTION_RELAY_MSG);
|
||||
if (rmsg == IP_NULL)
|
||||
goto done_out;
|
||||
|
||||
/* Do forward */
|
||||
ipmip_dhcp6_send_msg(&ctx->ipmip6.ipmip, proc, rmsg + 1, IP_GET_NTOHS(&rmsg->length), &rpkt->peer_addr, dnode->relay.ifindex);
|
||||
}
|
||||
break;
|
||||
case IPMIP_DHCP6_MSG_RELAY_FORWARD:
|
||||
hc = rpkt->hop_count;
|
||||
/* Fall Through */
|
||||
default:
|
||||
{
|
||||
Ipmip_pktbuf_t *rpbuf = (Ipmip_pktbuf_t *)ipmip_dhcp6_relay_msg(&ctx->ipmip6.ipmip, proc, &dnode->link_address.prefix, hc, &pbuf->ipmip6.ipmip);
|
||||
if (rpbuf)
|
||||
{
|
||||
ipmip_dhcp6_send_msg(&ctx->ipmip6.ipmip, proc, IPMIP_BUFFER_DATA(&rpbuf->packet), IPMIP_BUFFER_SIZE(&rpbuf->packet), dnode->srv, dnode->ifscope);
|
||||
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, rpbuf);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the DHCP packet */
|
||||
done_out:
|
||||
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
||||
return IPMIP_TIMER_RET_DONE;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_dhcpv6_relay_parse(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ip_in6_addr **addr,
|
||||
Ip_u32 *ifscope,
|
||||
const char *value)
|
||||
{
|
||||
/* Scope? */
|
||||
if (((*ifscope) = ipcom_if_nametoindex(value)) == 0)
|
||||
{
|
||||
*addr = ipcom_malloc(sizeof(struct Ip_in6_addr));
|
||||
if (!ipmip_util_inet6(value, *addr, IP_NULL))
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to properly parse DHCPv6 Relay Destination %s",
|
||||
value));
|
||||
|
||||
ipcom_free(*addr);
|
||||
*addr = IP_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_dhcpv6_relay_config_global(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_dhcpv6_relay_config_t *gcfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
char *fwd = ipmip_sysvar("ipmip6pm.dhcpv6_relay.server");
|
||||
gcfg->mode = ipmip_sysvar_mode(IPMIP_SYSVAR_MODE_OPTIONAL, "ipmip6pm.dhcpv6_relay.mode");
|
||||
if (fwd)
|
||||
{
|
||||
ipmip6pm_service_dhcpv6_relay_parse(ctx, proc, &gcfg->srv, &gcfg->ifscope, fwd);
|
||||
ipcom_free(fwd);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
if (gcfg->srv)
|
||||
ipcom_free(gcfg->srv);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.dhcpv6_relay.mode=%s",
|
||||
ipmip_sysvar_mode_desc[gcfg->mode]);
|
||||
|
||||
if (gcfg->ifscope)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.dhcpv6_relay.server=%s",
|
||||
ipcom_if_indextoname(gcfg->ifscope, proc->ntop.ntop_name));
|
||||
}
|
||||
else if (gcfg->srv != IP_NULL)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.dhcpv6_relay.server=%s",
|
||||
ipmip_ntop_inet6(proc, gcfg->srv, IP_NULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_dhcpv6_relay_config(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6pm_service_dhcpv6_relay_config_t *gcfg,
|
||||
Ipmip6pm_service_dhcpv6_relay_config_t *cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
char *fwd = ipmip_sysvar("ipmip6pm.interface.%s.dhcpv6_relay.server", ifp->ipmip6.iff.ifname);
|
||||
cfg->mode = ipmip_sysvar_mode(gcfg->mode, "ipmip6pm.interface.%s.dhcpv6_relay.mode", ifp->ipmip6.iff.ifname);
|
||||
if (fwd)
|
||||
{
|
||||
ipmip6pm_service_dhcpv6_relay_parse(ctx, proc, &cfg->srv, &cfg->ifscope, fwd);
|
||||
ipcom_free(fwd);
|
||||
}
|
||||
|
||||
if (cfg->srv == IP_NULL && cfg->ifscope == 0)
|
||||
{
|
||||
cfg->srv = gcfg->srv;
|
||||
cfg->ifscope = gcfg->ifscope;
|
||||
}
|
||||
|
||||
if (cfg->mode != IPMIP_SYSVAR_MODE_DISABLED)
|
||||
{
|
||||
/* We need the DHCP context */
|
||||
ipmip_dhcp6_context_create(&ctx->ipmip6.ipmip, proc);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
if (cfg->srv != IP_NULL && cfg->srv != gcfg->srv)
|
||||
{
|
||||
ipcom_free(cfg->srv);
|
||||
cfg->srv = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.dhcpv6_relay.mode=%s",
|
||||
ifp->ipmip6.iff.ifname, ipmip_sysvar_mode_desc[cfg->mode]);
|
||||
|
||||
if (cfg->ifscope)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.dhcpv6_relay.server=%s",
|
||||
ifp->ipmip6.iff.ifname, ipcom_if_indextoname(cfg->ifscope, proc->ntop.ntop_name));
|
||||
}
|
||||
else if (cfg->srv)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.dhcpv6_relay.server=%s",
|
||||
ifp->ipmip6.iff.ifname, ipmip_ntop_inet6(proc, cfg->srv, IP_NULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_service_dhcpv6_relay_provide(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_dhcpv6_relay_config_t *gcfg,
|
||||
Ipmip6pm_service_dhcpv6_relay_config_t *cfg,
|
||||
Ipmip6pm_service_dhcpv6_relay_handle_t *handle,
|
||||
struct Ipmip6pm_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)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* OK - MUST ASSIGN ADDRESS BASED ON ALLOCATED PREFIX */
|
||||
/* Do the prefixes */
|
||||
for (i = 0; i < node->mo_home_prefix_size; i++)
|
||||
{
|
||||
if (ipmip6_netlink_prefix_generate(&ctx->ipmip6,
|
||||
proc,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
&node->mo_home_prefix[i].prefix,
|
||||
node->mo_home_prefix[i].prefix_length,
|
||||
&handle->link_address))
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/**/
|
||||
if (i < node->mo_home_prefix_size)
|
||||
ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET6, IP_RTM_NEWADDR, node->ifp_private.ipmip6.ifp->iff.ifindex, &handle->link_address.prefix, handle->link_address.len, 0, 0);
|
||||
|
||||
handle->relay.ifindex = node->ifp_private.ipmip6.ifp->iff.ifindex;
|
||||
handle->relay.lock = node->lock;
|
||||
handle->relay.process_func = (Ipmip_timer_func_t)ipmip6pm_service_dhcpv6_relay;
|
||||
handle->registered = IP_TRUE;
|
||||
ipmip_dhcp6_register(&ctx->ipmip6.ipmip, proc, &handle->relay);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE)
|
||||
{
|
||||
if (handle->registered)
|
||||
{
|
||||
ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET6, IP_RTM_DELADDR, node->ifp_private.ipmip6.ifp->iff.ifindex, &handle->link_address.prefix, handle->link_address.len, 0, 0);
|
||||
handle->registered = IP_FALSE;
|
||||
ipmip_dhcp6_unregister(&ctx->ipmip6.ipmip, proc, &handle->relay);
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't delay */
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_service_dhcpv6_relay_setup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_dhcpv6_relay_config_t *gcfg,
|
||||
Ipmip6pm_service_dhcpv6_relay_config_t *cfg,
|
||||
Ipmip6pm_service_dhcpv6_relay_handle_t *handle,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* Turned off in configuration */
|
||||
if (cfg->mode == IPMIP_SYSVAR_MODE_DISABLED)
|
||||
return IP_FALSE;
|
||||
|
||||
/* Turned on by node */
|
||||
if (value == IP_NULL && cfg->mode == IPMIP_SYSVAR_MODE_OPTIONAL)
|
||||
return IP_FALSE;
|
||||
|
||||
handle->enabled = IP_TRUE;
|
||||
if (value && ipcom_strlen(value))
|
||||
ipmip6pm_service_dhcpv6_relay_parse(ctx, proc, &handle->srv, &handle->ifscope, value);
|
||||
|
||||
if (handle->srv == IP_NULL && handle->ifscope == 0)
|
||||
{
|
||||
handle->srv = cfg->srv;
|
||||
handle->ifscope = cfg->ifscope;
|
||||
}
|
||||
|
||||
/* Rever to home agent */
|
||||
if (handle->srv == IP_NULL && handle->ifscope == 0)
|
||||
handle->srv = &node->homeagent;
|
||||
|
||||
return IP_TRUE;
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
handle->enabled = IP_FALSE;
|
||||
if (handle->srv != IP_NULL && handle->srv != cfg->srv && handle->srv != &node->homeagent)
|
||||
{
|
||||
ipcom_free(handle->srv);
|
||||
handle->srv = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (handle->enabled)
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_SERVICE_DHCPV6_RELAY_NAME);
|
||||
|
||||
if (handle->ifscope)
|
||||
{
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
ipcom_if_indextoname(handle->ifscope, proc->ntop.ntop_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
ipmip_ntop_inet6(proc, handle->srv, IP_NULL));
|
||||
}
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_service_dhcpv6_relay_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_service_dhcpv6_relay_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
static Ipmip6pm_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6PM_SERVICE_DHCPV6_RELAY_NAME;
|
||||
srv.syntax = "<interface_name|dhcpv6 server address>";
|
||||
srv.node_data_size = sizeof(Ipmip6pm_service_dhcpv6_relay_handle_t);
|
||||
srv.ifp_data_size = sizeof(Ipmip6pm_service_dhcpv6_relay_config_t);
|
||||
srv.global_data_size= sizeof(Ipmip6pm_service_dhcpv6_relay_config_t);
|
||||
|
||||
srv.config_global = (Ipmip6pm_extension_config_global_t)ipmip6pm_service_dhcpv6_relay_config_global;
|
||||
srv.config_ifp = (Ipmip6pm_extension_config_ifp_t)ipmip6pm_service_dhcpv6_relay_config;
|
||||
srv.provide = (Ipmip6pm_extension_provide_t)ipmip6pm_service_dhcpv6_relay_provide;
|
||||
srv.setup = (Ipmip6pm_extension_setup_t)ipmip6pm_service_dhcpv6_relay_setup;
|
||||
|
||||
ipmip6pm_context_register_extension(ctx, &srv, IPMIP6PM_FUNCTION_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,950 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_service_dsmipv6.c,v $ $Revision: 1.10 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_service_dsmipv6.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 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 <private/ipmip_inet.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_SERVICE_DSMIPV6_NAME "DSMIPV6"
|
||||
|
||||
#define IPMIP6PM_SERVICE_INSTALLED_DHCP (1 << 0)
|
||||
#define IPMIP6PM_SERVICE_INSTALLED_ARP (1 << 1)
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct Ipmip6pm_service_dsmipv6_config_global
|
||||
{
|
||||
struct
|
||||
{
|
||||
Ip_bool enabled;
|
||||
} server_config;
|
||||
|
||||
struct
|
||||
{
|
||||
Ip_bool enabled;
|
||||
Ip_u32 forward;
|
||||
Ip_bool override;
|
||||
Ip_bool link_selection;
|
||||
} relay_config;
|
||||
} Ipmip6pm_service_dsmipv6_config_global_t;
|
||||
|
||||
|
||||
typedef struct Ipmip6pm_service_dsmipv6_config
|
||||
{
|
||||
struct
|
||||
{
|
||||
Ip_bool enabled;
|
||||
} server_config;
|
||||
|
||||
struct
|
||||
{
|
||||
Ip_bool enabled;
|
||||
Ip_u32 forward;
|
||||
Ip_bool override;
|
||||
Ip_bool link_selection;
|
||||
} relay_config;
|
||||
} Ipmip6pm_service_dsmipv6_config_t;
|
||||
|
||||
|
||||
typedef struct Ipmip6pm_service_dsmipv6_relay
|
||||
{
|
||||
Ip_u32 forward;
|
||||
} Ipmip6pm_service_dsmipv6_relay_t;
|
||||
|
||||
typedef struct Ipmip6pm_service_dsmipv6_node
|
||||
{
|
||||
/* MUST be first */
|
||||
Ipmip_dhcp_node_t dhcp;
|
||||
Ipmip_arp_node_t arp;
|
||||
|
||||
Ip_u32 installed;
|
||||
|
||||
Ipmip6pm_service_dsmipv6_relay_t relay_data;
|
||||
|
||||
Ip_bool relay;
|
||||
Ip_u32 gateway;
|
||||
|
||||
Ipmip6pm_service_dsmipv6_config_t *cfg;
|
||||
} Ipmip6pm_service_dsmipv6_node_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_service_dsmipv6_arp(int event,
|
||||
Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_arp_node_t *arp,
|
||||
Ipmip6pm_pktbuf_t *pbuf)
|
||||
{
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
Ipmip_arp_hdr_t *pkt = (Ipmip_arp_hdr_t *)IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
|
||||
Ipmip6pm_node_t *node = arp->opaque;
|
||||
|
||||
|
||||
if (pkt->op == IPMIP_ARP_OP_REQUEST)
|
||||
{
|
||||
/* Don't reply to the node's own */
|
||||
if (IP_GET_32ON8(&pkt->ip_dst[0]) != node->mo_dsmipv6_home_prefix.prefix)
|
||||
{
|
||||
IPMIP6_EVENT_IF(DEBUG2, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"ARP Request Received by %s",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
|
||||
|
||||
ipmip_inet_arp_reply(&ctx->ipmip6.ipmip, proc, pkt, &node->ifp_private.ipmip6.ifp->iff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the DHCP packet */
|
||||
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
||||
return IPMIP_TIMER_RET_DONE;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_service_dsmipv6_dhcpv4_relay(int event,
|
||||
Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_service_dsmipv6_node_t *dnode,
|
||||
Ipmip6pm_pktbuf_t *pbuf)
|
||||
{
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
Ipmip6pm_node_t *node = dnode->dhcp.opaque;
|
||||
int ra_opt;
|
||||
Ipmip_dhcp_hdr_t *pkt = (Ipmip_dhcp_hdr_t *)IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
|
||||
Ip_u8 *opt;
|
||||
|
||||
opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_DHCP_MESSAGE_TYPE);
|
||||
|
||||
if (pkt->op == IPMIP_DHCP_OP_BOOTREQUEST)
|
||||
{
|
||||
if (opt == IP_NULL)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Request Received by %s contained no MESSAGE_TYPE",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
goto done_out;
|
||||
}
|
||||
|
||||
if (opt[IPMIP_DHCP_OPT_DATA] == IPMIP_DHCP_MSG_REQUEST)
|
||||
{
|
||||
Ip_u32 ciaddr = IP_GET_32ON8(&pkt->ciaddr);
|
||||
|
||||
if (ciaddr == 0)
|
||||
ciaddr = ipmip_dhcp_option_buffer_find_ip(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_DHCP_REQUESTED_ADDRESS);
|
||||
|
||||
|
||||
if (ciaddr != node->mo_dsmipv6_home_prefix.prefix)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP REQUEST Received for %s CIADDR mismatch %s != %s",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
ipmip_ntop_inet(proc, ciaddr),
|
||||
ipmip_ntop_inet(proc, node->mo_dsmipv6_home_prefix.prefix)));
|
||||
goto done_out;
|
||||
}
|
||||
}
|
||||
|
||||
IPMIP6_EVENT_IF(DEBUG, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Request Received by %s relaying to %s",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
ipmip_ntop_inet(proc, dnode->relay_data.forward)));
|
||||
|
||||
/* */
|
||||
IP_SET_32ON8(&pkt->giaddr, node->ifp_public->ifinet);
|
||||
pkt->hops++;
|
||||
|
||||
/**/
|
||||
ipmip_dhcp_option_buffer_open(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_END);
|
||||
|
||||
/**/
|
||||
ra_opt = ipmip_dhcp_option_buffer_init(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_RELAY_AGENT_INFO);
|
||||
if (dnode->cfg->relay_config.link_selection)
|
||||
ipmip_dhcp_option_buffer_append(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_SUBOPTCODE_RA_LINK_SELECTION, sizeof(Ip_u32), &node->mo_dsmipv6_home_prefix.prefix);
|
||||
if (dnode->cfg->relay_config.override)
|
||||
ipmip_dhcp_option_buffer_append(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_SUBOPTCODE_RA_SERVER_OVERRIDE, sizeof(Ip_u32), &dnode->gateway);
|
||||
ipmip_dhcp_option_buffer_append(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_SUBOPTCODE_RA_REMOTE_ID, sizeof(Ip_u32), &node->mo_dsmipv6_home_prefix.prefix);
|
||||
ipmip_dhcp_option_buffer_append(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_SUBOPTCODE_RA_CIRCUIT_ID, sizeof(Ip_u32), &dnode->dhcp.ifindex);
|
||||
ipmip_dhcp_option_buffer_end(&pbuf->ipmip6.ipmip.packet, ra_opt);
|
||||
|
||||
ipmip_dhcp_option_buffer_close(&pbuf->ipmip6.ipmip.packet);
|
||||
|
||||
/* */
|
||||
ipmip_dhcp_relay_to_server(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip, node->ifp_public->ifinet, dnode->relay_data.forward);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipmip6pm_if_priv_t *ifp = (Ipmip6pm_if_priv_t *)node->ifp_private.ipmip6.ifp;
|
||||
|
||||
if (opt == IP_NULL)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Reply Received for %s contained no MESSAGE_TYPE",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
goto done_out;
|
||||
}
|
||||
|
||||
/**/
|
||||
if (opt[IPMIP_DHCP_OPT_DATA] == IPMIP_DHCP_MSG_OFFER)
|
||||
{
|
||||
if (IP_GET_32ON8(&pkt->yiaddr) != node->mo_dsmipv6_home_prefix.prefix)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP OFFER Received for %s YIADDR mismatch %s != %s",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
ipmip_ntop_inet(proc, IP_GET_32ON8(&pkt->yiaddr)),
|
||||
ipmip_ntop_inet(proc,node->mo_dsmipv6_home_prefix.prefix)));
|
||||
goto done_out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IPMIP6_EVENT_IF(DEBUG, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Reply Received for %s",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
|
||||
ipmip_dhcp_write_to_client(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip, dnode->gateway, &ifp->ipmip6.iff, IP_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the DHCP packet */
|
||||
done_out:
|
||||
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
||||
return IPMIP_TIMER_RET_DONE;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_service_dsmipv6_dhcpv4_server(int event,
|
||||
Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_service_dsmipv6_node_t *dnode,
|
||||
Ipmip6pm_pktbuf_t *pbuf)
|
||||
{
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
Ipmip6pm_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 (IP_GET_32ON8(&pkt->giaddr) == 0 && ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_RELAY_AGENT_INFO) == IP_NULL)
|
||||
{
|
||||
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",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
goto done_out;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipmip6pm_pktbuf_t *rpkt = (Ipmip6pm_pktbuf_t*)ipmip_pktbuf_alloc(&ctx->ipmip6.ipmip, proc, 512);
|
||||
Ipmip_buffer_t *buf = &rpkt->ipmip6.ipmip.packet;
|
||||
Ip_u8 type;
|
||||
#if 0
|
||||
Ip_u8 *req_opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_DHCP_PARAMETER_REQUEST_LIST);
|
||||
#endif
|
||||
Ip_u32 tmp32;
|
||||
|
||||
/* Add the packet */
|
||||
ipmip_buffer_append(buf, pkt, sizeof(*pkt));
|
||||
|
||||
|
||||
switch(opt[IPMIP_DHCP_OPT_DATA])
|
||||
{
|
||||
case IPMIP_DHCP_MSG_DISCOVER:
|
||||
IPMIP6_EVENT_IF(DEBUG, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Discover Received by %s",
|
||||
ipmip6pm_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(DEBUG, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Request Received by %s",
|
||||
ipmip6pm_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 != dnode->gateway)
|
||||
goto done_out;
|
||||
|
||||
if (req_addr != 0 && req_addr == node->mo_dsmipv6_home_prefix.prefix)
|
||||
type = IPMIP_DHCP_MSG_ACK;
|
||||
else
|
||||
type = IPMIP_DHCP_MSG_NAK;
|
||||
}
|
||||
break;
|
||||
case IPMIP_DHCP_MSG_DECLINE:
|
||||
/* Do what? */
|
||||
IPMIP6_EVENT_IF(DEBUG, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Decline Received by %s",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
goto done_out;
|
||||
|
||||
case IPMIP_DHCP_MSG_RELEASE:
|
||||
/* Do what? */
|
||||
IPMIP6_EVENT_IF(DEBUG, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Release Received by %s",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
goto done_out;
|
||||
|
||||
case IPMIP_DHCP_MSG_INFORM:
|
||||
/* Do what? */
|
||||
IPMIP6_EVENT_IF(DEBUG, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Inform Received by %s",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
if (IP_GET_32ON8(&pkt->ciaddr) == node->mo_dsmipv6_home_prefix.prefix)
|
||||
type = IPMIP_DHCP_MSG_INFORM_ACK;
|
||||
else
|
||||
type = IPMIP_DHCP_MSG_NAK;
|
||||
break;
|
||||
default:
|
||||
IPMIP6_EVENT_IF(WARNING, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP unknown Received by %s",
|
||||
ipmip6pm_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, dnode->gateway);
|
||||
|
||||
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->remaining);
|
||||
#else
|
||||
ipmip_dhcp_option_buffer_append_u32(buf, IPMIP_DHCP_OPTCODE_DHCP_LEASE_TIME, 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Add the basic options */
|
||||
|
||||
/* Subnet */
|
||||
tmp32 = 0;
|
||||
ipmip_util_create_mask((Ip_u8 *)&tmp32, node->mo_dsmipv6_home_prefix.len);
|
||||
ipmip_dhcp_option_buffer_append_ip(buf, IPMIP_DHCP_OPTCODE_SUBNET_MASK, tmp32);
|
||||
|
||||
/* Gateway */
|
||||
ipmip_dhcp_option_buffer_append_ip(buf, IPMIP_DHCP_OPTCODE_ROUTERS, dnode->gateway);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NAK */
|
||||
}
|
||||
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, node->mo_dsmipv6_home_prefix.prefix);
|
||||
|
||||
/* Send */
|
||||
ipmip_dhcp_write_to_client(&ctx->ipmip6.ipmip, proc, &rpkt->ipmip6.ipmip, dnode->gateway, &node->ifp_private.ipmip6.ifp->iff, type == IPMIP_DHCP_MSG_NAK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Relayed DHCP Request Received by %s",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Reply Received for %s",
|
||||
ipmip6pm_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 Ip_bool
|
||||
ipmip6pm_service_dsmipv6_req_accept(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_service_dsmipv6_config_global_t *gcfg,
|
||||
Ipmip6pm_service_dsmipv6_config_t *cfg,
|
||||
Ipmip6pm_service_dsmipv6_node_t *handle,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
|
||||
if (pbuf->ipmip6.mo.pdsmipv6_default_router != IP_NULL)
|
||||
handle->gateway = IP_GET_32ON8(&pbuf->ipmip6.mo.pdsmipv6_default_router->gw);
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_dsmipv6_config_global(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_dsmipv6_config_global_t *gcfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
gcfg->relay_config.enabled = ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.inet.dhcp.relay.enabled");
|
||||
|
||||
gcfg->relay_config.link_selection = ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.inet.dhcp.relay.link_selection");
|
||||
gcfg->relay_config.override = ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.inet.dhcp.relay.server_override");
|
||||
|
||||
ipmip_sysvar_inet(0, &gcfg->relay_config.forward, IP_NULL, "ipmip6pm.inet.dhcp.relay.server");
|
||||
gcfg->server_config.enabled = ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.inet.dhcp.server.enabled");
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.inet.dhcp.server.enabled=%s",
|
||||
gcfg->server_config.enabled? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.inet.dhcp.relay.enabled=%s",
|
||||
gcfg->relay_config.enabled? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.inet.dhcp.relay.link_selection=%s",
|
||||
gcfg->relay_config.link_selection? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.inet.dhcp.relay.server_override=%s",
|
||||
gcfg->relay_config.override? "true" : "false");
|
||||
|
||||
if (gcfg->relay_config.forward)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.inet.dhcp.relay.server=%s",
|
||||
ipmip_ntop_inet(proc, gcfg->relay_config.forward));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_dsmipv6_config(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6pm_service_dsmipv6_config_global_t *gcfg,
|
||||
Ipmip6pm_service_dsmipv6_config_t *cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
cfg->relay_config.enabled = ipmip_sysvar_bool(gcfg->relay_config.enabled, "ipmip6pm.interface.%s.inet.dhcp.relay.enabled", ifp->ipmip6.iff.ifname);
|
||||
ipmip_sysvar_inet(gcfg->relay_config.forward, &cfg->relay_config.forward, IP_NULL, "ipmip6pm.interface.%s.inet.dhcp.relay.server", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->relay_config.link_selection = ipmip_sysvar_bool(gcfg->relay_config.link_selection, "ipmip6pm.interface.%s.inet.dhcp.relay.link_selection", ifp->ipmip6.iff.ifname);
|
||||
cfg->relay_config.override = ipmip_sysvar_bool(gcfg->relay_config.override, "ipmip6pm.interface.%s.inet.dhcp.relay.server_override", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->server_config.enabled = ipmip_sysvar_mode(gcfg->server_config.enabled, "ipmip6pm.interface.%s.inet.dhcp.server.enabled", ifp->ipmip6.iff.ifname);
|
||||
|
||||
if (cfg->relay_config.enabled || cfg->server_config.enabled)
|
||||
{
|
||||
/* We need the DHCP context */
|
||||
ipmip_dhcp_context_create(&ctx->ipmip6.ipmip, proc);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.inet.dhcp.server.enabled=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->server_config.enabled? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.inet.dhcp.relay.enabled=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->relay_config.enabled? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.inet.dhcp.relay.link_selection=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->relay_config.link_selection? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.inet.dhcp.relay.server_override=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->relay_config.override? "true" : "false");
|
||||
|
||||
if (cfg->relay_config.forward)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.inet.dhcp.relay.server=%s",
|
||||
ifp->ipmip6.iff.ifname, ipmip_ntop_inet(proc, cfg->relay_config.forward));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_service_dsmipv6_provide(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_dsmipv6_config_global_t *gcfg,
|
||||
Ipmip6pm_service_dsmipv6_config_t *cfg,
|
||||
Ipmip6pm_service_dsmipv6_node_t *handle,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_ENABLE)
|
||||
{
|
||||
/* Assign the gateway */
|
||||
if (node->mo_dsmipv6_home_prefix.prefix != 0)
|
||||
{
|
||||
if (handle->gateway && !handle->relay)
|
||||
{
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET,
|
||||
IP_RTM_NEWADDR,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
&handle->gateway,
|
||||
32,
|
||||
0,
|
||||
0) != 0)
|
||||
{
|
||||
/**/
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Proxy Mobile node %s interface %s unable to add DSMIPv6 Gateway address %s",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
node->ifp_private.ipmip6.ifp->iff.ifname,
|
||||
ipmip_ntop_inet(proc, handle->gateway)));
|
||||
}
|
||||
}
|
||||
|
||||
/* Setup the RELAY structure */
|
||||
handle->dhcp.ifindex = node->ifp_private.ipmip6.ifp->iff.ifindex;
|
||||
handle->dhcp.lock = node->lock;
|
||||
handle->dhcp.opaque = node;
|
||||
handle->cfg = cfg;
|
||||
|
||||
if (handle->relay)
|
||||
{
|
||||
if (node->ifp_public && node->ifp_public->ifinet)
|
||||
{
|
||||
/*
|
||||
* The relay agent won't work properly unless there is
|
||||
* an IPv4 address configured on the interface.
|
||||
* We can use the CoA for this purpose.
|
||||
*/
|
||||
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET,
|
||||
IP_RTM_NEWADDR,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
&node->ifp_public->ifinet,
|
||||
32,
|
||||
0,
|
||||
0) != 0)
|
||||
{
|
||||
/**/
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Proxy Mobile node %s interface %s unable to add DSMIPv6 CoA address %s",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
node->ifp_private.ipmip6.ifp->iff.ifname,
|
||||
ipmip_ntop_inet(proc, node->ifp_public->ifinet)));
|
||||
}
|
||||
}
|
||||
|
||||
handle->dhcp.remote_id = node->mo_dsmipv6_home_prefix.prefix;
|
||||
handle->dhcp.process_func = (Ipmip_timer_func_t)ipmip6pm_service_dsmipv6_dhcpv4_relay;
|
||||
ipmip_dhcp_register(&ctx->ipmip6.ipmip, proc, &handle->dhcp);
|
||||
}
|
||||
else
|
||||
{
|
||||
handle->dhcp.process_func = (Ipmip_timer_func_t)ipmip6pm_service_dsmipv6_dhcpv4_server;
|
||||
ipmip_dhcp_register(&ctx->ipmip6.ipmip, proc, &handle->dhcp);
|
||||
}
|
||||
|
||||
handle->installed |= IPMIP6PM_SERVICE_INSTALLED_DHCP;
|
||||
|
||||
if (node->ifp_private.ipmip6.ifp->iff.lladdr != IP_NULL && node->ifp_private.ipmip6.ifp->iff.lladdr->type == IPMIP_LLADDR_TYPE_MAC)
|
||||
{
|
||||
handle->arp.ifindex = node->ifp_private.ipmip6.ifp->iff.ifindex;
|
||||
handle->arp.lock = node->lock;
|
||||
handle->arp.opaque = node;
|
||||
handle->arp.process_func = (Ipmip_timer_func_t)ipmip6pm_service_dsmipv6_arp;
|
||||
|
||||
ipmip_inet_arp_context_in_create(&ctx->ipmip6.ipmip, proc);
|
||||
ipmip_inet_arp_context_out_create(&ctx->ipmip6.ipmip, proc);
|
||||
ipmip_inet_arp_register(&ctx->ipmip6.ipmip, proc, &handle->arp);
|
||||
|
||||
handle->installed |= IPMIP6PM_SERVICE_INSTALLED_ARP;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE || action == IPMIP_CALLBACK_UPDATE)
|
||||
{
|
||||
if (handle->relay
|
||||
&& node->ifp_public
|
||||
&& node->ifp_public->ifinet)
|
||||
{
|
||||
ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET,
|
||||
IP_RTM_DELADDR,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
&node->ifp_public->ifinet,
|
||||
32,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
else if (handle->gateway)
|
||||
{
|
||||
ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET,
|
||||
IP_RTM_DELADDR,
|
||||
node->ifp_private.ipmip6.ifp->iff.ifindex,
|
||||
&handle->gateway,
|
||||
32,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
if ((handle->installed & IPMIP6PM_SERVICE_INSTALLED_DHCP) != 0)
|
||||
{
|
||||
ipmip_dhcp_unregister(&ctx->ipmip6.ipmip, proc, &handle->dhcp);
|
||||
|
||||
/**/
|
||||
handle->installed &= ~IPMIP6PM_SERVICE_INSTALLED_DHCP;
|
||||
}
|
||||
|
||||
if ((handle->installed & IPMIP6PM_SERVICE_INSTALLED_ARP) != 0)
|
||||
{
|
||||
ipmip_inet_arp_unregister(&ctx->ipmip6.ipmip, proc, &handle->arp);
|
||||
|
||||
/**/
|
||||
handle->installed &= ~IPMIP6PM_SERVICE_INSTALLED_ARP;
|
||||
}
|
||||
|
||||
if (action == IPMIP_CALLBACK_UPDATE)
|
||||
return IPMIP_CALLBACK_RET_FAILED;
|
||||
}
|
||||
|
||||
/* Don't delay */
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_service_dsmipv6_setup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_dsmipv6_config_global_t *gcfg,
|
||||
Ipmip6pm_service_dsmipv6_config_t *cfg,
|
||||
Ipmip6pm_service_dsmipv6_node_t *handle,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
int slen = value? ipcom_strlen(value) : 0;
|
||||
|
||||
if (ctx->ipmip6.ipmip.dhcp == IP_NULL)
|
||||
return IP_FALSE;
|
||||
|
||||
if (slen == 0 || value[0] != 'S')
|
||||
{
|
||||
if (cfg->relay_config.enabled == IP_FALSE)
|
||||
return IP_FALSE;
|
||||
|
||||
/* RELAY */
|
||||
if (slen > 2 && value[1] == '=')
|
||||
{
|
||||
ipmip_util_inet(&value[2], &handle->relay_data.forward, IP_NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cfg->relay_config.forward)
|
||||
handle->relay_data.forward = cfg->relay_config.forward;
|
||||
else
|
||||
handle->relay_data.forward = node->homeagent_inet;
|
||||
}
|
||||
|
||||
handle->relay = IP_TRUE;
|
||||
|
||||
return IP_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* SERVER */
|
||||
return cfg->server_config.enabled;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* No dyncamically allocated values */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (handle->relay)
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_SERVICE_DSMIPV6_NAME);
|
||||
|
||||
ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf), "R=%s", ipmip_ntop_inet(proc, handle->relay_data.forward));
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
proc->ntop.ntop_pbuf);
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_SERVICE_DSMIPV6_NAME);
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
"S");
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_service_dsmipv6_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_service_dsmipv6_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
static Ipmip6pm_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6PM_SERVICE_DSMIPV6_NAME;
|
||||
srv.syntax = "<R[=dhcpv4 server address]|S>";
|
||||
srv.node_data_size = sizeof(Ipmip6pm_service_dsmipv6_node_t);
|
||||
srv.ifp_data_size = sizeof(Ipmip6pm_service_dsmipv6_config_t);
|
||||
srv.global_data_size = sizeof(Ipmip6pm_service_dsmipv6_config_global_t);
|
||||
|
||||
srv.config_global = (Ipmip6pm_extension_config_global_t)ipmip6pm_service_dsmipv6_config_global;
|
||||
srv.config_ifp = (Ipmip6pm_extension_config_ifp_t)ipmip6pm_service_dsmipv6_config;
|
||||
srv.provide = (Ipmip6pm_extension_provide_t)ipmip6pm_service_dsmipv6_provide;
|
||||
srv.setup = (Ipmip6pm_extension_setup_t)ipmip6pm_service_dsmipv6_setup;
|
||||
srv.pkt_rep_accept = (Ipmip6pm_extension_pkt_rep_accept_t)ipmip6pm_service_dsmipv6_req_accept;
|
||||
|
||||
ipmip6pm_context_register_extension(ctx, &srv, IPMIP6PM_FUNCTION_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
#else
|
||||
IP_GLOBAL void ipmip6pm_service_dsmipv6_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_service_dsmipv6_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,656 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_service_radvd.c,v $ $Revision: 1.7 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_service_radvd.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipnet.h>
|
||||
#include <ipnet_radvd.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_SERVICE_RADVD_NAME "RADVD"
|
||||
|
||||
#define IPMIP6PM_SERVICE_RADVD_FLAG_A (1 << 0)
|
||||
#define IPMIP6PM_SERVICE_RADVD_FLAG_O (1 << 1)
|
||||
#define IPMIP6PM_SERVICE_RADVD_FLAG_M (1 << 2)
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipmip6pm_service_radvd_config_global
|
||||
{
|
||||
Ipnet_radvd_if_data radvd;
|
||||
Ipnet_radvd_if_prefix_data prefix;
|
||||
} Ipmip6pm_service_radvd_config_global_t;
|
||||
|
||||
typedef struct Ipmip6pm_service_radvd_config_data
|
||||
{
|
||||
Ipnet_radvd_if_data radvd;
|
||||
Ipnet_radvd_if_prefix_data prefix;
|
||||
} Ipmip6pm_service_radvd_config_data_t;
|
||||
|
||||
typedef struct Ipmip6pm_service_radvd_handle_data
|
||||
{
|
||||
Ip_u32 radvd_flags;
|
||||
Ipnet_radvd_if_handle radvd;
|
||||
} Ipmip6pm_service_radvd_handle_data_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_radvd_config_global(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_radvd_config_global_t *gcfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
gcfg->radvd.max_rtr_adv_interval =
|
||||
ipmip_sysvar_long(600000, "ipmip6pm.radvd.MaxRtrAdvInterval");
|
||||
|
||||
gcfg->radvd.min_rtr_adv_interval =
|
||||
ipmip_sysvar_long(3000, "ipmip6pm.radvd.MinRtrAdvInterval");
|
||||
|
||||
gcfg->radvd.min_delay_between_ras =
|
||||
ipmip_sysvar_long(IP_MIN(gcfg->radvd.min_rtr_adv_interval, 3000), "ipmip6pm.radvd.MinDelayBetweenRAs");
|
||||
|
||||
gcfg->radvd.default_lifetime =
|
||||
ipmip_sysvar_long(IP_MAX(1000, (3 * gcfg->radvd.max_rtr_adv_interval)), "ipmip6pm.radvd.AdvDefaultLifetime");
|
||||
|
||||
gcfg->radvd.link_mtu =
|
||||
ipmip_sysvar_ulong(0, "ipmip6pm.radvd.AdvLinkMTU");
|
||||
|
||||
gcfg->radvd.reachable_time =
|
||||
ipmip_sysvar_ulong(0, "ipmip6pm.radvd.AdvReachableTime");
|
||||
|
||||
gcfg->radvd.retrans_timer =
|
||||
ipmip_sysvar_ulong(0, "ipmip6pm.radvd.AdvRetransTimer");
|
||||
|
||||
gcfg->radvd.hoplimit =
|
||||
(Ip_u8)ipmip_sysvar_ulong(64, "ipmip6pm.radvd.AdvCurHopLimit");
|
||||
|
||||
gcfg->radvd.managed =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.radvd.AdvManagedFlag");
|
||||
|
||||
gcfg->radvd.other_config =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.radvd.AdvOtherConfigFlag");
|
||||
|
||||
gcfg->radvd.home_agent =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.radvd.AdvHomeAgentFlag");
|
||||
|
||||
gcfg->radvd.adv_interval_opt =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.radvd.AdvIntervalOpt");
|
||||
|
||||
gcfg->radvd.adv_home_agent_opt =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.radvd.AdvHomeAgentOpt");
|
||||
|
||||
gcfg->radvd.adv_home_agent_opt_lifetime =
|
||||
ipmip_sysvar_long(0, "ipmip6pm.radvd.AdvHomeAgentOptLifetime");
|
||||
|
||||
gcfg->radvd.adv_home_agent_opt_preference =
|
||||
ipmip_sysvar_long(0, "ipmip6pm.radvd.AdvHomeAgentOptPreference");
|
||||
|
||||
|
||||
/* Do prefix */
|
||||
|
||||
gcfg->prefix.valid_lifetime =
|
||||
ipmip_sysvar_ulong(2592000, "ipmip6pm.radvd.prefix.AdvValidLifetime");
|
||||
|
||||
gcfg->prefix.preferred_lifetime =
|
||||
ipmip_sysvar_ulong(604800, "ipmip6pm.radvd.prefix.AdvPreferredLifetime");
|
||||
|
||||
gcfg->prefix.on_link =
|
||||
ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.radvd.prefix.AdvOnLinkFlag");
|
||||
|
||||
gcfg->prefix.autonomous =
|
||||
ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.radvd.prefix.AdvAutonomousFlag");
|
||||
|
||||
gcfg->prefix.router_address =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.radvd.prefix.AdvRouterAddressFlag");
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.MaxRtrAdvInterval=%u",
|
||||
gcfg->radvd.max_rtr_adv_interval);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.MinRtrAdvInterval=%u",
|
||||
gcfg->radvd.min_rtr_adv_interval);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.MinDelayBetweenRAs=%u",
|
||||
gcfg->radvd.min_delay_between_ras);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvDefaultLifetime=%u",
|
||||
gcfg->radvd.default_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvLinkMTU=%u",
|
||||
gcfg->radvd.link_mtu);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvReachableTime=%u",
|
||||
gcfg->radvd.reachable_time);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvRetransTimer=%u",
|
||||
gcfg->radvd.retrans_timer);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvCurHopLimit=%u",
|
||||
gcfg->radvd.hoplimit);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvManagedFlag=%s",
|
||||
gcfg->radvd.managed? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvOtherConfigFlag=%s",
|
||||
gcfg->radvd.other_config? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvHomeAgentFlag=%s",
|
||||
gcfg->radvd.home_agent? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvIntervalOpt=%s",
|
||||
gcfg->radvd.adv_interval_opt? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvHomeAgentOpt=%s",
|
||||
gcfg->radvd.adv_home_agent_opt? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvHomeAgentOptLifetime=%u",
|
||||
gcfg->radvd.adv_home_agent_opt_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.AdvHomeAgentOptPreference=%u",
|
||||
gcfg->radvd.adv_home_agent_opt_preference);
|
||||
|
||||
/* Do prefix */
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.prefix.AdvValidLifetime=%u",
|
||||
gcfg->prefix.valid_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.prefix.AdvPreferredLifetime=%u",
|
||||
gcfg->prefix.preferred_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.prefix.AdvOnLinkFlag=%s",
|
||||
gcfg->prefix.on_link? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.prefix.AdvAutonomousFlag=%s",
|
||||
gcfg->prefix.autonomous? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.radvd.prefix.AdvRouterAddressFlag=%s",
|
||||
gcfg->prefix.router_address? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_radvd_config(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6pm_service_radvd_config_global_t *gcfg,
|
||||
Ipmip6pm_service_radvd_config_data_t *cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
cfg->radvd.max_rtr_adv_interval =
|
||||
ipmip_sysvar_long(gcfg->radvd.max_rtr_adv_interval, "ipmip6pm.interface.%s.radvd.MaxRtrAdvInterval", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.min_rtr_adv_interval =
|
||||
ipmip_sysvar_long(cfg->radvd.max_rtr_adv_interval / 3, "ipmip6pm.interface.%s.radvd.MinRtrAdvInterval", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.min_delay_between_ras =
|
||||
ipmip_sysvar_long(IP_MIN(cfg->radvd.min_rtr_adv_interval, 3000), "ipmip6pm.interface.%s.radvd.MinDelayBetweenRAs", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.default_lifetime =
|
||||
ipmip_sysvar_long(IP_MAX(1000, (3 * cfg->radvd.max_rtr_adv_interval)), "ipmip6pm.interface.%s.radvd.AdvDefaultLifetime", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.link_mtu =
|
||||
ipmip_sysvar_ulong(gcfg->radvd.link_mtu, "ipmip6pm.interface.%s.radvd.AdvLinkMTU", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.reachable_time =
|
||||
ipmip_sysvar_ulong(gcfg->radvd.reachable_time, "ipmip6pm.interface.%s.radvd.AdvReachableTime", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.retrans_timer =
|
||||
ipmip_sysvar_ulong(gcfg->radvd.retrans_timer, "ipmip6pm.interface.%s.radvd.AdvRetransTimer", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.hoplimit =
|
||||
(Ip_u8)ipmip_sysvar_ulong(gcfg->radvd.hoplimit, "ipmip6pm.interface.%s.radvd.AdvCurHopLimit", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.managed =
|
||||
ipmip_sysvar_bool(gcfg->radvd.managed, "ipmip6pm.interface.%s.radvd.AdvManagedFlag", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.other_config =
|
||||
ipmip_sysvar_bool(gcfg->radvd.other_config, "ipmip6pm.interface.%s.radvd.AdvOtherConfigFlag", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.home_agent =
|
||||
ipmip_sysvar_bool(gcfg->radvd.home_agent, "ipmip6pm.interface.%s.radvd.AdvHomeAgentFlag", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.adv_interval_opt =
|
||||
ipmip_sysvar_bool(gcfg->radvd.adv_interval_opt, "ipmip6pm.interface.%s.radvd.AdvIntervalOpt", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.adv_home_agent_opt =
|
||||
ipmip_sysvar_bool(gcfg->radvd.adv_home_agent_opt, "ipmip6pm.interface.%s.radvd.AdvHomeAgentOpt", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.adv_home_agent_opt_lifetime =
|
||||
ipmip_sysvar_long(gcfg->radvd.adv_home_agent_opt_lifetime, "ipmip6pm.interface.%s.radvd.AdvHomeAgentOptLifetime", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->radvd.adv_home_agent_opt_preference =
|
||||
ipmip_sysvar_long(gcfg->radvd.adv_home_agent_opt_preference, "ipmip6pm.interface.%s.radvd.AdvHomeAgentOptPreference", ifp->ipmip6.iff.ifname);
|
||||
|
||||
|
||||
/* Do prefix */
|
||||
|
||||
cfg->prefix.valid_lifetime =
|
||||
ipmip_sysvar_ulong(gcfg->prefix.valid_lifetime, "ipmip6pm.interface.%s.radvd.prefix.AdvValidLifetime", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->prefix.preferred_lifetime =
|
||||
ipmip_sysvar_ulong(gcfg->prefix.preferred_lifetime, "ipmip6pm.interface.%s.radvd.prefix.AdvPreferredLifetime", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->prefix.on_link =
|
||||
ipmip_sysvar_bool(gcfg->prefix.on_link, "ipmip6pm.interface.%s.radvd.prefix.AdvOnLinkFlag", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->prefix.autonomous =
|
||||
ipmip_sysvar_bool(gcfg->prefix.autonomous, "ipmip6pm.interface.%s.radvd.prefix.AdvAutonomousFlag", ifp->ipmip6.iff.ifname);
|
||||
|
||||
cfg->prefix.router_address =
|
||||
ipmip_sysvar_bool(gcfg->prefix.router_address, "ipmip6pm.interface.%s.radvd.prefix.AdvRouterAddressFlag", 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,
|
||||
"ipmip6pm.interface.%s.radvd.MaxRtrAdvInterval=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.max_rtr_adv_interval);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.MinRtrAdvInterval=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.min_rtr_adv_interval);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.MinDelayBetweenRAs=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.min_delay_between_ras);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvDefaultLifetime=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.default_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvLinkMTU=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.link_mtu);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvReachableTime=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.reachable_time);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvRetransTimer=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.retrans_timer);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvCurHopLimit=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.hoplimit);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvManagedFlag=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.managed? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvOtherConfigFlag=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.other_config? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvHomeAgentFlag=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.home_agent? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvIntervalOpt=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.adv_interval_opt? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvHomeAgentOpt=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.adv_home_agent_opt? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvHomeAgentOptLifetime=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.adv_home_agent_opt_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.AdvHomeAgentOptPreference=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->radvd.adv_home_agent_opt_preference);
|
||||
|
||||
/* Do prefix */
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.prefix.AdvValidLifetime=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->prefix.valid_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.prefix.AdvPreferredLifetime=%u",
|
||||
ifp->ipmip6.iff.ifname, cfg->prefix.preferred_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.prefix.AdvOnLinkFlag=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->prefix.on_link? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.prefix.AdvAutonomousFlag=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->prefix.autonomous? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.radvd.prefix.AdvRouterAddressFlag=%s",
|
||||
ifp->ipmip6.iff.ifname, cfg->prefix.router_address? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6pm_service_radvd_provide(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_radvd_config_global_t *gcfg,
|
||||
Ipmip6pm_service_radvd_config_data_t *cfg,
|
||||
Ipmip6pm_service_radvd_handle_data_t *handle,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_ENABLE)
|
||||
{
|
||||
Ipnet_radvd_if_data radvd;
|
||||
Ip_u8 i;
|
||||
|
||||
ipcom_memcpy(&radvd, &cfg->radvd, sizeof(radvd));
|
||||
ipcom_strcpy(radvd.ifname, node->ifp_private.ipmip6.ifname);
|
||||
|
||||
radvd.other_config = (handle->radvd_flags & IPMIP6PM_SERVICE_RADVD_FLAG_O) != 0;
|
||||
radvd.managed = (handle->radvd_flags & IPMIP6PM_SERVICE_RADVD_FLAG_M) != 0;
|
||||
|
||||
if (ipnet_radvd_if_open(&handle->radvd, &radvd) != IPCOM_SUCCESS)
|
||||
{
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to start service for Proxy Mobile node %s",
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipnet_radvd_if_prefix_handle phandle;
|
||||
Ipnet_radvd_if_prefix_data pdata;
|
||||
|
||||
ipcom_memcpy(&pdata, &cfg->prefix, sizeof(pdata));
|
||||
|
||||
pdata.autonomous = (handle->radvd_flags & IPMIP6PM_SERVICE_RADVD_FLAG_A) != 0;
|
||||
|
||||
/* Do the prefixes */
|
||||
for (i = 0; i < node->mo_home_prefix_size; i++)
|
||||
{
|
||||
/* Add prefix by prefix */
|
||||
ipcom_memcpy(&pdata.prefix, &node->mo_home_prefix[i].prefix, sizeof(pdata.prefix));
|
||||
pdata.prefixlen = node->mo_home_prefix[i].prefix_length;
|
||||
|
||||
if (ipnet_radvd_if_prefix_open(handle->radvd, &phandle, &pdata) != IPCOM_SUCCESS)
|
||||
{
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to start service on prefix %s/%d for Proxy Mobile node %s",
|
||||
ipmip_ntop_inet6(proc, &pdata.prefix, IP_NULL),
|
||||
pdata.prefixlen,
|
||||
ipmip6pm_node_describe(proc, node)));
|
||||
}
|
||||
}
|
||||
|
||||
/* Start it */
|
||||
ipnet_radvd_if_start(handle->radvd);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE)
|
||||
{
|
||||
if (handle)
|
||||
ipnet_radvd_if_close(handle->radvd);
|
||||
}
|
||||
|
||||
/* Don't delay */
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_service_radvd_setup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_radvd_config_global_t *gcfg,
|
||||
Ipmip6pm_service_radvd_config_data_t *cfg,
|
||||
Ipmip6pm_service_radvd_handle_data_t *handle,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
const char *ptr = value;
|
||||
|
||||
/* Do some node specific setup on the RADVD */
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
switch (*ptr++)
|
||||
{
|
||||
case 'A':
|
||||
case 'a':
|
||||
handle->radvd_flags |= IPMIP6PM_SERVICE_RADVD_FLAG_A;
|
||||
break;
|
||||
case 'O':
|
||||
case 'o':
|
||||
handle->radvd_flags |= IPMIP6PM_SERVICE_RADVD_FLAG_O;
|
||||
break;
|
||||
case 'M':
|
||||
case 'm':
|
||||
handle->radvd_flags |= IPMIP6PM_SERVICE_RADVD_FLAG_M;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cfg->radvd.other_config)
|
||||
handle->radvd_flags |= IPMIP6PM_SERVICE_RADVD_FLAG_O;
|
||||
if (cfg->radvd.managed)
|
||||
handle->radvd_flags |= IPMIP6PM_SERVICE_RADVD_FLAG_M;
|
||||
if (cfg->prefix.autonomous)
|
||||
handle->radvd_flags |= IPMIP6PM_SERVICE_RADVD_FLAG_A;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* No dyncamically allocated values */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
char *ptr = proc->ntop.ntop_name;
|
||||
|
||||
if ((handle->radvd_flags & IPMIP6PM_SERVICE_RADVD_FLAG_A) != 0)
|
||||
*ptr++ = 'A';
|
||||
if ((handle->radvd_flags & IPMIP6PM_SERVICE_RADVD_FLAG_O) != 0)
|
||||
*ptr++ = 'O';
|
||||
if ((handle->radvd_flags & IPMIP6PM_SERVICE_RADVD_FLAG_M) != 0)
|
||||
*ptr++ = 'M';
|
||||
*ptr++ = '\0';
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_SERVICE_RADVD_NAME);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
proc->ntop.ntop_name);
|
||||
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
|
||||
return IP_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_service_radvd_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_service_radvd_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
static Ipmip6pm_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6PM_SERVICE_RADVD_NAME;
|
||||
srv.syntax = "<AOM> - Where A=Autonomous, O=Other, M=Managed";
|
||||
srv.node_data_size = sizeof(Ipmip6pm_service_radvd_handle_data_t);
|
||||
srv.ifp_data_size = sizeof(Ipmip6pm_service_radvd_config_data_t);
|
||||
srv.global_data_size= sizeof(Ipmip6pm_service_radvd_config_global_t);
|
||||
|
||||
srv.config_global = (Ipmip6pm_extension_config_global_t)ipmip6pm_service_radvd_config_global;
|
||||
srv.config_ifp = (Ipmip6pm_extension_config_ifp_t)ipmip6pm_service_radvd_config;
|
||||
srv.provide = (Ipmip6pm_extension_provide_t)ipmip6pm_service_radvd_provide;
|
||||
srv.setup = (Ipmip6pm_extension_setup_t)ipmip6pm_service_radvd_setup;
|
||||
|
||||
ipmip6pm_context_register_extension(ctx, &srv, IPMIP6PM_FUNCTION_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,332 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_service_selection.c,v $ $Revision: 1.8 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_service_selection.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipnet.h>
|
||||
#include <ipnet_policy_routing.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
#include <private/ipmip6_sysext.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_SERVICE_SELECTION_NAME "SERVICE-SELECTION"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct Ipmip6pm_service_selection_config_global
|
||||
{
|
||||
Ipmip6_mh_mo_service_selection_mobility_option_t *selection;
|
||||
} Ipmip6pm_service_selection_config_global_t;
|
||||
|
||||
typedef struct Ipmip6pm_service_selection_config
|
||||
{
|
||||
Ipmip6_mh_mo_service_selection_mobility_option_t *selection;
|
||||
} Ipmip6pm_service_selection_config_t;
|
||||
|
||||
typedef struct Ipmip6pm_service_selection_node_config
|
||||
{
|
||||
Ipmip6_mh_mo_service_selection_mobility_option_t *selection;
|
||||
} Ipmip6pm_service_selection_node_config_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_selection_request_rep_apply(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_service_selection_config_global_t *gcfg,
|
||||
Ipmip6pm_service_selection_config_t *ifcfg,
|
||||
Ipmip6pm_service_selection_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
IPMIP_UNUSED_PARAMETER(ifcfg);
|
||||
|
||||
/**/
|
||||
if (node->mip6MnBLTable.mip6MnBLAccepted == IP_FALSE)
|
||||
{
|
||||
if (nodecfg->selection != IP_NULL)
|
||||
{
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s requesting service selection '%s'",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
(char *)&nodecfg->selection->identifier[0]));
|
||||
ipmip6_mh_pkt_opt_add_mo(&ctx->ipmip6,
|
||||
proc,
|
||||
&pbuf->ipmip6,
|
||||
&nodecfg->selection->hdr);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_selection_config_global(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_selection_config_global_t *gcfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
gcfg->selection = ipmip6_sysext_service_selection("ipmip6pm.service_selection");
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (gcfg->selection)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.service_selection=%s",
|
||||
&gcfg->selection->identifier[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_selection_config(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6pm_service_selection_config_global_t *gcfg,
|
||||
Ipmip6pm_service_selection_config_t *cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* Read the prefix list allowed for this interface */
|
||||
cfg->selection = ipmip6_sysext_service_selection("ipmip6pm.interface.%s.service_selection", ifp->ipmip6.iff.ifname);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (cfg->selection != IP_NULL)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6pm.interface.%s.service_selection=%s",
|
||||
ifp->ipmip6.iff.ifname, &cfg->selection->identifier[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_selection_free(Ipmip6pm_service_selection_config_global_t *gcfg,
|
||||
Ipmip6pm_service_selection_config_t *ifcfg,
|
||||
Ipmip6pm_service_selection_node_config_t *nodecfg)
|
||||
{
|
||||
/* Do Nothing */
|
||||
if (nodecfg->selection != IP_NULL)
|
||||
{
|
||||
if (nodecfg->selection != ifcfg->selection && nodecfg->selection != gcfg->selection)
|
||||
ipcom_free(nodecfg->selection);
|
||||
nodecfg->selection = IP_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_service_selection_setup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipmip6pm_service_selection_config_global_t *gcfg,
|
||||
Ipmip6pm_service_selection_config_t *ifcfg,
|
||||
Ipmip6pm_service_selection_node_config_t *nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* Dont allow more than one */
|
||||
ipmip6pm_service_selection_free(gcfg, ifcfg, nodecfg);
|
||||
if (value == IP_NULL)
|
||||
{
|
||||
/* No explicit identifier */
|
||||
if (ifcfg->selection != IP_NULL)
|
||||
nodecfg->selection = ifcfg->selection;
|
||||
else if (gcfg->selection != IP_NULL)
|
||||
nodecfg->selection = gcfg->selection;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodecfg->selection = ipmip6_util_mo_service_selection(value);
|
||||
}
|
||||
|
||||
return nodecfg->selection != IP_NULL;
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do Nothing */
|
||||
ipmip6pm_service_selection_free(gcfg, ifcfg, nodecfg);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (nodecfg->selection != IP_NULL)
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_SERVICE_SELECTION_NAME);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
(char *)&nodecfg->selection->identifier[0]);
|
||||
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_service_selection_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_service_selection_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
static Ipmip6pm_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6PM_SERVICE_SELECTION_NAME;
|
||||
srv.syntax = "<service selection string>";
|
||||
srv.node_data_size = sizeof(Ipmip6pm_service_selection_node_config_t);
|
||||
srv.ifp_data_size = sizeof(Ipmip6pm_service_selection_config_t);
|
||||
srv.global_data_size= sizeof(Ipmip6pm_service_selection_config_global_t);
|
||||
|
||||
srv.config_global = (Ipmip6pm_extension_config_global_t)ipmip6pm_service_selection_config_global;
|
||||
srv.config_ifp = (Ipmip6pm_extension_config_ifp_t)ipmip6pm_service_selection_config;
|
||||
srv.setup = (Ipmip6pm_extension_setup_t)ipmip6pm_service_selection_setup;
|
||||
srv.pkt_req_apply = (Ipmip6pm_extension_pkt_req_apply_t)ipmip6pm_service_selection_request_rep_apply;
|
||||
|
||||
ipmip6pm_context_register_extension(ctx, &srv, IPMIP6PM_FUNCTION_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,560 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_service_vendor_extension.c,v $ $Revision: 1.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/config/ipmip6pm_service_vendor_extension.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipnet.h>
|
||||
#include <ipnet_policy_routing.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
#include <private/ipmip6_sysext.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_SERVICE_VENDOR_EXTENSION_NAME "VENDOR-EXTENSION"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct Ipmip6pm_vendor_extension_config_ext
|
||||
{
|
||||
Ipcom_list next;
|
||||
Ipmip6_mh_mo_vendor_specific_mobility_option_t *mo;
|
||||
} Ipmip6pm_vendor_extension_config_ext_t;
|
||||
|
||||
typedef struct Ipmip6pm_vendor_extension_config
|
||||
{
|
||||
Ipcom_list *vext;
|
||||
} Ipmip6pm_vendor_extension_config_t;
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_service_vendor_extension_req_accept(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipcom_list **gcfg,
|
||||
Ipcom_list **cfg,
|
||||
Ipcom_list **nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(nodecfg);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
|
||||
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",
|
||||
ipmip6pm_node_describe(proc, node),
|
||||
IP_GET_NTOHL(&mo->vendor_id), mo->sub_type));
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_vendor_extension_request_rep_apply(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipcom_list **gcfg,
|
||||
Ipcom_list **ifcfg,
|
||||
Ipcom_list **nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf)
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
IPMIP_UNUSED_PARAMETER(ifcfg);
|
||||
|
||||
/**/
|
||||
if (*nodecfg != IP_NULL)
|
||||
{
|
||||
for (nmo = IPCOM_LIST_FIRST(*nodecfg); nmo !=IP_NULL; nmo = IPCOM_LIST_NEXT(&nmo->next))
|
||||
ipmip6_mh_pkt_opt_add_mo(&ctx->ipmip6,
|
||||
proc,
|
||||
&pbuf->ipmip6,
|
||||
&nmo->mo->hdr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_vendor_extension_foreach(struct Ipmip_proc *proc,
|
||||
char *name,
|
||||
char *subkey,
|
||||
const char *value,
|
||||
Ipcom_list *priv_cfg)
|
||||
{
|
||||
Ip_u32 vendor;
|
||||
Ip_u8 subtype = 0;
|
||||
char *endp;
|
||||
Ip_u8 *vp;
|
||||
Ip_size_t sz;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(name);
|
||||
|
||||
vendor = ipcom_strtoul(subkey, &endp, 0);
|
||||
if (*endp == '.')
|
||||
subtype = ipcom_strtoul(endp + 1, IP_NULL, 0);
|
||||
|
||||
/* Time to resolve the string value */
|
||||
vp = ipmip_util_values_to_hexarray(value, &sz);
|
||||
if (vp != IP_NULL)
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo = ipcom_malloc(sizeof(*nmo));
|
||||
|
||||
if (nmo == IP_NULL)
|
||||
{
|
||||
ipcom_free(vp);
|
||||
return;
|
||||
}
|
||||
|
||||
nmo->mo = ipmip6_util_mo_vendor_extension(vendor, subtype, vp, sz);
|
||||
if (nmo->mo == IP_NULL)
|
||||
{
|
||||
ipcom_free(nmo);
|
||||
ipcom_free(vp);
|
||||
return;
|
||||
}
|
||||
|
||||
ipcom_list_insert_last(priv_cfg, &nmo->next);
|
||||
ipcom_free(vp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_vendor_extension_config_global(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipcom_list **gcfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* */
|
||||
Ipcom_list lst;
|
||||
ipcom_list_init(&lst);
|
||||
|
||||
ipmip_sysvar_foreach(proc,
|
||||
(Ipmip_sysvar_foreach_t) ipmip6pm_service_vendor_extension_foreach,
|
||||
&lst,
|
||||
"ipmip6pm.vendor_extension.*");
|
||||
|
||||
if (IPCOM_LIST_FIRST(&lst) != IP_NULL)
|
||||
{
|
||||
Ipcom_list *e;
|
||||
*gcfg = ipcom_malloc(sizeof(Ipcom_list));
|
||||
ipcom_list_init(*gcfg);
|
||||
|
||||
while ((e = IPCOM_LIST_FIRST(&lst)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(e);
|
||||
ipcom_list_insert_last(*gcfg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
|
||||
if (*gcfg != IP_NULL)
|
||||
{
|
||||
while ((nmo = IPCOM_LIST_FIRST(*gcfg)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(&nmo->next);
|
||||
ipcom_free(nmo->mo);
|
||||
ipcom_free(nmo);
|
||||
}
|
||||
|
||||
ipcom_free(*gcfg);
|
||||
*gcfg = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
if (*gcfg != IP_NULL)
|
||||
{
|
||||
for (nmo = IPCOM_LIST_FIRST(*gcfg); nmo !=IP_NULL; nmo = IPCOM_LIST_NEXT(&nmo->next))
|
||||
{
|
||||
Ip_u8 *data = (Ip_u8 *)(nmo->mo + 1);
|
||||
int i;
|
||||
int off = ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf),
|
||||
"ipmip6pm.vendor_extension.%u.%u=",
|
||||
IP_GET_NTOHL(&nmo->mo->vendor_id), nmo->mo->sub_type);
|
||||
for (i = 0; i < (nmo->mo->hdr.len - 6); i++)
|
||||
off += ipcom_snprintf(&proc->ntop.ntop_pbuf[off], sizeof(proc->ntop.ntop_pbuf) - off,
|
||||
"%s0x%02x", i > 0? "," : "", data[i]);
|
||||
ipmip_cli_config_printf(&request->message, proc->ntop.ntop_pbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_service_vendor_extension_config(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipcom_list **gcfg,
|
||||
Ipcom_list **cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* */
|
||||
Ipcom_list lst;
|
||||
ipcom_list_init(&lst);
|
||||
|
||||
ipmip_sysvar_foreach(proc,
|
||||
(Ipmip_sysvar_foreach_t) ipmip6pm_service_vendor_extension_foreach,
|
||||
&lst,
|
||||
"ipmip6pm.interface.%s.vendor_extension.*", ifp->ipmip6.iff.ifname);
|
||||
|
||||
if (IPCOM_LIST_FIRST(&lst) != IP_NULL)
|
||||
{
|
||||
Ipcom_list *e;
|
||||
*cfg = ipcom_malloc(sizeof(Ipcom_list));
|
||||
ipcom_list_init(*cfg);
|
||||
|
||||
while ((e = IPCOM_LIST_FIRST(&lst)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(e);
|
||||
ipcom_list_insert_last(*cfg, e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use global */
|
||||
*cfg = *gcfg;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
|
||||
if (*cfg != IP_NULL)
|
||||
{
|
||||
if (*cfg != *gcfg)
|
||||
{
|
||||
while ((nmo = IPCOM_LIST_FIRST(*cfg)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(&nmo->next);
|
||||
ipcom_free(nmo->mo);
|
||||
ipcom_free(nmo);
|
||||
}
|
||||
|
||||
ipcom_free(*cfg);
|
||||
}
|
||||
|
||||
*cfg = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
if (*cfg != IP_NULL)
|
||||
{
|
||||
for (nmo = IPCOM_LIST_FIRST(*cfg); nmo !=IP_NULL; nmo = IPCOM_LIST_NEXT(&nmo->next))
|
||||
{
|
||||
Ip_u8 *data = (Ip_u8 *)(nmo->mo + 1);
|
||||
int i;
|
||||
int off = ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf),
|
||||
"ipmip6pm.interface.%s.vendor_extension.%u.%u=",
|
||||
ifp->ipmip6.iff.ifname, IP_GET_NTOHL(&nmo->mo->vendor_id), nmo->mo->sub_type);
|
||||
for (i = 0; i < (nmo->mo->hdr.len - 6); i++)
|
||||
off += ipcom_snprintf(&proc->ntop.ntop_pbuf[off], sizeof(proc->ntop.ntop_pbuf) - off,
|
||||
"%s0x%02x", i > 0? "," : "", data[i]);
|
||||
ipmip_cli_config_printf(&request->message, proc->ntop.ntop_pbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_service_vendor_extension_setup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
Ipcom_list **gcfg,
|
||||
Ipcom_list **cfg,
|
||||
Ipcom_list **nodecfg,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(gcfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
/* Dont allow more than one */
|
||||
if (value != IP_NULL)
|
||||
{
|
||||
char *endp;
|
||||
Ip_u32 smi;
|
||||
Ip_u8 subtype = 0;
|
||||
|
||||
/* <SMI>.<Sub>=<Value> */
|
||||
smi = ipcom_strtoul(value, &endp, 0);
|
||||
if (*endp == '.')
|
||||
subtype = ipcom_strtoul(endp + 1, IP_NULL, 0);
|
||||
|
||||
endp = ipcom_strchr(value, '=');
|
||||
if (endp == IP_NULL)
|
||||
{
|
||||
IPMIP6_EVENT_IF(WARNING, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s unable to parse Vendor Extension %s",
|
||||
ipmip6pm_node_describe(proc, node), value));
|
||||
return IP_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
Ip_u8 *vp;
|
||||
Ip_size_t sz;
|
||||
|
||||
vp = ipmip_util_values_to_hexarray(value, &sz);
|
||||
if (vp == IP_NULL)
|
||||
return IP_FALSE;
|
||||
|
||||
nmo = ipcom_malloc(sizeof(*nmo));
|
||||
if (nmo == IP_NULL)
|
||||
{
|
||||
ipcom_free(vp);
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
nmo->mo = ipmip6_util_mo_vendor_extension(smi, subtype, vp, sz);
|
||||
ipcom_free(vp);
|
||||
|
||||
if (*nodecfg == IP_NULL)
|
||||
{
|
||||
*nodecfg = ipcom_malloc(sizeof(Ipcom_list));
|
||||
ipcom_list_init(*nodecfg);
|
||||
}
|
||||
|
||||
ipcom_list_insert_last(*nodecfg, &nmo->next);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*nodecfg = *cfg;
|
||||
}
|
||||
|
||||
return *nodecfg != IP_NULL;
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do Nothing */
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
|
||||
if (*nodecfg != IP_NULL)
|
||||
{
|
||||
if (*nodecfg != *cfg)
|
||||
{
|
||||
while ((nmo = IPCOM_LIST_FIRST(*nodecfg)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(&nmo->next);
|
||||
ipcom_free(nmo->mo);
|
||||
ipcom_free(nmo);
|
||||
}
|
||||
|
||||
ipcom_free(*nodecfg);
|
||||
}
|
||||
|
||||
*nodecfg = IP_NULL;
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
Ipmip6pm_vendor_extension_config_ext_t *nmo;
|
||||
if (*nodecfg != IP_NULL)
|
||||
{
|
||||
for (nmo = IPCOM_LIST_FIRST(*nodecfg); nmo !=IP_NULL; nmo = IPCOM_LIST_NEXT(&nmo->next))
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&request->message, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
|
||||
Ip_u8 *data = (Ip_u8 *)(nmo->mo + 1);
|
||||
int i;
|
||||
int off = ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf),
|
||||
"%u.%u=",
|
||||
IP_GET_NTOHL(&nmo->mo->vendor_id), nmo->mo->sub_type);
|
||||
|
||||
for (i = 0; i < (nmo->mo->hdr.len - 6); i++)
|
||||
off += ipcom_snprintf(&proc->ntop.ntop_pbuf[off], sizeof(proc->ntop.ntop_pbuf) - off,
|
||||
"%s0x%02x", i > 0? "," : "", data[i]);
|
||||
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_SERVICE_VENDOR_EXTENSION_NAME);
|
||||
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
(char *)proc->ntop.ntop_pbuf);
|
||||
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_service_vendor_extension_install(struct Ipmip6pm_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_service_vendor_extension_install(struct Ipmip6pm_context *ctx)
|
||||
{
|
||||
static Ipmip6pm_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6PM_SERVICE_VENDOR_EXTENSION_NAME;
|
||||
srv.syntax = "<SMI Number>.<SubType>=<hex array|<string>";
|
||||
srv.node_data_size = sizeof(Ipcom_list *);
|
||||
srv.ifp_data_size = sizeof(Ipcom_list *);
|
||||
srv.global_data_size= sizeof(Ipcom_list *);
|
||||
|
||||
srv.config_global = (Ipmip6pm_extension_config_global_t)ipmip6pm_service_vendor_extension_config_global;
|
||||
srv.config_ifp = (Ipmip6pm_extension_config_ifp_t)ipmip6pm_service_vendor_extension_config;
|
||||
srv.setup = (Ipmip6pm_extension_setup_t)ipmip6pm_service_vendor_extension_setup;
|
||||
srv.pkt_req_apply = (Ipmip6pm_extension_pkt_req_apply_t)ipmip6pm_service_vendor_extension_request_rep_apply;
|
||||
srv.pkt_rep_accept = (Ipmip6pm_extension_pkt_rep_accept_t)ipmip6pm_service_vendor_extension_req_accept;
|
||||
|
||||
ipmip6pm_context_register_extension(ctx, &srv, IPMIP6PM_FUNCTION_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
IPTARGETS := lib
|
||||
ifneq ($(IPMAKEFILE),)
|
||||
include $(IPMAKEFILE)
|
||||
else
|
||||
include $(IPCOM_ROOT)/Makefile
|
||||
endif
|
||||
include ipmip6pm.mk
|
||||
include $(IPCOM_ROOT)/gmake/ipcom_make.mk
|
||||
|
||||
lib: dirs $(IPLIBFILE)
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
#############################################################################
|
||||
# IPMIP6MN.MK
|
||||
#
|
||||
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm.mk,v $ $Revision: 1.12 $
|
||||
# $Source: /home/interpeak/CVSRoot/ipmip6pm/gmake/ipmip6pm.mk,v $
|
||||
# $Author: jhorteli $ $Date: 2009-03-02 17:32:15 $
|
||||
# $State: Exp $ $Locker: $
|
||||
#
|
||||
# INTERPEAK_COPYRIGHT_STRING
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
ifeq ($(IPMIP6PM),)
|
||||
|
||||
IPMIP6PM := yes
|
||||
|
||||
#############################################################################
|
||||
# PRODUCT
|
||||
###########################################################################
|
||||
|
||||
IPPROD ?= ipmip6pm
|
||||
|
||||
|
||||
#############################################################################
|
||||
# DEFINE
|
||||
###########################################################################
|
||||
|
||||
IPDEFINE += -DIPMIP6PM
|
||||
|
||||
#############################################################################
|
||||
# INCLUDE
|
||||
###########################################################################
|
||||
|
||||
IPINCLUDE += -I$(IPMIP6PM_ROOT)/config
|
||||
IPINCLUDE += -I$(IPMIP6PM_ROOT)/include
|
||||
IPINCLUDE += -I$(IPMIP6PM_ROOT)/src
|
||||
|
||||
#############################################################################
|
||||
# OBJECTS
|
||||
###########################################################################
|
||||
|
||||
ifneq ($(IPPORT),lkm)
|
||||
|
||||
# If las, don't include the entry point files.
|
||||
ifneq ($(IPPORT),las)
|
||||
|
||||
# Entry point files.
|
||||
IPLIBOBJECTS += ipmip6pm.o
|
||||
IPLIBOBJECTS += ipmip6pm_cmd_pm6.o
|
||||
|
||||
endif
|
||||
|
||||
# Configuration
|
||||
IPLIBOBJECTS_C += ipmip6pm_config.o
|
||||
|
||||
# Mobile Node Objects
|
||||
IPLIBOBJECTS += ipmip6pm_attr.o
|
||||
IPLIBOBJECTS += ipmip6pm_cli.o
|
||||
IPLIBOBJECTS += ipmip6pm_ifevent.o
|
||||
IPLIBOBJECTS += ipmip6pm_icmp.o
|
||||
IPLIBOBJECTS += ipmip6pm_if.o
|
||||
IPLIBOBJECTS += ipmip6pm_main.o
|
||||
IPLIBOBJECTS += ipmip6pm_mh.o
|
||||
IPLIBOBJECTS += ipmip6pm_node.o
|
||||
IPLIBOBJECTS += ipmip6pm_route.o
|
||||
IPLIBOBJECTS += ipmip6pm_link_address.o
|
||||
IPLIBOBJECTS += ipmip6pm_link_local.o
|
||||
IPLIBOBJECTS += ipmip6pm_lma.o
|
||||
IPLIBOBJECTS += ipmip6pm_service_radvd.o
|
||||
IPLIBOBJECTS += ipmip6pm_service_dsmipv6.o
|
||||
IPLIBOBJECTS += ipmip6pm_service_dhcpv6_relay.o
|
||||
IPLIBOBJECTS += ipmip6pm_service_selection.o
|
||||
IPLIBOBJECTS += ipmip6pm_service_vendor_extension.o
|
||||
IPLIBOBJECTS += ipmip6pm_pktbuf.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 += $(IPMIP6PM_ROOT)/src $(IPMIP6PM_ROOT)/config
|
||||
|
||||
|
||||
#############################################################################
|
||||
# LIB
|
||||
###########################################################################
|
||||
|
||||
IPLIBS += $(IPLIBROOT)/libipmip6pm.a
|
||||
|
||||
endif # LKM
|
||||
|
||||
|
||||
ifeq ($(IPPORT),las)
|
||||
|
||||
#############################################################################
|
||||
# BINARIES
|
||||
###########################################################################
|
||||
|
||||
|
||||
# Path to binaries
|
||||
IPCMDDIR := $(IPOBJDIR)/bin
|
||||
IPDAEMONDIR := $(IPOBJDIR)/sbin
|
||||
|
||||
# List of shell commands to build
|
||||
IPMIP6PMCMDS = pm6
|
||||
_IPIPMIP6PMCMDS = $(addprefix $(IPCMDDIR)/,$(IPMIP6PMCMDS))
|
||||
|
||||
# List of daemons to build
|
||||
IPMIP6PMD = pm6d
|
||||
_IPMIP6PMD = $(addprefix $(IPDAEMONDIR)/,$(IPMIP6PMD))
|
||||
|
||||
bin: $(_IPIPMIP6PMCMDS) $(_IPMIP6PMD)
|
||||
|
||||
$(IPOBJDIR)/ipmip6pm_cmd_pm6.o: $(IPMIP6PM_ROOT)/src/ipmip6pm_cmd_pm6.c
|
||||
@$(IPECHO) "+++ Compiling IPMIP6PM shell command $<"
|
||||
$(IPVERB)$(IPCC) -Dipmip6pm_cmd_pm6=ipcom_cmd_entry_point $(IPCFLAGS) -o $@ $<
|
||||
|
||||
$(IPOBJDIR)/ipmip6pm.o: $(IPMIP6PM_ROOT)/src/ipmip6pm.c
|
||||
@$(IPECHO) "+++ Compiling IPMIP6PM daemon $<"
|
||||
$(IPVERB)$(IPCC) -Dipmip6pm_proc=ipcom_daemon_entry_point $(IPCFLAGS) -o $@ $<
|
||||
|
||||
# Linking shell commands and daemons
|
||||
$(IPCMDDIR)/pm6: $(IPOBJDIR)/ipmip6pm_cmd_pm6.o $(IPOBJDIR)/ipcom_shell_cmd_stub.o
|
||||
@$(IPECHO) "+++ Linking IPMIP6PM shell command $@"
|
||||
$(IPVERB)$(IPLD) -o $@ $(IPLDFLAGS) $^ $(IPLIBS) $(IPLIBS) $(IPLIBS) $(IPLASTLIBS)
|
||||
|
||||
$(IPDAEMONDIR)/pm6d: $(IPOBJDIR)/ipmip6pm.o $(IPOBJDIR)/ipcom_daemon_stub.o
|
||||
@$(IPECHO) "+++ Linking IPMIP6PMD daemon $@"
|
||||
$(IPVERB)$(IPLD) -o $@ $(IPLDFLAGS) $^ $(IPLIBS) $(IPLIBS) $(IPLIBS) $(IPLASTLIBS)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
endif # IPMIP6PM
|
||||
|
||||
###########################################################################
|
||||
# END OF IPMIP6PM.MK
|
||||
###########################################################################
|
||||
@@ -0,0 +1,70 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm.h,v $ $Revision: 1.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/include/ipmip6pm.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_H
|
||||
#define IPMIP6PM_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPMIP6PM_RELEASE 60701
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,152 @@
|
||||
/* ipmip6pm_attr.h - ipmip6pm_attr.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_attr.h,v $ $Revision: 1.13 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/include/ipmip6pm_attr.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_ATTR_H
|
||||
#define IPMIP6PM_ATTR_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <ipmip6_mib.h>
|
||||
#include <private/ipmip6_attr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_CLI_BC_P_LIST = IPMIP6_CLI_BASE,
|
||||
IPMIP6PM_CLI_BC_P_GET,
|
||||
IPMIP6PM_CLI_BC_P_CREATE,
|
||||
IPMIP6PM_CLI_BC_P_DELETE,
|
||||
IPMIP6PM_CLI_BC_P_DEREGISTER_DELETE,
|
||||
IPMIP6PM_CLI_BC_P_DEREGISTER,
|
||||
IPMIP6PM_CLI_BC_P_REVOKE,
|
||||
IPMIP6PM_CLI_BC_P_REVOKE_INET,
|
||||
IPMIP6PM_CLI_BC_P_REVOKE_LMA,
|
||||
IPMIP6PM_CLI_BC_P_GET_LMA,
|
||||
IPMIP6PM_CLI_BC_P_LIST_SERVICE,
|
||||
IPMIP6PM_CLI_BC_P_LIST_LINK,
|
||||
IPMIP6PM_CLI_BC_P_STATUS,
|
||||
IPMIP6PM_CLI_MAX
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_CLI_ATTR_NONE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P,
|
||||
IPMIP6PM_CLI_ATTR_LMA,
|
||||
IPMIP6PM_CLI_ATTR_MAX
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_CLI_ATTR_BC_P_NONE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_MOBILE_NAI,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_IFIDENT,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_IFLLA,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_IFNAME,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_COA_IFNAME,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_ACCESS_TYPE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_HANDOFF_INDICATOR,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_CREATED,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT_INET,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_HOME_PREFIX_LIST,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_TYPE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_MIB_mip6MnBLTable,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_MIB_mip6NodeTrafficEntry,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_MAG_Link_Local,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_MAG_Link_Layer,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_HOME_ADDRESS_INET,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SERVICE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_LINK,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_GRE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_IFNAME,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_HANDLE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_TRANSPORT_MASK,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_REVOKE_REASON,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_ALT_COA,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_MAX
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_NONE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_SRV_MAX
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_CREATED,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_PENDING,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_RETRANSMIT,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_TIMEOUT,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_ERROR,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_DELETED,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_REGISTERED,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_RUNNING,
|
||||
IPMIP6PM_CLI_ATTR_BC_P_STATUS_MAX
|
||||
};
|
||||
|
||||
#define IPMIP6PM_CLI_ATTR_BC_P_STATUS_NONE IPMIP6PM_CLI_ATTR_BC_P_STATUS_MAX
|
||||
|
||||
extern const char *ipmip6pm_attr_status_desc[IPMIP6PM_CLI_ATTR_BC_P_STATUS_MAX];
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,211 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm.c,v $ $Revision: 1.16 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <ipcom_type.h>
|
||||
#include <ipcom_cstyle.h>
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_syslog.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_dhcp.h>
|
||||
#include <private/ipmip_inet.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_pkt.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_mh.h>
|
||||
#include <private/ipmip6_mh_pkt.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm.h"
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_ifevent.h"
|
||||
#include "ipmip6pm_mh.h"
|
||||
#include "ipmip6pm_icmp.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_route.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6pm_exit(void);
|
||||
IP_PUBLIC Ip_err ipmip6pm_init(void);
|
||||
IP_PUBLIC Ip_err ipmip6pm_start(void);
|
||||
IP_PUBLIC const char *ipmip6pm_version(void);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
#ifdef IP_PORT_LAS
|
||||
extern void ipnet_radvd_main(Ip_bool do_ipd);
|
||||
extern Ip_err ipnet_radvd_create(void);
|
||||
|
||||
IPCOM_PROCESS(ipmip6pm_radvd_proc);
|
||||
IPCOM_PROCESS(ipmip6pm_radvd_proc)
|
||||
{
|
||||
ipnet_radvd_create();
|
||||
ipnet_radvd_main(IP_FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC IPCOM_PROCESS(ipmip6pm_proc);
|
||||
IP_PUBLIC
|
||||
IPCOM_PROCESS(ipmip6pm_proc)
|
||||
{
|
||||
#ifdef IP_PORT_LAS
|
||||
ipcom_proc_create("ipmip6pm_radvd", (Ipcom_proc_func)ipmip6pm_radvd_proc,
|
||||
IPCOM_PROC_STACK_LARGE, IP_NULL);
|
||||
#endif
|
||||
|
||||
ipmip6pm_main();
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_start
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err
|
||||
ipmip6pm_start(void)
|
||||
{
|
||||
Ipcom_proc_attr attr;
|
||||
Ip_err ret;
|
||||
|
||||
ipcom_proc_attr_init(&attr);
|
||||
attr.stacksize = IPCOM_PROC_STACK_LARGE;
|
||||
|
||||
ret = ipcom_proc_acreate("ipmip6pmd", ipmip6pm_proc, &attr, IP_NULL);
|
||||
ip_assert(ret == IPCOM_SUCCESS);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_version
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC const char *
|
||||
ipmip6pm_version(void)
|
||||
{
|
||||
return "@(#) IPMIP6PM $Name: VXWORKS_ITER40_2019102207 $ - INTERPEAK_COPYRIGHT_STRING";
|
||||
}
|
||||
|
||||
|
||||
#if defined (IP_PORT_LAS)
|
||||
|
||||
IP_PUBLIC Ip_err ipcom_daemon_configure(void);
|
||||
IP_PUBLIC Ip_err ipcom_daemon_create(void);
|
||||
|
||||
IP_PUBLIC Ip_err
|
||||
ipcom_daemon_configure(void)
|
||||
{
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_err
|
||||
ipcom_daemon_create(void)
|
||||
{
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_attr_h.h,v $ $Revision: 1.5 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_attr_h.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-02-25 14:34:26 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_ATTR_H_H
|
||||
#define IPMIP6PM_ATTR_H_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipmip6pm_attr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip6pm_node;
|
||||
struct Ipmip_proc;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmip6pm_attr_command - ipmip6pm_attr_command
|
||||
*
|
||||
* Process an attribute command
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i request
|
||||
* Issued command.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IPCOM_SUCCESS when successful
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL int ipmip6pm_attr_command
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip_cli_message *request
|
||||
);
|
||||
|
||||
|
||||
|
||||
IP_GLOBAL void ipmip6pm_attr_delete_event(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_attr_status_change(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node,
|
||||
Ip_u32 status);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,722 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_cli.c,v $ $Revision: 1.11 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_cli.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_sysctl.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_buffer.h>
|
||||
#include <private/ipmip_util.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_mh.h>
|
||||
#include <private/ipmip6_mh_pkt.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
#include <private/ipmip6_address.h>
|
||||
|
||||
#include "ipmip6pm.h"
|
||||
#include "ipmip6pm_attr.h"
|
||||
#include "ipmip6pm_cli.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmip6pm_cli_connect(Ipmip_cli_daemon_t *daemon_info)
|
||||
{
|
||||
ipmip_cli_daemon_init(daemon_info, "ipmip6pm", IPCOM_IPD_ID_IPMIP6PM);
|
||||
return ipmip_cli_daemon_connect(daemon_info);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_nai(Ipmip_cli_daemon_req_t *req,
|
||||
const char *nai)
|
||||
{
|
||||
if (nai)
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_MOBILE_NAI, nai);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_handle(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 handle)
|
||||
{
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HANDLE, handle);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_ifname(Ipmip_cli_daemon_req_t *req,
|
||||
const char *ifname)
|
||||
{
|
||||
if (ifname)
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_IFNAME, ifname);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_service(Ipmip_cli_daemon_req_t *req,
|
||||
const char *module,
|
||||
const char *value)
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE, module);
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE, value);
|
||||
ipmip_attr_end(&req->reqbuf, rta);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_link(Ipmip_cli_daemon_req_t *req,
|
||||
const char *module,
|
||||
const char *value)
|
||||
{
|
||||
Ip_size_t rta = ipmip_attr_begin(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_LINK);
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE, module);
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE, value);
|
||||
ipmip_attr_end(&req->reqbuf, rta);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_MAG_configuration(Ipmip_cli_daemon_req_t *req,
|
||||
const char *ifname)
|
||||
{
|
||||
if (ifname)
|
||||
ipmip_attr_put_str(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_COA_IFNAME, ifname);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_add_prefix(Ipmip_cli_daemon_req_t *req,
|
||||
struct Ipmip6_address *prefix)
|
||||
{
|
||||
if (prefix)
|
||||
ipmip_attr_put(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_PREFIX_LIST, sizeof(*prefix), prefix);
|
||||
}
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_add_home_address_inet(Ipmip_cli_daemon_req_t *req,
|
||||
struct Ipmip6_inet *prefix)
|
||||
{
|
||||
if (prefix)
|
||||
ipmip_attr_put(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_ADDRESS_INET, sizeof(*prefix), prefix);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_homeagent(Ipmip_cli_daemon_req_t *req,
|
||||
const struct Ip_in6_addr *homeagent)
|
||||
{
|
||||
if (homeagent)
|
||||
ipmip_attr_put_inet6(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT, homeagent);
|
||||
}
|
||||
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_homeagent_inet(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 homeagent)
|
||||
{
|
||||
if (homeagent)
|
||||
ipmip_attr_put_inet(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT_INET, homeagent);
|
||||
}
|
||||
#endif
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_link_layer(Ipmip_cli_daemon_req_t *req,
|
||||
void *lla,
|
||||
Ip_size_t lla_size)
|
||||
{
|
||||
if (lla != IP_NULL && lla_size > 0)
|
||||
ipmip_attr_put(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_IFIDENT, lla_size, lla);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_gre_downlink(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 downlink)
|
||||
{
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_GRE, downlink);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_tunnel_type(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u8 tunnel_type)
|
||||
{
|
||||
/**/
|
||||
if (tunnel_type < IPMIP_TUNNELTYPE_MAX)
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_TYPE, tunnel_type);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_transport_mask(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 mask)
|
||||
{
|
||||
if (mask)
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_TRANSPORT_MASK, mask);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_handoff_indicator(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 handoff_indicator)
|
||||
{
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_HANDOFF_INDICATOR, handoff_indicator);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_access_type(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 access_type)
|
||||
{
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_ACCESS_TYPE, access_type);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_handle_next(Ipmip_attr_iter_t *iter)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_get_u32(ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_BC_P_HANDLE));
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_handle_get(Ipmip_cli_daemon_req_t *req)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_get_u32(ipmip_cli_daemon_find_request(req, IPMIP6PM_CLI_ATTR_BC_P_HANDLE));
|
||||
}
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmip6pm_cli_node_get_ifname(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIP6PM_CLI_ATTR_BC_P_IFNAME);
|
||||
}
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmip6pm_cli_node_get_tunnel_ifname(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_IFNAME);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ip_in6_addr *
|
||||
ipmip6pm_cli_node_get_home_agent(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_inet6(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT);
|
||||
}
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_node_get_home_agent_inet(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_inet(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT_INET);
|
||||
}
|
||||
#endif
|
||||
|
||||
IP_PUBLIC Ip_u8
|
||||
ipmip6pm_cli_node_get_tunnel_type(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_TUNNEL_TYPE);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_attr *
|
||||
ipmip6pm_cli_node_get_gre_keys(struct Ipmip_attr *node)
|
||||
{
|
||||
|
||||
return ipmip_attr_payload_find(node, IPMIP6PM_CLI_ATTR_BC_P_GRE);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_node_get_transport_mask(struct Ipmip_attr *node)
|
||||
{
|
||||
|
||||
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_TRANSPORT_MASK);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmip6pm_cli_node_get_nai(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(node, IPMIP6PM_CLI_ATTR_BC_P_MOBILE_NAI);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip6_mib_mip6MnBLTable *
|
||||
ipmip6pm_cli_node_get_mip6MnBLTable(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return (struct Ipmip6_mib_mip6MnBLTable *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MIB_mip6MnBLTable);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip6_mib_mip6NodeTrafficEntry *
|
||||
ipmip6pm_cli_node_get_mip6NodeTrafficEntry(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return (struct Ipmip6_mib_mip6NodeTrafficEntry *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MIB_mip6NodeTrafficEntry);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_lladdr *
|
||||
ipmip6pm_cli_node_get_iflla(struct Ipmip_attr *node)
|
||||
{
|
||||
return (struct Ipmip_lladdr *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_IFLLA);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_lladdr *
|
||||
ipmip6pm_cli_node_get_MAG_iflla(struct Ipmip_attr *node)
|
||||
{
|
||||
return (struct Ipmip_lladdr *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MAG_Link_Layer);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip6_address *
|
||||
ipmip6pm_cli_node_get_MAG_link_local(struct Ipmip_attr *node)
|
||||
{
|
||||
return (struct Ipmip6_address *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_MAG_Link_Local);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip6_address *
|
||||
ipmip6pm_cli_node_get_home_prefix_list(struct Ipmip_attr *node,
|
||||
Ip_u32 *sz)
|
||||
{
|
||||
struct Ipmip_attr *rta = ipmip_attr_payload_find(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_PREFIX_LIST);
|
||||
if (rta)
|
||||
{
|
||||
*sz = IPMIP_ATTR_PAYLOAD(rta) / sizeof(Ipmip6_address_t);
|
||||
return *sz? (Ipmip6_address_t *)IPMIP_ATTR_DATA(rta) : IP_NULL;
|
||||
}
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
IP_PUBLIC struct Ipmip6_inet *
|
||||
ipmip6pm_cli_node_get_home_address_inet(struct Ipmip_attr *node)
|
||||
{
|
||||
return (struct Ipmip6_inet *)ipmip_attr_payload_find_data(node, IPMIP6PM_CLI_ATTR_BC_P_HOME_ADDRESS_INET);
|
||||
}
|
||||
#endif
|
||||
|
||||
IP_PUBLIC Ip_time_t
|
||||
ipmip6pm_cli_node_get_created(struct Ipmip_attr *node)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_time_t(node, IPMIP6PM_CLI_ATTR_BC_P_CREATED);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_node_get_access_type(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_ACCESS_TYPE);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_node_get_handoff_indicator(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_HANDOFF_INDICATOR);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_node_get_status(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_STATUS);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_node_get_handle(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIP6PM_CLI_ATTR_BC_P_HANDLE);
|
||||
}
|
||||
|
||||
IP_PUBLIC int
|
||||
ipmip6pm_cli_link_list(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_LIST_LINK);
|
||||
|
||||
return ipmip_cli_daemon_request(daemon, req);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmip6pm_cli_link_next(Ipmip_attr_iter_t *iter,
|
||||
char **name,
|
||||
char **value)
|
||||
{
|
||||
/**/
|
||||
struct Ipmip_attr *srv = ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_BC_P_LINK);
|
||||
if (srv)
|
||||
{
|
||||
*name = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE);
|
||||
*value = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE);
|
||||
return IP_TRUE;
|
||||
}
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC int
|
||||
ipmip6pm_cli_service_list(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_LIST_SERVICE);
|
||||
|
||||
return ipmip_cli_daemon_request(daemon, req);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmip6pm_cli_service_next(Ipmip_attr_iter_t *iter,
|
||||
char **name,
|
||||
char **value)
|
||||
{
|
||||
/**/
|
||||
struct Ipmip_attr *srv = ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_BC_P_SERVICE);
|
||||
if (srv)
|
||||
{
|
||||
*name = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_MODULE);
|
||||
*value = ipmip_attr_payload_find_str(srv, IPMIP6PM_CLI_ATTR_BC_P_SRV_VALUE);
|
||||
return IP_TRUE;
|
||||
}
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
IP_PUBLIC int
|
||||
ipmip6pm_cli_node_list(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req,
|
||||
const char *nai,
|
||||
const char *ifname)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_LIST);
|
||||
|
||||
ipmip6pm_cli_request_set_ifname(req, ifname);
|
||||
ipmip6pm_cli_request_set_nai(req, nai);
|
||||
|
||||
return ipmip_cli_daemon_request(daemon, req);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_attr *
|
||||
ipmip6pm_cli_node_get(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 handle)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_GET);
|
||||
|
||||
ipmip6pm_cli_request_set_handle(req, handle);
|
||||
|
||||
if (ipmip_cli_daemon_request(daemon, req) == IPCOM_SUCCESS)
|
||||
return ipmip_cli_daemon_find_request(req, IPMIP6PM_CLI_ATTR_BC_P);
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_node_delete(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_DELETE);
|
||||
|
||||
ipmip6pm_cli_request_set_handle(&req, handle);
|
||||
|
||||
ipmip_cli_daemon_request(daemon, &req);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_node_deregister(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle,
|
||||
Ip_bool ack)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, ack? IPMIP6PM_CLI_BC_P_DEREGISTER : IPMIP6PM_CLI_BC_P_DEREGISTER_DELETE);
|
||||
|
||||
ipmip6pm_cli_request_set_handle(&req, handle);
|
||||
|
||||
ipmip_cli_daemon_request(daemon, &req);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_handoff_request_init(Ipmip_cli_daemon_req_t *req,
|
||||
const char *nai,
|
||||
const char *ifname)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_CREATE);
|
||||
ipmip6pm_cli_request_set_nai(req, nai);
|
||||
ipmip6pm_cli_request_set_ifname(req, ifname);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_multicast_status(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_bool enable)
|
||||
{
|
||||
if (enable)
|
||||
ipmip_cli_multicast_add(daemon, IPMIP6PM_CLI_BC_P_STATUS);
|
||||
else
|
||||
ipmip_cli_multicast_del(daemon, IPMIP6PM_CLI_BC_P_STATUS);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_node_retrieve_status(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
struct Ipmip_attr *node;
|
||||
Ip_u32 status = IPMIP6PM_CLI_ATTR_BC_P_STATUS_DELETED;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
node = ipmip6pm_cli_node_get(daemon, &req, handle);
|
||||
if (node)
|
||||
status = ipmip6pm_cli_node_get_status(node);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmip6pm_cli_node_wait_status(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle,
|
||||
Ip_u32 status,
|
||||
struct Ip_timeval *tv)
|
||||
{
|
||||
struct Ipmip_attr *node;
|
||||
Ip_u32 tmp;
|
||||
|
||||
/* Do initial status check */
|
||||
tmp = ipmip6pm_cli_node_retrieve_status(daemon, handle);
|
||||
if (tmp == status)
|
||||
return IP_TRUE;
|
||||
|
||||
if (tmp == IPMIP6PM_CLI_ATTR_BC_P_STATUS_DELETED)
|
||||
return IP_FALSE;
|
||||
|
||||
/* Wait for it to be reported */
|
||||
while (ipmip_cli_daemon_recvmsg(daemon, tv) == 0)
|
||||
{
|
||||
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&daemon->message);
|
||||
|
||||
if (IPMIP_ATTR_HDR_SEQUENCE(hdr) == 0 && IPMIP_ATTR_HDR_SYSTEM(hdr) == 0 && IPMIP_ATTR_HDR_TYPE(hdr) == IPMIP6PM_CLI_BC_P_STATUS)
|
||||
{
|
||||
node = ipmip_attr_hdr_find(hdr, IPMIP6PM_CLI_ATTR_BC_P);
|
||||
if (node)
|
||||
{
|
||||
if (ipmip6pm_cli_node_get_handle(node) == handle)
|
||||
{
|
||||
tmp = ipmip6pm_cli_node_get_status(node);
|
||||
if (tmp == status)
|
||||
return IP_TRUE;
|
||||
|
||||
/* Final state? */
|
||||
if (tmp == IPMIP6PM_CLI_ATTR_BC_P_STATUS_DELETED)
|
||||
return IP_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
IP_PUBLIC int
|
||||
ipmip6pm_cli_lma_list(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIP6PM_CLI_BC_P_GET_LMA);
|
||||
return ipmip_cli_daemon_request(daemon, req);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_attr*
|
||||
ipmip6pm_cli_lma_next(Ipmip_attr_iter_t *iter)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_iter_next(iter, IPMIP6PM_CLI_ATTR_LMA);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ip_in6_addr *
|
||||
ipmip6pm_cli_lma_get_addr_v6(struct Ipmip_attr *lma)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_inet6(lma, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT);
|
||||
}
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmip6pm_cli_lma_get_addr_v4(struct Ipmip_attr *lma)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_inet(lma, IPMIP6PM_CLI_ATTR_BC_P_HOME_AGENT_INET);
|
||||
}
|
||||
#endif
|
||||
|
||||
IP_PUBLIC const char *
|
||||
ipmip6pm_cli_lma_get_ifname(struct Ipmip_attr *lma)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_payload_find_str(lma, IPMIP6PM_CLI_ATTR_BC_P_IFNAME);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_request_set_revoke_reason(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u8 reason)
|
||||
{
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIP6PM_CLI_ATTR_BC_P_REVOKE_REASON, reason);
|
||||
}
|
||||
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_lma_revoke(Ipmip_cli_daemon_t *daemon,
|
||||
const char *ifname,
|
||||
const struct Ip_in6_addr *lma,
|
||||
Ip_u8 reason)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_REVOKE_LMA);
|
||||
|
||||
ipmip6pm_cli_request_set_homeagent(&req, lma);
|
||||
ipmip6pm_cli_request_set_revoke_reason(&req, reason);
|
||||
ipmip6pm_cli_request_set_ifname(&req, ifname);
|
||||
|
||||
ipmip_cli_daemon_request(daemon, &req);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_node_revoke(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle,
|
||||
Ip_u32 reason)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_REVOKE);
|
||||
|
||||
ipmip6pm_cli_request_set_handle(&req, handle);
|
||||
ipmip6pm_cli_request_set_revoke_reason(&req, reason);
|
||||
|
||||
ipmip_cli_daemon_request(daemon, &req);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
}
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
IP_PUBLIC void
|
||||
ipmip6pm_cli_node_revoke_inet(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle,
|
||||
Ip_u32 reason)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIP6PM_CLI_BC_P_REVOKE_INET);
|
||||
|
||||
ipmip6pm_cli_request_set_handle(&req, handle);
|
||||
ipmip6pm_cli_request_set_revoke_reason(&req, reason);
|
||||
|
||||
ipmip_cli_daemon_request(daemon, &req);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,238 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_h.h,v $ $Revision: 1.12 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_h.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_H_H
|
||||
#define IPMIP6PM_H_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_SERVICE_PKT_REPLY_VERIFY,
|
||||
IPMIP6PM_SERVICE_PKT_REPLY_ACCEPT,
|
||||
IPMIP6PM_SERVICE_PKT_REQUEST
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_FUNCTION_LINK = 0,
|
||||
IPMIP6PM_FUNCTION_SERVICE,
|
||||
IPMIP6PM_FUNCTION_MAX
|
||||
};
|
||||
|
||||
|
||||
#define IPMIP6PM_FUNCTION_FUNC(f) ((f) >> 16)
|
||||
#define IPMIP6PM_FUNCTION_TYPE(f) ((f) & 0xFFFF)
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip_cli_message;
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip6pm_if;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmip6pm_node;
|
||||
struct Ipmip_timer;
|
||||
struct Ipmip6pm_pktbuf;
|
||||
struct Ipmip_context_id;
|
||||
|
||||
typedef void (*Ipmip6pm_extension_config_global_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
void *global_config,
|
||||
struct Ipmip_cli_message *request
|
||||
);
|
||||
|
||||
typedef void (*Ipmip6pm_extension_config_ifp_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
void *global_config,
|
||||
void *ifp_config,
|
||||
struct Ipmip_cli_message *request
|
||||
);
|
||||
|
||||
typedef int (*Ipmip6pm_extension_provide_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
void *global_config,
|
||||
void *ifp_config,
|
||||
void *node_config,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip_timer *service
|
||||
);
|
||||
|
||||
typedef Ip_bool (*Ipmip6pm_extension_setup_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
void *global_config,
|
||||
void *ifp_config,
|
||||
void *node_config,
|
||||
struct Ipmip6pm_node *node,
|
||||
const char *value,
|
||||
struct Ipmip_cli_message *request
|
||||
);
|
||||
|
||||
typedef Ip_bool (*Ipmip6pm_extension_pkt_rep_validate_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
void *global_config,
|
||||
void *ifp_config,
|
||||
void *node_config,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf,
|
||||
struct Ipmip_timer *service
|
||||
);
|
||||
|
||||
typedef Ip_bool (*Ipmip6pm_extension_pkt_rep_accept_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
void *global_config,
|
||||
void *ifp_config,
|
||||
void *node_config,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf,
|
||||
struct Ipmip_timer *service
|
||||
);
|
||||
|
||||
typedef void (*Ipmip6pm_extension_pkt_req_apply_t)
|
||||
(
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
void *global_config,
|
||||
void *ifp_config,
|
||||
void *node_config,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf
|
||||
);
|
||||
|
||||
|
||||
typedef struct Ipmip6pm_extension
|
||||
{
|
||||
const char *name;
|
||||
const char *syntax;
|
||||
|
||||
Ip_u32 global_data_size;
|
||||
Ip_u32 node_data_size;
|
||||
Ip_u32 ifp_data_size;
|
||||
|
||||
/* Callbacks */
|
||||
Ipmip6pm_extension_config_global_t config_global;
|
||||
Ipmip6pm_extension_config_ifp_t config_ifp;
|
||||
Ipmip6pm_extension_provide_t provide;
|
||||
Ipmip6pm_extension_setup_t setup;
|
||||
|
||||
Ipmip6pm_extension_pkt_rep_validate_t pkt_rep_validate;
|
||||
Ipmip6pm_extension_pkt_rep_accept_t pkt_rep_accept;
|
||||
Ipmip6pm_extension_pkt_req_apply_t pkt_req_apply;
|
||||
|
||||
/* Set by PMIP */
|
||||
Ip_u32 unique;
|
||||
} Ipmip6pm_extension_t;
|
||||
|
||||
typedef struct Ipmip6pm_function_context
|
||||
{
|
||||
Ipmip6pm_extension_t *functions[32];
|
||||
Ip_u32 num;
|
||||
Ip_u32 node_data;
|
||||
Ip_u32 mask;
|
||||
Ip_u32 elem;
|
||||
} Ipmip6pm_function_context_t;
|
||||
|
||||
typedef struct Ipmip6pm_context
|
||||
{
|
||||
Ipmip6_context_t ipmip6; /* Global context */
|
||||
|
||||
Ip_fd fd_ipd; /* ipd */
|
||||
|
||||
Ip_u32 iftable_pm_to;
|
||||
Ip_u32 iftable_pm_from;
|
||||
#ifdef IPMIP_USE_INET
|
||||
Ip_u32 iftable_pm_inet;
|
||||
#endif
|
||||
|
||||
/**/
|
||||
Ipcom_list ifs;
|
||||
Ipmip_timer_lock_t *ifs_lock;
|
||||
|
||||
Ipcom_atomic_t sequence;
|
||||
|
||||
struct Ipmip_context_id *idents;
|
||||
struct Ipmip_context_id *bri;
|
||||
|
||||
Ipmip6pm_function_context_t extensions[IPMIP6PM_FUNCTION_MAX];
|
||||
void *extdata[IPMIP6PM_FUNCTION_MAX][32];
|
||||
}
|
||||
Ipmip6pm_context_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL Ip_u32 ipmip6pm_context_register_extension(Ipmip6pm_context_t *ctx,
|
||||
Ipmip6pm_extension_t *srv,
|
||||
Ip_u32 type);
|
||||
IP_GLOBAL void ipmip6pm_main(void);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,148 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_icmp.c,v $ $Revision: 1.4 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_icmp.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_syslog.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_icmp_pkt.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_icmp.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_icmp_dispatch
|
||||
*===========================================================================
|
||||
* Description: Process an ICMP packet.
|
||||
* Parameters: context - The context.
|
||||
* icmp - The ICMP packet
|
||||
* icmp_len - The length of the ICMP packet.
|
||||
* pktinfo - Packet info.
|
||||
* src - The sender
|
||||
* salist - List of SA's processed
|
||||
* rthdr2 - Did this ICMP frame contain a RTHDR2.
|
||||
* Returns: IP_TRUE if successfully processed.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool
|
||||
ipmip6pm_icmp_dispatch(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_pktbuf_t *pbuf)
|
||||
{
|
||||
Ipmip6_pkt_icmp6_t *icmp = IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
/* Determine what we've got */
|
||||
switch (icmp->icmp6_type)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_icmp.h,v $ $Revision: 1.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_icmp.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-02-09 15:46:38 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_ICMP_H
|
||||
#define IPMIP6PM_ICMP_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6_address;
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmip6pm_pktbuf;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_icmp_dispatch
|
||||
*===========================================================================
|
||||
* Description: Process an ICMP packet.
|
||||
* Parameters: context - The context.
|
||||
* icmp - The ICMP packet
|
||||
* icmp_len - The length of the ICMP packet.
|
||||
* pktinfo - Packet info.
|
||||
* src - The sender
|
||||
* salist - List of SA's processed
|
||||
* rthdr2 - Did this ICMP frame contain a RTHDR2.
|
||||
* Returns: IP_TRUE if successfully processed.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmip6pm_icmp_dispatch(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,878 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_if.c,v $ $Revision: 1.19.10.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_if.c,v $
|
||||
* $Author: svc-cmnet $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_if.c,v $ $Revision: 1.19.10.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_if.c,v $
|
||||
* $Author: svc-cmnet $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipnet.h>
|
||||
#include <ipnet_policy_routing.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_icmp.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_route.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
#include "ipmip6pm_lma.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
IP_STATIC void
|
||||
ipmip6pm_if_tunnel_cleanup_inet(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_if_t *ife)
|
||||
{
|
||||
/* Delete the policy rule */
|
||||
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET6,
|
||||
IP_RTM_DELRULE,
|
||||
ctx->iftable_pm_inet,
|
||||
IPMIP6PM_ROUTE_PRIORITY_BU,
|
||||
0,
|
||||
&ife->ifaddr.prefix,
|
||||
128,
|
||||
&ip_in6addr_any,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_if_tunnel_cleanup(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_if_t *ife)
|
||||
{
|
||||
/* Delete the policy rule */
|
||||
#if 0
|
||||
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET6,
|
||||
IP_RTM_DELRULE,
|
||||
ctx->iftable_pm_to,
|
||||
IPMIP6PM_ROUTE_PRIORITY_BU,
|
||||
ife->ipmip6.iff.ifindex,
|
||||
&ip_in6addr_any,
|
||||
0,
|
||||
&ip_in6addr_any,
|
||||
0);
|
||||
#endif
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_if_cleanup(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_if_t *ife)
|
||||
{
|
||||
int i;
|
||||
unsigned int si;
|
||||
|
||||
ipmip6pm_lma_unconfigure(ctx, proc, ife);
|
||||
|
||||
/* Do destroy any tunnels on this interface */
|
||||
for (i = 0; i < IPMIP_TUNNELTYPE_MAX + 1; i++)
|
||||
{
|
||||
if (ife->iftunnels[i] != IP_NULL)
|
||||
{
|
||||
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ife->iftunnels[i]->ipmip6.iff);
|
||||
ife->iftunnels[i] = IP_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**/
|
||||
for (i = IPMIP6PM_FUNCTION_MAX - 1; i >= 0; i--)
|
||||
{
|
||||
for (si = 0; si < ctx->extensions[i].num; si++)
|
||||
{
|
||||
if (ctx->extensions[i].functions[si]->config_ifp != IP_NULL)
|
||||
{
|
||||
if (ife->extdata[i][si])
|
||||
{
|
||||
(*ctx->extensions[i].functions[si]->config_ifp) (ctx, proc, IPMIP_CALLBACK_CONFIG_FREE, ife, ctx->extdata[i][si], ife->extdata[i][si], IP_NULL);
|
||||
ipcom_free(ife->extdata[i][si]);
|
||||
ife->extdata[i][si] = IP_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ipmip6pm_node_context_destroy(ctx, proc, ife);
|
||||
}
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_if_tunnel_create_inet
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ipmip6pm_if_t *
|
||||
ipmip6pm_if_tunnel_create_inet(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
int type,
|
||||
struct Ip_in6_addr *addr6,
|
||||
Ip_u32 addr,
|
||||
Ip_u32 ifindex)
|
||||
{
|
||||
Ipmip6pm_if_t *ifp = IP_NULL;
|
||||
char gifname[IP_IFNAMSIZ];
|
||||
struct Ip_ip_tunnel_param tun;
|
||||
int ret;
|
||||
|
||||
ipcom_snprintf(gifname, sizeof(gifname), "%s%dpm%x", ipmip_util_tunnel_to_bsdname(type), type, ifindex);
|
||||
if (ipcom_if_nametoindex(gifname) != 0)
|
||||
return IP_NULL;
|
||||
|
||||
ifp = (Ipmip6pm_if_t *)ipmip6_if_alloc_tunnel(&ctx->ipmip6,
|
||||
proc,
|
||||
sizeof(*ifp),
|
||||
gifname,
|
||||
0,
|
||||
type,
|
||||
IP_FALSE,
|
||||
(Ipmip_if_cleanup_t)ipmip6pm_if_tunnel_cleanup_inet);
|
||||
if (ifp == IP_NULL)
|
||||
return IP_NULL;
|
||||
|
||||
/**/
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s created", gifname));
|
||||
|
||||
/**/
|
||||
ipcom_memcpy(&ifp->ifaddr.prefix, addr6, sizeof(struct Ip_in6_addr));
|
||||
ifp->ifinet = addr;
|
||||
|
||||
/* Assign the CoA address */
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET, IP_RTM_NEWADDR, ifp->ipmip6.iff.ifindex, &addr, 32, 0, 0) < 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to assign address to tunnel interface %s",
|
||||
ifp->ipmip6.iff.ifname));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
/* Assign the CoA address */
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET6, IP_RTM_NEWADDR, ifp->ipmip6.iff.ifindex, addr6, 128, 0, 0) < 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to assign address to tunnel interface %s",
|
||||
ifp->ipmip6.iff.ifname));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Add the policy rule */
|
||||
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET6,
|
||||
IP_RTM_NEWRULE,
|
||||
ctx->iftable_pm_inet,
|
||||
IPMIP6PM_ROUTE_PRIORITY_BU,
|
||||
0,
|
||||
&ifp->ifaddr.prefix,
|
||||
128,
|
||||
&ip_in6addr_any,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
|
||||
/* Change tunnel */
|
||||
ipcom_memset(&tun, 0, sizeof(tun));
|
||||
ipcom_strncpy(tun.ifr_name, ifp->ipmip6.iff.ifname, sizeof(tun.ifr_name));
|
||||
|
||||
tun.local_addr.sin.sin_family = IP_AF_INET;
|
||||
tun.local_addr.sin.sin_addr.s_addr = ifp->ifinet;
|
||||
tun.local_addr.sin.sin_port = ctx->ipmip6.pkt->s_udp_nat.sin6_port;
|
||||
IPCOM_SA_LEN_SET(&tun.local_addr.sin, sizeof(struct Ip_sockaddr_in));
|
||||
tun.remote_addr.sin.sin_family = IP_AF_INET;
|
||||
tun.remote_addr.sin.sin_addr.s_addr = 0;
|
||||
IPCOM_SA_LEN_SET(&tun.remote_addr.sin, sizeof(struct Ip_sockaddr_in));
|
||||
tun.ttl = 64;
|
||||
|
||||
/* Try set the tunnel values */
|
||||
if (ipmip_util_ioctl(&ctx->ipmip6.ipmip, proc, IP_SIOCCHGTUNNEL, &tun) < 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to configure tunnel interface %s",
|
||||
gifname));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* GO HUGE on MTU */
|
||||
if ((ret = ipmip_netlink_link(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_RTM_SETLINK,
|
||||
ifp->ipmip6.iff.ifindex,
|
||||
0,
|
||||
0,
|
||||
IP_NULL,
|
||||
IP_NULL,
|
||||
0xFFFF)) < 0)
|
||||
{
|
||||
IPCOM_LOG3(ERR,
|
||||
"%s: Unable to set large MTU on %s, ret = %d",
|
||||
ctx->ipmip6.ipmip.name,
|
||||
gifname,
|
||||
-ret);
|
||||
}
|
||||
|
||||
|
||||
/**/
|
||||
return ifp;
|
||||
|
||||
fail:
|
||||
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ifp->ipmip6.iff);
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_route_tunnel_create
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ipmip6pm_if_t *
|
||||
ipmip6pm_if_tunnel_create(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
int type,
|
||||
struct Ip_in6_addr *addr,
|
||||
Ip_u32 ifindex)
|
||||
{
|
||||
Ipmip6pm_if_t *ifp = IP_NULL;
|
||||
char tname[IP_IFNAMSIZ];
|
||||
struct Ip_ip_tunnel_param tun;
|
||||
int ret;
|
||||
|
||||
ipcom_snprintf(tname, sizeof(tname), "%s%dpm%x", ipmip_util_tunnel_to_bsdname(type), type, ifindex);
|
||||
if (ipcom_if_nametoindex(tname) != 0)
|
||||
return IP_NULL;
|
||||
|
||||
ifp = (Ipmip6pm_if_t *)ipmip6_if_alloc_tunnel(&ctx->ipmip6,
|
||||
proc,
|
||||
sizeof(*ifp),
|
||||
tname,
|
||||
0,
|
||||
type,
|
||||
IP_FALSE,
|
||||
(Ipmip_if_cleanup_t)ipmip6pm_if_tunnel_cleanup);
|
||||
if (ifp == IP_NULL)
|
||||
return IP_NULL;
|
||||
|
||||
/**/
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s created", tname));
|
||||
|
||||
/**/
|
||||
ipcom_memcpy(&ifp->ifaddr.prefix, addr, sizeof(struct Ip_in6_addr));
|
||||
|
||||
/* Assign the CoA address */
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET6, IP_RTM_NEWADDR, ifp->ipmip6.iff.ifindex, addr, 128, 0, 0) < 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to assign address to tunnel interface %s",
|
||||
ifp->ipmip6.iff.ifname));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Add the policy rule */
|
||||
ipmip_netlink_inX_rule(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_AF_INET6,
|
||||
IP_RTM_NEWRULE,
|
||||
ctx->iftable_pm_to,
|
||||
IPMIP6PM_ROUTE_PRIORITY_BU,
|
||||
ifp->ipmip6.iff.ifindex,
|
||||
&ip_in6addr_any,
|
||||
0,
|
||||
&ip_in6addr_any,
|
||||
0);
|
||||
#endif
|
||||
|
||||
|
||||
/* Change tunnel */
|
||||
ipcom_memset(&tun, 0, sizeof(tun));
|
||||
ipcom_strncpy(tun.ifr_name, ifp->ipmip6.iff.ifname, sizeof(tun.ifr_name));
|
||||
|
||||
tun.local_addr.sin6.sin6_family = IP_AF_INET6;
|
||||
tun.local_addr.sin6.sin6_addr = ifp->ifaddr.prefix;
|
||||
IPCOM_SA_LEN_SET(&tun.local_addr.sin6, sizeof(struct Ip_sockaddr_in6));
|
||||
tun.local_addr.sin6.sin6_port = ctx->ipmip6.pkt->s_udp_nat.sin6_port;
|
||||
tun.remote_addr.sin6.sin6_family = IP_AF_INET6;
|
||||
tun.remote_addr.sin6.sin6_addr = ip_in6addr_any;
|
||||
IPCOM_SA_LEN_SET(&tun.remote_addr.sin6, sizeof(struct Ip_sockaddr_in6));
|
||||
tun.remote_addr.sin6.sin6_scope_id = 3;
|
||||
tun.ttl = 64;
|
||||
|
||||
/* Try set the tunnel values */
|
||||
if (ipmip_util_ioctl(&ctx->ipmip6.ipmip, proc, IP_SIOCCHGTUNNEL, &tun) < 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to configure tunnel interface %s",
|
||||
tname));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* GO HUGE on MTU */
|
||||
if ((ret = ipmip_netlink_link(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
IP_RTM_SETLINK,
|
||||
ifp->ipmip6.iff.ifindex,
|
||||
0,
|
||||
0,
|
||||
IP_NULL,
|
||||
IP_NULL,
|
||||
0xFFFF)) < 0)
|
||||
{
|
||||
IPCOM_LOG3(ERR,
|
||||
"%s: Unable to set large MTU on %s, ret = %d",
|
||||
ctx->ipmip6.ipmip.name,
|
||||
tname,
|
||||
-ret);
|
||||
}
|
||||
|
||||
/**/
|
||||
return ifp;
|
||||
|
||||
fail:
|
||||
ipmip_if_free(&ctx->ipmip6.ipmip, proc, &ifp->ipmip6.iff);
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_if_setup(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6pm_if_t *ife)
|
||||
{
|
||||
unsigned int si;
|
||||
int i;
|
||||
|
||||
/**/
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s created", ife->ipmip6.iff.ifname));
|
||||
|
||||
/* Read some base values */
|
||||
ife->lifetime = ipmip_sysvar_ushort(ipmip_sysvar_ushort(60, "ipmip6pm.lifetime"), "ipmip6pm.interface.%s.lifetime", ife->ipmip6.iff.ifname);
|
||||
ife->InitialBindackTimeoutFirstReg = ipmip_sysvar_ulong(ipmip_sysvar_ushort(1500, "ipmip6pm.InitialBindackTimeoutFirstReg"), "ipmip6pm.%s.InitialBindackTimeoutFirstReg", ife->ipmip6.iff.ifname);
|
||||
ife->TimestampBasedApproachInUse = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.TimestampBasedApproachInUse"), "ipmip6pm.%s.TimestampBasedApproachInUse", ife->ipmip6.iff.ifname);
|
||||
ife->BRIMaxRetriesNumber = ipmip_sysvar_ulong(ipmip_sysvar_ulong(1, "ipmip6pm.BRIMaxRetriesNumber"), "ipmip6pm.interface.%s.BRIMaxRetriesNumber", ife->ipmip6.iff.ifname);
|
||||
ife->MINDelayBRIs = ipmip_sysvar_ulong(ipmip_sysvar_ulong(1000, "ipmip6pm.MINDelayBRIs"), "ipmip6pm.interface.%s.MINDelayBRIs", ife->ipmip6.iff.ifname);
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
/* Read the prefix list allowed for this interface */
|
||||
if (!ipmip_sysvar_inet(0, &ife->ifinet, IP_NULL, "ipmip6pm.interface.%s.inet.care_of_address", ife->ipmip6.iff.ifname))
|
||||
{
|
||||
Ipmip6_if_inet_t *ifaddr;
|
||||
|
||||
/* No address found; resolve from interface */
|
||||
ifaddr = IPCOM_LIST_FIRST(&ife->ipmip6.inet);
|
||||
|
||||
if (ifaddr)
|
||||
ife->ifinet = ifaddr->ifa_address;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Read the prefix list allowed for this interface */
|
||||
if (!ipmip_sysvar_inet6(&ip_in6addr_any, &ife->ifaddr.prefix, &ife->ifaddr.len, "ipmip6pm.interface.%s.care_of_address", ife->ipmip6.iff.ifname))
|
||||
{
|
||||
Ipmip6_if_inet6_t *ifaddr;
|
||||
|
||||
/* No address found; resolve from interface */
|
||||
for (ifaddr = IPCOM_LIST_FIRST(&ife->ipmip6.inet6); ifaddr != IP_NULL; ifaddr = IPCOM_LIST_NEXT(&ifaddr->ifa_next))
|
||||
{
|
||||
/* Only check UNIVERSE scope addresses; and addresses covered by a broadcasted prefix */
|
||||
if (ifaddr->ifa_scope == IP_RT_SCOPE_UNIVERSE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ifaddr)
|
||||
{
|
||||
ipcom_memcpy(&ife->ifaddr.prefix, &ifaddr->ifa_address.prefix, sizeof(ife->ifaddr.prefix));
|
||||
ife->ifaddr.len = ifaddr->ifa_address.len;
|
||||
}
|
||||
#ifdef IPMIP_USE_INET
|
||||
else if (ife->ifinet == 0)
|
||||
#else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to locate interface address for interface %s",
|
||||
ife->ipmip6.iff.ifname));
|
||||
return IP_FALSE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Always Try GRE first; if enabled */
|
||||
ife->GRE_Preferred = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.tunnel.gre.Preferred"), "ipmip6pm.interface.%s.tunnel.gre.Preferred", ife->ipmip6.iff.ifname);
|
||||
ife->GRE_UseKeys = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.tunnel.gre.UseKeys"), "ipmip6pm.interface.%s.tunnel.gre.UseKeys", ife->ipmip6.iff.ifname);
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
ife->UseIPv4UDPEncapForSignalingMessages = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.inet.UseIPv4UDPEncapForSignalingMessages"), "ipmip6pm.interface.%s.inet.UseIPv4UDPEncapForSignalingMessages", ife->ipmip6.iff.ifname);
|
||||
ife->ForceIPv4UDPEncapsulationSupport = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_FALSE, "ipmip6pm.inet.ForceIPv4UDPEncapsulationSupport"), "ipmip6pm.interface.%s.inet.ForceIPv4UDPEncapsulationSupport", ife->ipmip6.iff.ifname);
|
||||
ife->IPv4UDPEncapsulationNATTimeout = ipmip_sysvar_ulong(ipmip_sysvar_ulong(IPMIP6_NATKATIMEOUT, "ipmip6pm.inet.IPv4UDPEncapsulationNATTimeout"), "ipmip6pm.interface.%s.inet.IPv4UDPEncapsulationNATTimeout", ife->ipmip6.iff.ifname);
|
||||
#endif
|
||||
|
||||
/* GRE allowed? */
|
||||
if (!IP_IN6_IS_ADDR_UNSPECIFIED(&ife->ifaddr.prefix))
|
||||
{
|
||||
if ((ife->ifenabled[IPMIP_TUNNELTYPE_IP6IP6] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.tunnel.ip6ip6"), "ipmip6pm.interface.%s.tunnel.ip6ip6", ife->ipmip6.iff.ifname)))
|
||||
{
|
||||
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET6_IP6IP6;
|
||||
ife->iftunnels[IPMIP_TUNNELTYPE_IP6IP6] = ipmip6pm_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_IP6IP6, &ife->ifaddr.prefix, ife->ipmip6.iff.ifindex);
|
||||
}
|
||||
|
||||
if ((ife->ifenabled[IPMIP_TUNNELTYPE_GRE6] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.tunnel.gre"), "ipmip6pm.interface.%s.tunnel.gre", ife->ipmip6.iff.ifname)))
|
||||
{
|
||||
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET6_GRE6;
|
||||
ife->iftunnels[IPMIP_TUNNELTYPE_GRE6] = ipmip6pm_if_tunnel_create(ctx, proc, IPMIP_TUNNELTYPE_GRE6, &ife->ifaddr.prefix, ife->ipmip6.iff.ifindex);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
if (ife->ifinet != 0)
|
||||
{
|
||||
ife->ifenabled[IPMIP_TUNNELTYPE_GRE] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.inet.tunnel.gre"), "ipmip6pm.interface.%s.inet.tunnel.gre", ife->ipmip6.iff.ifname);
|
||||
if ((ife->ifenabled[IPMIP_TUNNELTYPE_IPIP] = ipmip_sysvar_bool(ipmip_sysvar_bool(IP_TRUE, "ipmip6pm.inet.tunnel.ipip"), "ipmip6pm.interface.%s.inet.tunnel.ipip", ife->ipmip6.iff.ifname)) || ife->ifenabled[IPMIP_TUNNELTYPE_GRE])
|
||||
{
|
||||
if (ife->ifenabled[IPMIP_TUNNELTYPE_IPIP])
|
||||
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET_IPIP;
|
||||
ife->iftunnels[IPMIP_TUNNELTYPE_IPIP] = ipmip6pm_if_tunnel_create_inet(ctx, proc, IPMIP_TUNNELTYPE_IPIP, &ife->ifaddr.prefix, ife->ifinet, ife->ipmip6.iff.ifindex);
|
||||
}
|
||||
|
||||
if (ife->ifenabled[IPMIP_TUNNELTYPE_GRE])
|
||||
{
|
||||
ife->supported_tunnel_types |= IPMIP_TUNNELMASK_INET_GRE;
|
||||
ife->iftunnels[IPMIP_TUNNELTYPE_GRE] = ipmip6pm_if_tunnel_create_inet(ctx, proc, IPMIP_TUNNELTYPE_GRE, &ife->ifaddr.prefix, ife->ifinet, ife->ipmip6.iff.ifindex);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ipmip6pm_node_context_init(ctx, proc, ife);
|
||||
|
||||
for (i = 0; i < IPMIP6PM_FUNCTION_MAX; i++)
|
||||
{
|
||||
for (si = 0; si < ctx->extensions[i].num; si++)
|
||||
{
|
||||
if (ctx->extensions[i].functions[si]->config_ifp != IP_NULL)
|
||||
{
|
||||
if (ctx->extensions[i].functions[si]->ifp_data_size)
|
||||
{
|
||||
ife->extdata[i][si] = ipcom_calloc(1, ctx->extensions[i].functions[si]->ifp_data_size);
|
||||
(*ctx->extensions[i].functions[si]->config_ifp) (ctx, proc, IPMIP_CALLBACK_CONFIG_READ, ife, ctx->extdata[i][si], ife->extdata[i][si], IP_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ipmip6pm_lma_configure(ctx, proc, ife);
|
||||
return IP_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_if_create
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_if_create(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_notify_t *notify)
|
||||
{
|
||||
Ipmip_timer_lock_t *lock;
|
||||
|
||||
/* Attach to the IFP */
|
||||
ipmip6_if_attach(&ctx->ipmip6,
|
||||
proc,
|
||||
sizeof(struct Ipmip6pm_if),
|
||||
notify,
|
||||
(Ipmip_if_cleanup_t)ipmip6pm_if_cleanup);
|
||||
|
||||
lock = notify->ifp->iff_lock;
|
||||
|
||||
/**/
|
||||
if (notify->ifp->iff_down == IP_TRUE ||
|
||||
!ipmip6pm_if_setup(ctx, proc, (Ipmip6pm_if_t*)notify->ifp))
|
||||
{
|
||||
ipmip6_if_detach_iflocked(&ctx->ipmip6, proc, notify);
|
||||
notify->ifp = IP_NULL;
|
||||
}
|
||||
|
||||
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
|
||||
return notify->ifp != IP_NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_if_event_handler
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC int
|
||||
ipmip6pm_if_event_handler(int event,
|
||||
Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
void *ifn,
|
||||
void *unused)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(unused);
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ifn);
|
||||
IPMIP_UNUSED_PARAMETER(unused);
|
||||
|
||||
|
||||
/* Event on this particular interface */
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
}
|
||||
|
||||
return IPMIP_TIMER_RET_DONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_if_unconfigure
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_if_unconfigure(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
Ipmip6pm_if_notify_t *notify;
|
||||
|
||||
/* Clear any old interfaces */
|
||||
while ((notify = IPCOM_LIST_FIRST(&ctx->ifs)) != IP_NULL)
|
||||
{
|
||||
Ipmip_timer_lock_t *lock;
|
||||
|
||||
lock = ipmip_timer_lock_acquire(&ctx->ipmip6.ipmip, proc, notify->ipmip6.ifp->iff_lock);
|
||||
ipmip6_if_detach_iflocked(&ctx->ipmip6, proc, ¬ify->ipmip6);
|
||||
ipmip_timer_lock_release(&ctx->ipmip6.ipmip, proc, lock);
|
||||
|
||||
ipcom_list_remove(¬ify->next);
|
||||
ipcom_free(notify);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_route_tunnel_create
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_if_configure(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
Ip_u8 *dptr, *ptr;
|
||||
|
||||
ipmip6pm_if_unconfigure(ctx, proc);
|
||||
|
||||
/* Find all interfaces */
|
||||
dptr = ipmip_sysvar_strlist("ipmip6pm.interfaces");
|
||||
if (dptr == IP_NULL || *dptr == '0')
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Invalid/missing \"ipmip6pm.interfaces\" in configuration"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ptr = dptr + 1;
|
||||
while (*ptr != 0)
|
||||
{
|
||||
Ipmip6pm_if_notify_t *notify = ipcom_calloc(1, sizeof(*notify));
|
||||
|
||||
ipcom_strcpy(notify->ipmip6.ifname, (char *)(ptr + 1));
|
||||
|
||||
notify->ipmip6.opaque = notify;
|
||||
notify->ipmip6.func = (Ipmip_timer_func_t)ipmip6pm_if_event_handler;
|
||||
notify->ipmip6.lock = ctx->ifs_lock;
|
||||
|
||||
if (!ipmip6pm_if_create(ctx, proc, ¬ify->ipmip6))
|
||||
{
|
||||
/* Just log for notifications sake */
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"Unable to create/configure interface %s - bad configuration or interface is down/does not exist", (char *)(ptr + 1)));
|
||||
ipcom_free(notify);
|
||||
}
|
||||
else
|
||||
{
|
||||
/**/
|
||||
ipcom_list_insert_last(&ctx->ifs, ¬ify->next);
|
||||
}
|
||||
|
||||
/* Go to next item */
|
||||
ptr += *ptr;
|
||||
}
|
||||
|
||||
fail:
|
||||
if (dptr)
|
||||
ipcom_free(dptr);
|
||||
}
|
||||
|
||||
IP_GLOBAL Ipmip6pm_if_t *
|
||||
ipmip6pm_if_findbyifindex(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ip_u32 ifindex)
|
||||
{
|
||||
Ipmip6pm_if_notify_t *notify;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(¬ify->next))
|
||||
{
|
||||
Ipmip6pm_if_t *ifp = (Ipmip6pm_if_t *)notify->ipmip6.ifp;
|
||||
if (ifp->ipmip6.iff.ifindex == ifindex)
|
||||
return ifp;
|
||||
}
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
IP_GLOBAL Ipmip6pm_if_t *
|
||||
ipmip6pm_if_findbyifname(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
const char *ifname)
|
||||
{
|
||||
Ipmip6pm_if_notify_t *notify;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(¬ify->next))
|
||||
{
|
||||
Ipmip6pm_if_t *ifp = (Ipmip6pm_if_t *)notify->ipmip6.ifp;
|
||||
if (ipcom_strcasecmp(ifp->ipmip6.iff.ifname, ifname) == 0)
|
||||
return ifp;
|
||||
}
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
IP_GLOBAL Ipmip6pm_if_t *
|
||||
ipmip6pm_if_findbyinet6(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ip_in6_addr *addr)
|
||||
{
|
||||
Ipmip6pm_if_notify_t *notify;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
for (notify = IPCOM_LIST_FIRST(&ctx->ifs); notify != IP_NULL; notify = IPCOM_LIST_NEXT(¬ify->next))
|
||||
{
|
||||
Ipmip6pm_if_t *ifp = (Ipmip6pm_if_t *)notify->ipmip6.ifp;
|
||||
|
||||
if (IP_IN6_ARE_ADDR_EQUAL(&ifp->ifaddr.prefix, addr))
|
||||
return ifp;
|
||||
}
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
IP_GLOBAL Ipmip6pm_if_t *
|
||||
ipmip6pm_if_findbypktinfo(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip_pktbuf_pktinfo *dst)
|
||||
{
|
||||
Ipmip6pm_if_t *ifp;
|
||||
|
||||
if ((ifp = ipmip6pm_if_findbyifindex(ctx, proc, dst->ifindex)) == IP_NULL)
|
||||
ifp = ipmip6pm_if_findbyinet6(ctx, proc, &dst->dst.sin6.sin6_addr);
|
||||
|
||||
return ifp;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,149 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_if.h,v $ $Revision: 1.12 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_if.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_IF_H
|
||||
#define IPMIP6PM_IF_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmip6pm_node;
|
||||
struct Ipmip_pktbuf_pktinfo;
|
||||
struct Ipmip_cli_message;
|
||||
struct Ipmip6pm_if;
|
||||
|
||||
typedef struct Ipmip6pm_if_notify
|
||||
{
|
||||
Ipcom_list next;
|
||||
Ipmip6_if_notify_t ipmip6;
|
||||
} Ipmip6pm_if_notify_t;
|
||||
|
||||
typedef struct Ipmip6pm_if_priv_notify
|
||||
{
|
||||
char handoff[IP_IFNAMSIZ+1];
|
||||
Ipmip6_if_notify_t ipmip6;
|
||||
} Ipmip6pm_if_priv_notify_t;
|
||||
|
||||
typedef struct Ipmip6pm_if
|
||||
{
|
||||
Ipmip6_if_t ipmip6;
|
||||
|
||||
/* Home agent specific configuration */
|
||||
Ipmip6_address_t ifaddr;
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
Ip_u32 ifinet;
|
||||
#endif
|
||||
/**/
|
||||
Ip_bool ifenabled[IPMIP_TUNNELTYPE_MAX + 1];
|
||||
struct Ipmip6pm_if *iftunnels[IPMIP_TUNNELTYPE_MAX + 1];
|
||||
|
||||
Ip_u16 lifetime;
|
||||
Ip_u32 InitialBindackTimeoutFirstReg; /* Initial timeout */
|
||||
Ip_bool TimestampBasedApproachInUse;
|
||||
|
||||
Ip_u32 BRIMaxRetriesNumber;
|
||||
Ip_u32 MINDelayBRIs;
|
||||
Ip_u32 HeartBeatInterval;
|
||||
Ip_u32 HeartBeatMissAllowed;
|
||||
Ip_bool HeartBeatEnabled;
|
||||
Ip_bool GRE_Preferred;
|
||||
Ip_bool GRE_UseKeys;
|
||||
|
||||
Ip_u8 supported_tunnel_types;
|
||||
#ifdef IPMIP_USE_INET
|
||||
Ip_bool UseIPv4UDPEncapForSignalingMessages;
|
||||
Ip_bool ForceIPv4UDPEncapsulationSupport;
|
||||
Ip_u32 IPv4UDPEncapsulationNATTimeout;
|
||||
#endif
|
||||
|
||||
|
||||
Ipcom_hash *lma_table;
|
||||
Ipcom_hash *node_name;
|
||||
|
||||
/* Opaque service data */
|
||||
void *extdata[IPMIP6PM_FUNCTION_MAX][32];
|
||||
} Ipmip6pm_if_t;
|
||||
|
||||
typedef struct Ipmip6pm_if_priv
|
||||
{
|
||||
Ipmip6_if_t ipmip6;
|
||||
} Ipmip6pm_if_priv_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6pm_if_configure(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc);
|
||||
IP_GLOBAL void ipmip6pm_if_unconfigure(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc);
|
||||
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbypktinfo(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip_pktbuf_pktinfo *dst);
|
||||
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbyifindex(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ip_u32 ifindex);
|
||||
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbyinet6(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ip_in6_addr *addr);
|
||||
IP_GLOBAL Ipmip6pm_if_t *ipmip6pm_if_findbyifname(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
const char *ifname);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,225 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_ifevent.c,v $ $Revision: 1.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_ifevent.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_shell.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_icmp_pkt.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_STATIC void ipmip6pm_ifevent_router_new(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_router_t *router);
|
||||
IP_STATIC void ipmip6pm_ifevent_router_expire(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_router_t *router);
|
||||
IP_STATIC void ipmip6pm_ifevent_prefix_new(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix);
|
||||
IP_STATIC void ipmip6pm_ifevent_prefix_expire(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix);
|
||||
IP_STATIC void ipmip6pm_ifevent_prefix_advertise(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix);
|
||||
IP_STATIC void ipmip6pm_ifevent_prefix_update(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
Ipmip6_if_event_table_t ipmip6pm_ifevent_table =
|
||||
{
|
||||
(Ipmip6_if_event_t)IP_NULL,
|
||||
(Ipmip6_if_event_t)IP_NULL,
|
||||
(Ipmip6_if_event_t)ipmip6pm_ifevent_router_new,
|
||||
(Ipmip6_if_event_t)ipmip6pm_ifevent_router_expire,
|
||||
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_new,
|
||||
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_expire,
|
||||
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_advertise,
|
||||
(Ipmip6_if_event_t)ipmip6pm_ifevent_prefix_update
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmip6pm_ifevent_router_new(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_router_t *router)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
IPMIP_UNUSED_PARAMETER(router);
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_ifevent_router_expire(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_router_t *router)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
IPMIP_UNUSED_PARAMETER(router);
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_ifevent_prefix_new(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(prefix);
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_ifevent_prefix_expire(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
IPMIP_UNUSED_PARAMETER(prefix);
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_ifevent_prefix_advertise(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
IPMIP_UNUSED_PARAMETER(prefix);
|
||||
/* ipmip6m_coa_advertise_prefix(prefix); */
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_ifevent_prefix_update(Ipmip6_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6_if_t *ife,
|
||||
Ipmip6_if_prefix_t *prefix)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(ife);
|
||||
IPMIP_UNUSED_PARAMETER(prefix);
|
||||
/* ipmip6pm_coa_update_validity(prefix); */
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,69 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_ifevent.h,v $ $Revision: 1.2 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_ifevent.h,v $
|
||||
* $Author: jhorteli $ $Date: 2008-09-16 08:19:45 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_IFEVENT_H
|
||||
#define IPMIP6PM_IFEVENT_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
extern Ipmip6_if_event_table_t ipmip6pm_ifevent_table;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,159 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_lma.h,v $ $Revision: 1.4 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_lma.h,v $
|
||||
* $Author: jhorteli $ $Date: 2010-02-15 13:26:01 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_LMA_H
|
||||
#define IPMIP6PM_LMA_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6PM_LMA_CREATE (1 << 0)
|
||||
#define IPMIP6PM_LMA_PERMANENT (1 << 1)
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmip6pm_if;
|
||||
struct Ipmip6pm_pktbuf;
|
||||
struct Ipmip_buffer;
|
||||
|
||||
typedef struct Ipmip6pm_lma
|
||||
{
|
||||
struct Ip_in6_addr endpoint;
|
||||
/**/
|
||||
Ip_u32 references;
|
||||
Ip_u32 sequence;
|
||||
Ip_u32 unacked;
|
||||
|
||||
Ip_u32 restart_counter;
|
||||
Ip_bool have_restart_counter;
|
||||
|
||||
Ip_bool permanent;
|
||||
Ip_bool disabled;
|
||||
|
||||
struct Ipmip6pm_if *ifp;
|
||||
Ipmip_timer_t timer;
|
||||
|
||||
Ipcom_list bri;
|
||||
|
||||
/* If we've got a NAT */
|
||||
Ip_u32 inet_endpoint;
|
||||
} Ipmip6pm_lma_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL Ipmip6pm_lma_t *ipmip6pm_lma_get(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
struct Ip_in6_addr *endpoint,
|
||||
Ip_u32 inet_endpoint,
|
||||
unsigned flags);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_release(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_lma_t *mag);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_reference(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_lma_t *lma);
|
||||
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_configure(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_unconfigure(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_configure_dump(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ife,
|
||||
struct Ipmip_buffer *buffer);
|
||||
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_lma_heartbeat_input(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
IP_GLOBAL Ip_bool ipmip6pm_lma_heartbeat_binding_error_input(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_route_mh(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
struct Ip_in6_addr *endpoint,
|
||||
Ip_u32 inet_address);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_route(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_lma *lma);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_route_pbuf(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_attr_get(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ife,
|
||||
struct Ipmip_buffer *buffer);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_lma_revoke(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_lma_t *lma,
|
||||
Ip_u8 reason);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,524 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_main.c,v $ $Revision: 1.7.16.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_main.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipmip6pm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <ipcom_type.h>
|
||||
#include <ipcom_cstyle.h>
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock6.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_syslog.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_dhcp.h>
|
||||
#include <private/ipmip_dhcp6.h>
|
||||
#include <private/ipmip_inet.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_pkt.h>
|
||||
#include <private/ipmip6_if.h>
|
||||
#include <private/ipmip6_mh.h>
|
||||
#include <private/ipmip6_mh_pkt.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6pm.h"
|
||||
#include "ipmip6pm_h.h"
|
||||
#include "ipmip6pm_node.h"
|
||||
#include "ipmip6pm_attr_h.h"
|
||||
#include "ipmip6pm_ifevent.h"
|
||||
#include "ipmip6pm_mh.h"
|
||||
#include "ipmip6pm_icmp.h"
|
||||
#include "ipmip6pm_if.h"
|
||||
#include "ipmip6pm_route.h"
|
||||
#include "ipmip6pm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6pm_exit(void);
|
||||
IP_PUBLIC Ip_err ipmip6pm_init(void);
|
||||
IP_PUBLIC Ip_err ipmip6pm_start(void);
|
||||
IP_PUBLIC const char *ipmip6pm_version(void);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
static int ipmip6pm_instances = 0;
|
||||
|
||||
/* Dispatch function callbacks */
|
||||
static Ipmip6_pkt_context_dispatch_t ipmip6pm_dispatch_table =
|
||||
{
|
||||
(Ipmip6_pkt_dispatch_t)ipmip6pm_mh_dispatch,
|
||||
(Ipmip6_pkt_dispatch_t)IP_NULL
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_services_clear(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
unsigned si, f;
|
||||
|
||||
for (f = 0; f < IPMIP6PM_FUNCTION_MAX; f++)
|
||||
{
|
||||
for (si = 0; si < ctx->extensions[f].num; si++)
|
||||
{
|
||||
if (ctx->extensions[f].functions[si]->config_global != IP_NULL && ctx->extdata[f][si])
|
||||
{
|
||||
(*ctx->extensions[f].functions[si]->config_global) (ctx, proc, IPMIP_CALLBACK_CONFIG_FREE, ctx->extdata[f][si], IP_NULL);
|
||||
ipcom_free(ctx->extdata[f][si]);
|
||||
ctx->extdata[f][si] = IP_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6pm_services_read(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
unsigned si, f;
|
||||
|
||||
for (f = 0; f < IPMIP6PM_FUNCTION_MAX; f++)
|
||||
{
|
||||
for (si = 0; si < ctx->extensions[f].num; si++)
|
||||
{
|
||||
if (ctx->extensions[f].functions[si]->config_global != IP_NULL && ctx->extensions[f].functions[si]->global_data_size)
|
||||
{
|
||||
ctx->extdata[f][si] = ipcom_calloc(1, ctx->extensions[f].functions[si]->global_data_size);;
|
||||
(*ctx->extensions[f].functions[si]->config_global) (ctx, proc, IPMIP_CALLBACK_CONFIG_READ, ctx->extdata[f][si], IP_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_config_init
|
||||
*===========================================================================
|
||||
* Description: Initialize the configuration for the specified instance
|
||||
* Parameters: instance - The PM instance
|
||||
* Returns: 0 on success
|
||||
*
|
||||
*/
|
||||
IP_STATIC int
|
||||
ipmip6pm_update_config(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
/* Stop the CLI context */
|
||||
ipmip_cli_context_stop(&ctx->ipmip6.ipmip, proc);
|
||||
/* Stop the packet context */
|
||||
ipmip6_pkt_context_stop(&ctx->ipmip6, proc);
|
||||
|
||||
/* Free all mobile nodes */
|
||||
ipmip6pm_node_clear(ctx, proc);
|
||||
|
||||
/* Stop the current context */
|
||||
ipmip6_context_stop(&ctx->ipmip6, proc);
|
||||
ipmip6pm_services_clear(ctx, proc);
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
ipmip_dhcp_context_destroy(&ctx->ipmip6.ipmip, proc);
|
||||
ipmip_inet_arp_context_destroy(&ctx->ipmip6.ipmip, proc);
|
||||
#endif
|
||||
ipmip_dhcp6_context_destroy(&ctx->ipmip6.ipmip, proc);
|
||||
|
||||
ipmip6_context_restart_counter_update(&ctx->ipmip6, proc);
|
||||
|
||||
ipmip6pm_services_read(ctx, proc);
|
||||
|
||||
|
||||
/* Read configuration */
|
||||
ipmip6pm_if_configure(ctx, proc);
|
||||
|
||||
/**/
|
||||
ipmip6_context_start(&ctx->ipmip6, proc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_destroy
|
||||
*===========================================================================
|
||||
* Description: Shutdown the mobile node portion of the context.
|
||||
* Parameters: ctx - The MIP6 context.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmip6pm_context_destroy(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
/* Only if we actually got a context. */
|
||||
if (ctx != IP_NULL)
|
||||
{
|
||||
/* Stop the packet context; for starters */
|
||||
ipmip6_pkt_context_stop(&ctx->ipmip6, proc);
|
||||
|
||||
/* Destroy the entries that has been removed */
|
||||
ipmip6pm_node_clear(ctx, proc);
|
||||
|
||||
/* Stop the rest */
|
||||
ipmip6_context_stop(&ctx->ipmip6, proc);
|
||||
|
||||
/* Remove configuration */
|
||||
ipmip6pm_if_unconfigure(ctx, proc);
|
||||
ipmip6pm_services_clear(ctx, proc);
|
||||
|
||||
/* Close the IPD */
|
||||
if (ctx->fd_ipd == IP_INVALID_SOCKET)
|
||||
(void)ipcom_ipd_init("ipmip6pm", IPCOM_ERR_FAILED, &ctx->fd_ipd);
|
||||
|
||||
/**/
|
||||
ipcom_ipd_exit("ipmip6pm", ctx->fd_ipd);
|
||||
|
||||
/**/
|
||||
ipmip_timer_lock_destroy(&ctx->ipmip6.ipmip, proc, ctx->ifs_lock);
|
||||
|
||||
/* Free the lock */
|
||||
ipmip6pm_route_context_destroy(ctx, proc);
|
||||
|
||||
ipmip_context_id_destroy(ctx->idents);
|
||||
ipmip_context_id_destroy(ctx->bri);
|
||||
|
||||
/* Shutdown the 'mip6' context */
|
||||
ipmip6_context_destroy(&ctx->ipmip6, proc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_context_allocate
|
||||
*===========================================================================
|
||||
* Description: Initialize the proxy mobile node portion of the context.
|
||||
* Parameters: ctx - The MIP6 context.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ipmip6pm_context_t *
|
||||
ipmip6pm_context_allocate(Ipmip_proc_t *proc)
|
||||
{
|
||||
Ipmip6pm_context_t *ctx = (Ipmip6pm_context_t *)ipmip_context_alloc(proc, sizeof(*ctx), "ipmip6pm", IPMIP6_SYSTEM_PRIORITY, IPMIP6PM_EVENT_BACKLOG);
|
||||
int f;
|
||||
|
||||
/* */
|
||||
if (ctx == IP_NULL)
|
||||
return IP_NULL;
|
||||
|
||||
/* Initialize */
|
||||
ipmip6pm_route_context_init(ctx, proc);
|
||||
|
||||
/**/
|
||||
ipcom_atomic_set(&ctx->sequence, ipcom_random());
|
||||
|
||||
ipcom_list_init(&ctx->ifs);
|
||||
|
||||
ctx->ifs_lock = ipmip_timer_lock_alloc(&ctx->ipmip6.ipmip, proc, IP_NULL, IP_NULL);
|
||||
ctx->idents = ipmip_context_id_create(ip_offsetof(Ipmip6pm_node_t, identity), 0xFFFFFFFF);
|
||||
ctx->bri = ipmip_context_id_create(ip_offsetof(Ipmip6pm_br_t, sequence), 0x0000FFFF);
|
||||
|
||||
/* Initialize the global information */
|
||||
if (ipmip6_context_initialize(&ctx->ipmip6,
|
||||
proc,
|
||||
&ipmip6pm_ifevent_table) == IP_FALSE)
|
||||
goto failure;
|
||||
|
||||
/* Server side; don't do solicitations */
|
||||
ctx->ipmip6.iff.no_solicitation = IP_TRUE;
|
||||
|
||||
if (ipmip6_pkt_context_create(&ctx->ipmip6,
|
||||
proc,
|
||||
&ipmip6pm_dispatch_table,
|
||||
IPMIP6_DSMIP_UDP_PORT,
|
||||
(Ipmip_pkt_buf_alloc_t)ipmip6pm_pktbuf_alloc,
|
||||
(Ipmip_pkt_buf_free_t)ipmip6pm_pktbuf_free) == IP_FALSE)
|
||||
{
|
||||
IPCOM_LOG0(ERR, "Unable to create IPMIP6PM Packet Context");
|
||||
goto failure;
|
||||
}
|
||||
|
||||
ipmip_cli_context_create(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"ipmip6pm",
|
||||
IPCOM_IPD_ID_IPMIP6PM,
|
||||
(Ipmip_cli_callback_t)ipmip6pm_attr_command);
|
||||
|
||||
/* IPD init */
|
||||
if (ipcom_ipd_init("ipmip6pm", IPCOM_SUCCESS, &ctx->fd_ipd) != IPCOM_SUCCESS)
|
||||
{
|
||||
IPCOM_LOG1(ERR, "Unable to create IPMIP6PM IPD pipe = %d", ipcom_errno);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/* Indicate the elements */
|
||||
for (f = 0; f < IPMIP6PM_FUNCTION_MAX; f++)
|
||||
ctx->extensions[f].elem = f;
|
||||
|
||||
/* Do service init */
|
||||
for (f = 0; ipmip6pm_service_registrations[f] != IP_NULL; f++)
|
||||
(*ipmip6pm_service_registrations[f]) (ctx);
|
||||
|
||||
for (f = 0; ipmip6pm_link_registrations[f] != IP_NULL; f++)
|
||||
(*ipmip6pm_link_registrations[f]) (ctx);
|
||||
|
||||
/* Install transport */
|
||||
ipmip6pm_node_service_install(ctx);
|
||||
|
||||
/* Update configuration */
|
||||
ipmip6pm_update_config(ctx, proc);
|
||||
|
||||
/* Return the mobile node instance */
|
||||
return ctx;
|
||||
|
||||
failure:
|
||||
ipmip6pm_context_destroy(ctx, proc);
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_ipd_process
|
||||
*===========================================================================
|
||||
* Description: Process any file descriptors set by the platform.
|
||||
* Parameters: data - The data structure
|
||||
* rset - The read set.
|
||||
* Returns: IP_FALSE if we should exit the process.
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6pm_ipd_process(Ipmip6pm_context_t *ctx,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
/* IPD input. */
|
||||
int event;
|
||||
Ip_ssize_t len;
|
||||
Ipmip6pm_pktbuf_t *pbuf = (Ipmip6pm_pktbuf_t *)ipmip_pktbuf_alloc(&ctx->ipmip6.ipmip, proc, 512);
|
||||
|
||||
if (pbuf == IP_NULL)
|
||||
return IP_TRUE;
|
||||
|
||||
len = ipcom_ipd_read(ctx->fd_ipd, IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet), 512, &event);
|
||||
if (len < 0)
|
||||
{
|
||||
IPCOM_LOG2(ERR, "ipcom_socketread(IPD) failed : %s [%d]",
|
||||
ipcom_strerror(ipcom_errno), ipcom_errno);
|
||||
ipmip_util_sock_clear(ctx->fd_ipd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Advance past */
|
||||
ipmip_buffer_append(&pbuf->ipmip6.ipmip.packet, IP_NULL, len);
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case IPCOM_IPD_EVENT_RECONFIGURE:
|
||||
IPCOM_LOG0(INFO, "Received IPD reconfigure message");
|
||||
ipmip6pm_update_config(ctx, proc);
|
||||
break;
|
||||
|
||||
case IPCOM_IPD_EVENT_KILL:
|
||||
IPCOM_LOG0(INFO, "Received IPD kill message");
|
||||
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
||||
return IP_FALSE;
|
||||
|
||||
default:
|
||||
/* Ignore all other IPD messages */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
||||
return IP_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmip6pm_main(void)
|
||||
{
|
||||
int num;
|
||||
int max_fd;
|
||||
Ipmip6pm_context_t *ctx = IP_NULL;
|
||||
Ipmip_proc_t *proc;
|
||||
|
||||
ipcom_proc_init();
|
||||
|
||||
proc = ipmip_proc_alloc();
|
||||
|
||||
IPCOM_LOG0(INFO,
|
||||
"ipmip6pm: starting");
|
||||
|
||||
/* Init the configuration */
|
||||
if (ipmip6pm_configure() != IPCOM_SUCCESS)
|
||||
goto done;
|
||||
|
||||
/* Init IPMIP6MN */
|
||||
if ((ctx = ipmip6pm_context_allocate(proc)) == IP_NULL)
|
||||
goto done;
|
||||
|
||||
if (ipmip6pm_instances++ == 0)
|
||||
if (ipmip6pm_init() != IPCOM_SUCCESS)
|
||||
goto end;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
Ip_fd_set read_set;
|
||||
|
||||
IP_FD_ZERO(&read_set);
|
||||
|
||||
/* Set the IPD */
|
||||
max_fd = ctx->fd_ipd;
|
||||
IP_FD_SET(ctx->fd_ipd, &read_set);
|
||||
|
||||
/* Select */
|
||||
num = ipcom_socketselect(max_fd + 1, &read_set, IP_NULL, IP_NULL, IP_NULL);
|
||||
|
||||
switch(num)
|
||||
{
|
||||
case -1: /* socket error. */
|
||||
IPCOM_LOG2(WARNING, "ipcom_socketselect() failed : %s [%d]", ipcom_strerror(ipcom_errno), ipcom_errno);
|
||||
(void)ipcom_sleep(1);
|
||||
break;
|
||||
|
||||
case 0: /* timeout, not used. triggered by bug in linux glibc if compiled with nptl */
|
||||
(void)ipcom_millisleep(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Process IPD */
|
||||
if (IP_FD_ISSET(ctx->fd_ipd, &read_set))
|
||||
{
|
||||
if (ipmip6pm_ipd_process(ctx, proc) == IP_FALSE)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
ipmip6pm_context_destroy(ctx, proc);
|
||||
|
||||
/**/
|
||||
if (--ipmip6pm_instances == 0)
|
||||
ipmip6pm_exit();
|
||||
|
||||
|
||||
done:
|
||||
/* Free the context process */
|
||||
ipmip_proc_destroy(proc);
|
||||
|
||||
IPCOM_LOG0(NOTICE,
|
||||
"ipmip6pm: ending");
|
||||
ipcom_proc_exit();
|
||||
}
|
||||
|
||||
IP_STATIC Ip_u32
|
||||
ipmip6pm_context_register_function(Ipmip6pm_context_t *ctx,
|
||||
Ipmip6pm_extension_t *srv,
|
||||
Ipmip6pm_function_context_t *func)
|
||||
{
|
||||
Ip_u32 type = func->num++;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
|
||||
srv->unique = type;
|
||||
srv->unique |= func->elem << 16;
|
||||
func->mask |= (1 << type);
|
||||
func->functions[type] = srv;
|
||||
func->node_data += srv->node_data_size;
|
||||
|
||||
return srv->unique;
|
||||
}
|
||||
|
||||
IP_GLOBAL Ip_u32
|
||||
ipmip6pm_context_register_extension(Ipmip6pm_context_t *ctx,
|
||||
Ipmip6pm_extension_t *srv,
|
||||
Ip_u32 type)
|
||||
{
|
||||
return ipmip6pm_context_register_function(ctx, srv, &ctx->extensions[type]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_mh.h,v $ $Revision: 1.7 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_mh.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-06-18 12:53:20 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_MH_H
|
||||
#define IPMIP6PM_MH_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmip6pm_pktbuf;
|
||||
struct Ipmip6pm_node;
|
||||
struct Ipmip6pm_br;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_mh_ha_send_binding_update(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node,
|
||||
Ip_bool retransmit,
|
||||
Ip_bool request_ack);
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_mh_ha_bra_send(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_pktbuf *pbuf,
|
||||
Ip_u8 status);
|
||||
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_mh_dispatch(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_mh_bri_send(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_br *br);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,412 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_node.h,v $ $Revision: 1.21 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_node.h,v $
|
||||
* $Author: jhorteli $ $Date: 2010-10-15 11:30:08 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6PM_NODE_H
|
||||
#define IPMIP6PM_NODE_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmip6_nd_proxy.h>
|
||||
#include <private/ipmip6_nd_nud.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
#include <ipmip6pm_if.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPMIP6PM_NODE_FLAG_NAI (1 << 0)
|
||||
#define IPMIP6PM_NODE_FLAG_TERMINATE (1 << 1)
|
||||
#define IPMIP6PM_NODE_FLAG_BU (1 << 2)
|
||||
#define IPMIP6PM_NODE_FLAG_DEREGISTER (1 << 3)
|
||||
#define IPMIP6PM_NODE_FLAG_UDP_DISABLED (1 << 4)
|
||||
#define IPMIP6PM_NODE_FLAG_INET6_PREFIX_0 (1 << 5)
|
||||
#define IPMIP6PM_NODE_FLAG_INET_PREFIX_0 (1 << 6)
|
||||
#define IPMIP6PM_NODE_FLAG_GRE_DOWNLINK (1 << 7)
|
||||
#define IPMIP6PM_NODE_FLAG_GRE_UPLINK (1 << 8)
|
||||
|
||||
#define IPMIP6PM_NODE_FLAG_GRE_LINK (IPMIP6PM_NODE_FLAG_GRE_DOWNLINK|IPMIP6PM_NODE_FLAG_GRE_UPLINK)
|
||||
|
||||
|
||||
#ifdef IPMIP_USE_INET
|
||||
#define IPMIP6PM_NODE_HOMEAGENT_INET(n) ((n)->homeagent_inet)
|
||||
#else
|
||||
#define IPMIP6PM_NODE_HOMEAGENT_INET(n) 0
|
||||
#endif
|
||||
|
||||
#define IPMIP6PM_NODE_USE_GRE_KEYS(n) (IPMIP_TUNNELTYPE_IS_GRE((n)->transport_tunnel_type) && (((n)->flags & (IPMIP6PM_NODE_FLAG_GRE_LINK)) == IPMIP6PM_NODE_FLAG_GRE_LINK))
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmip6pm_if;
|
||||
struct Ipmip6pm_pktbuf;
|
||||
struct Ipmip6pm_lma;
|
||||
struct Ipmip_attr_header;
|
||||
struct Ipmip_attr;
|
||||
struct Ipmip6pm_br;
|
||||
|
||||
typedef int (*Ipmip6pm_bri_done_t) (struct Ipmip6pm_context *ctx, struct Ipmip_proc *proc, struct Ipmip6pm_node *node, struct Ipmip6pm_br *bri, Ip_bool timeout, Ip_u8 status);
|
||||
|
||||
typedef struct Ipmip6pm_br
|
||||
{
|
||||
Ipcom_list next;
|
||||
|
||||
Ip_u32 sequence;
|
||||
|
||||
Ip_u8 xmits;
|
||||
Ip_u8 reason;
|
||||
Ip_u8 state;
|
||||
Ip_u16 flags;
|
||||
|
||||
Ip_bool inet;
|
||||
Ip_bool add_coa;
|
||||
Ip_size_t match_len;
|
||||
|
||||
Ipmip_timer_t retransmit;
|
||||
Ipmip_timer_func_t reply;
|
||||
|
||||
void *opaque;
|
||||
Ipmip_timer_lock_t *lock;
|
||||
struct Ipmip6pm_lma *lma;
|
||||
Ipmip6pm_bri_done_t completion;
|
||||
|
||||
/**/
|
||||
} Ipmip6pm_br_t;
|
||||
|
||||
typedef struct Ipmip6pm_node_service
|
||||
{
|
||||
struct Ipmip6pm_node_service *next;
|
||||
char *value;
|
||||
char *module;
|
||||
} Ipmip6pm_node_service_t;
|
||||
|
||||
typedef struct Ipmip6pm_node
|
||||
{
|
||||
struct Ipmip6pm_node *prev;
|
||||
struct Ipmip6pm_node *next;
|
||||
|
||||
/**/
|
||||
Ipmip_timer_lock_t *lock;
|
||||
Ipmip6_mh_mo_nai_t *mo_nai_mn;
|
||||
Ipmip6_mh_mo_pmipv6_access_technology_type_t *mo_access_type;
|
||||
Ipmip6_mh_mo_pmipv6_mn_link_layer_id_t *mo_link_layer_id;
|
||||
Ipmip6_mh_mo_pmipv6_handoff_indicator_t *mo_handoff_indicator;
|
||||
Ipmip6_mh_mo_pmipv6_home_prefix_t *mo_home_prefix;
|
||||
Ip_u8 mo_home_prefix_size;
|
||||
Ipmip6_mh_mo_pmipv6_timstamp_t mo_timestamp;
|
||||
|
||||
Ipmip_lladdr_t *lla;
|
||||
|
||||
struct Ipmip6pm_lma *lma;
|
||||
|
||||
Ipcom_list bri_list;
|
||||
|
||||
Ipmip6pm_if_priv_notify_t ifp_private;
|
||||
struct Ipmip6pm_if *ifp_public;
|
||||
Ipmip6_util_timediff_t time_diff;
|
||||
|
||||
struct Ip_in6_addr homeagent;
|
||||
#ifdef IPMIP_USE_INET
|
||||
Ip_u32 homeagent_inet;
|
||||
Ip_u32 homeagent_nat;
|
||||
Ipmip6_inet_t mo_dsmipv6_home_prefix;
|
||||
#endif
|
||||
|
||||
/**/
|
||||
Ipmip_timer_t expire;
|
||||
Ipmip_timer_t revoke;
|
||||
Ipmip_timer_t service;
|
||||
Ipmip_timer_retransmit_t binding_update;
|
||||
|
||||
Ip_u32 remaining;
|
||||
Ip_u8 termstate;
|
||||
Ip_u8 revokestate;
|
||||
Ip_u8 handoffstate;
|
||||
Ip_u8 servicestate;
|
||||
|
||||
Ip_u32 enabled[IPMIP6PM_FUNCTION_MAX];
|
||||
Ip_u32 supported[IPMIP6PM_FUNCTION_MAX];
|
||||
|
||||
Ip_time_t created;
|
||||
Ip_u32 status;
|
||||
|
||||
Ip_u32 route_state;
|
||||
|
||||
Ip_u32 gre_key[2];
|
||||
|
||||
Ip_u32 identity;
|
||||
Ip_u32 flags;
|
||||
|
||||
Ip_u16 sequence;
|
||||
Ip_u8 bristate;
|
||||
|
||||
Ip_u8 transport_tunnel_type;
|
||||
Ip_u8 supported_tunnel_types;
|
||||
|
||||
/* Statistics */
|
||||
struct Ipmip6_mib_mip6MnBLTable mip6MnBLTable;
|
||||
struct Ipmip6_mib_mip6MnRegnCounters mip6MnRegnCounters;
|
||||
struct Ipmip6_mib_mip6NodeTrafficEntry mip6NodeTrafficEntry;
|
||||
|
||||
void **extdata[IPMIP6PM_FUNCTION_MAX];
|
||||
} Ipmip6pm_node_t;
|
||||
|
||||
#define IPMIP6PM_NODE_LOOKUP_LLADDR (1 << 0)
|
||||
#define IPMIP6PM_NODE_LOOKUP_ACCESS_TYPE (1 << 1)
|
||||
#define IPMIP6PM_NODE_LOOKUP_SEQUENCE (1 << 2)
|
||||
#define IPMIP6PM_NODE_LOOKUP_IFNAME (1 << 3)
|
||||
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX (1 << 4)
|
||||
#define IPMIP6PM_NODE_LOOKUP_TIMESTAMP (1 << 5)
|
||||
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX_MO (1 << 6)
|
||||
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX_INET_MO (1 << 7)
|
||||
|
||||
typedef struct Ipmip6pm_node_lookup
|
||||
{
|
||||
void *nai_mn;
|
||||
Ip_size_t nai_mn_len;
|
||||
|
||||
/* Optional */
|
||||
Ip_u32 search_params;
|
||||
struct
|
||||
{
|
||||
/* Link Layer */
|
||||
void *lladdr;
|
||||
Ip_size_t lladdr_len;
|
||||
|
||||
/* Access Type */
|
||||
Ip_u8 access_type;
|
||||
|
||||
/* Sequence Number */
|
||||
Ip_u16 sequence;
|
||||
|
||||
/* Ifindex */
|
||||
const char *ifname;
|
||||
|
||||
/**/
|
||||
Ipmip6_address_t *home_prefix;
|
||||
Ip_u8 home_prefix_size;
|
||||
|
||||
/**/
|
||||
Ip_u64 *tstamp;
|
||||
|
||||
Ipmip6_mh_option_array_t *home_prefix_mo;
|
||||
#ifdef IPMIP_USE_INET
|
||||
Ipmip6_mh_option_array_t *home_prefix_inet_req_mo;
|
||||
#endif
|
||||
|
||||
} args;
|
||||
} Ipmip6pm_node_lookup_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
extern Ip_u32 ipmip6pm_node_transport_identity;
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_clear(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_context_init(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_context_destroy(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp);
|
||||
|
||||
IP_GLOBAL int ipmip6pm_node_terminate(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
const char *reason);
|
||||
IP_GLOBAL void ipmip6pm_node_silence(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node);
|
||||
|
||||
|
||||
IP_GLOBAL int ipmip6pm_node_handoff(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *head,
|
||||
Ip_u8 hi,
|
||||
struct Ipmip_attr **idattr);
|
||||
|
||||
IP_GLOBAL int ipmip6pm_node_create(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *head,
|
||||
Ip_u8 hi,
|
||||
struct Ipmip_attr_header *hdr,
|
||||
struct Ipmip_attr **idattr,
|
||||
Ip_u32 *identity);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_lookup(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6_mh_mo_nai_t *nai,
|
||||
Ipmip_timer_t *timer,
|
||||
Ipmip_timer_func_t func,
|
||||
void *arg);
|
||||
IP_GLOBAL void ipmip6pm_node_lookup_handle(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ip_u32 handle,
|
||||
Ipmip_timer_t *timer,
|
||||
Ipmip_timer_func_t func,
|
||||
void *arg);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_search(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_if *ifp,
|
||||
Ipmip6pm_node_lookup_t *nargs,
|
||||
Ipmip_timer_t *timer,
|
||||
Ipmip_timer_func_t func,
|
||||
void *arg);
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_compare(Ipmip6pm_node_t *node,
|
||||
Ipmip6pm_node_lookup_t *nargs);
|
||||
|
||||
IP_GLOBAL const char *ipmip6pm_node_describe(struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node);
|
||||
|
||||
IP_GLOBAL int ipmip6pm_node_timeout(int event,
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
const char *reason);
|
||||
IP_GLOBAL int ipmip6pm_node_registration_timeout(int event,
|
||||
struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
const char *reason);
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_disable(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node);
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_enable(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node);
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_enable_function(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
int func,
|
||||
Ip_u32 mask);
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_disable_function(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
int func,
|
||||
Ip_u32 mask);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_disable_transport(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node);
|
||||
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_service_reply_validate(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_service_reply_accept(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_update_link(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node);
|
||||
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_service_install(struct Ipmip6pm_context *ctx);
|
||||
|
||||
|
||||
/**/
|
||||
IP_GLOBAL int ipmip6pm_node_process_revoke(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node,
|
||||
struct Ipmip6pm_pktbuf *pbuf);
|
||||
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_bri_free(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
Ipmip6pm_br_t *bri);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_bri_cancel(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
Ipmip6pm_bri_done_t completion);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_node_bri_cancel_lma(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
Ipmip6pm_bri_done_t completion,
|
||||
struct Ipmip6pm_lma *lma);
|
||||
|
||||
|
||||
IP_GLOBAL int ipmip6pm_node_bri_accept(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
Ipmip6pm_br_t *bri,
|
||||
Ip_bool timeout,
|
||||
Ip_u8 status);
|
||||
|
||||
IP_GLOBAL int ipmip6pm_node_revoke(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node,
|
||||
Ip_bool inet,
|
||||
Ip_u8 reason,
|
||||
Ipmip6pm_bri_done_t completion);
|
||||
|
||||
|
||||
IP_GLOBAL Ip_bool ipmip6pm_node_if_link_ready(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6pm_node_t *node);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,139 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_route.h,v $ $Revision: 1.11 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_route.h,v $
|
||||
* $Author: jhorteli $ $Date: 2010-10-15 11:30:08 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6HA_ROUTE_H
|
||||
#define IPMIP6HA_ROUTE_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV6 = 0,
|
||||
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV4,
|
||||
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV6,
|
||||
IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV4,
|
||||
IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV6,
|
||||
IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV4,
|
||||
IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV6,
|
||||
IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV4,
|
||||
IPMIP6PM_ROUTE_BIT_MAX
|
||||
};
|
||||
|
||||
|
||||
#define IPMIP6PM_ROUTE_STATE_BIT(x) (1 << (x))
|
||||
#define IPMIP6PM_ROUTE_STATE_CHECK(s,i) ((s) & IPMIP6PM_ROUTE_STATE_BIT(i))
|
||||
#define IPMIP6PM_ROUTE_STATE_ALL 0xFFFFFFFF
|
||||
|
||||
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV6_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV6)
|
||||
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV6_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV6)
|
||||
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV6_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV6_USING_IPV4)
|
||||
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV6_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV6_USING_IPV4)
|
||||
|
||||
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV4_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV6)
|
||||
#define IPMIP6PM_ROUTE_STATE_FORWARD_IPV4_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_FORWARD_IPV4_USING_IPV4)
|
||||
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV4_USING_IPV6 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV6)
|
||||
#define IPMIP6PM_ROUTE_STATE_TRANSPORT_IPV4_USING_IPV4 IPMIP6PM_ROUTE_STATE_BIT(IPMIP6PM_ROUTE_BIT_TRANSPORT_IPV4_USING_IPV4)
|
||||
|
||||
|
||||
#define IPMIP6PM_ROUTE_STATE_TRANSPORT IPMIP6PM_ROUTE_STATE_ALL
|
||||
|
||||
#define IPMIP6PM_ROUTE_PRIORITY_BU 97
|
||||
#define IPMIP6PM_ROUTE_PRIORITY_FORWARD 98
|
||||
#define IPMIP6PM_ROUTE_PRIORITY_TUNNEL 99
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6pm_context;
|
||||
struct Ipmip_proc;
|
||||
struct Ipmip6pm_node;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_GLOBAL void ipmip6pm_route_state_del(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node,
|
||||
Ip_u32 states);
|
||||
IP_GLOBAL void ipmip6pm_route_state_add(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node,
|
||||
Ip_u32 states);
|
||||
|
||||
|
||||
IP_GLOBAL void ipmip6pm_route_add_outbound(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip6pm_node *node,
|
||||
Ip_u64 octets,
|
||||
Ip_u64 pkts);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_route_add_inbound(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip6pm_node *node,
|
||||
Ip_u64 octets,
|
||||
Ip_u64 pkts);
|
||||
IP_GLOBAL int ipmip6pm_netlink_new_handle(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node);
|
||||
IP_GLOBAL int ipmip6pm_netlink_del_handle(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node);
|
||||
IP_GLOBAL Ip_bool ipmip6pm_netlink_get_handle_stat(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6pm_node *node);
|
||||
|
||||
IP_GLOBAL void ipmip6pm_route_context_init(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc);
|
||||
IP_GLOBAL void ipmip6pm_route_context_destroy(struct Ipmip6pm_context *ctx,
|
||||
struct Ipmip_proc *proc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
Reference in New Issue
Block a user