original files of m241
This commit is contained in:
@@ -0,0 +1,569 @@
|
||||
/* 00comp_ipnet_mobility.cdf - IPNet Mobility configuration file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute or otherwise make use of this software
|
||||
* may be licensed only pursuant to the terms of an applicable Wind River
|
||||
* license agreement. No license to Wind River intellectual property rights
|
||||
* is granted herein. All rights not licensed by Wind River are reserved
|
||||
* by Wind River.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01b,14jul08,tlu Fix a module name to fix the component greyed out in WB
|
||||
01i,11may08,jho created.
|
||||
*/
|
||||
|
||||
#ifdef _WRS_CONFIG_COMPONENT_IPMIP6MN
|
||||
|
||||
Component INCLUDE_IPMIP6MN {
|
||||
NAME IPv6 Mobile Node
|
||||
SYNOPSIS IPv6 Mobile Node
|
||||
REQUIRES INCLUDE_IPCOM INCLUDE_IPCOM_USE_INET6 INCLUDE_IPMIP6 SELECT_IPMIP6MN
|
||||
MODULES ipmip6mn.o
|
||||
CONFIGLETTES ipmip6mn_config.c
|
||||
CFG_PARAMS MIP6MN_NETWORK_ENUM \
|
||||
MIP6MN_INTERFACES \
|
||||
MIP6MN_HOMEAGENTS \
|
||||
MIP6MN_HOME_ADDRESS \
|
||||
MIP6MN_LIFETIME \
|
||||
MIP6MN_REG_TIMEOUT \
|
||||
MIP6MN_NAI_MN
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_CMD {
|
||||
NAME IPv6 Mobile Node IPCOM commands
|
||||
SYNOPSIS IPv6 Mobile Node IPCOM commands.
|
||||
MODULES ipmip6mn_cmd_mn6.o
|
||||
REQUIRES INCLUDE_IPCOM_SHELL_CMD INCLUDE_IPMIP6MN
|
||||
}
|
||||
|
||||
Selection SELECT_IPMIP6MN_NEMO {
|
||||
NAME Ipv6 Mobile Node Mobile Router Features
|
||||
SYNOPSIS Ipv6 Mobile Node Mobile Router Features
|
||||
COUNT 0-
|
||||
CHILDREN INCLUDE_IPMIP6MN_NEMO \
|
||||
INCLUDE_IPMIP6MN_NEMO_RADVD
|
||||
DEFAULTS INCLUDE_IPMIP6MN_NEMO \
|
||||
INCLUDE_IPMIP6MN_NEMO_RADVD
|
||||
}
|
||||
|
||||
Selection SELECT_IPMIP6MN_DUAL_STACK_NEMO {
|
||||
NAME Ipv6 Mobile Node Dual Stack Mobile Router Features
|
||||
SYNOPSIS Ipv6 Mobile Node Dual Stack Mobile Router Features
|
||||
COUNT 0-
|
||||
CHILDREN INCLUDE_IPMIP6MN_DUAL_STACK_NEMO \
|
||||
INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER
|
||||
DEFAULTS INCLUDE_IPMIP6MN_DUAL_STACK_NEMO \
|
||||
INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER
|
||||
}
|
||||
|
||||
Selection SELECT_IPMIP6MN {
|
||||
NAME Ipv6 Mobile Node Components
|
||||
SYNOPSIS Ipv6 Mobile Node Components
|
||||
COUNT 0-
|
||||
REQUIRES INCLUDE_IPMIP6MN
|
||||
_CHILDREN FOLDER_MOBILITY_V6
|
||||
CHILDREN INCLUDE_IPMIP6MN \
|
||||
INCLUDE_IPMIP6MN_CMD \
|
||||
INCLUDE_IPMIP6MN_IPSEC \
|
||||
INCLUDE_IPMIP6MN_DUAL_STACK \
|
||||
INCLUDE_IPMIP6MN_SERVICE_SELECTION \
|
||||
INCLUDE_IPMIP6MN_SERVICE_VENDOR_EXTENSION \
|
||||
INCLUDE_IPMIP6MN_MOBILE_PREFIX_RENUMBER_SUPPORT \
|
||||
INCLUDE_IPMIP6MN_FEATURE_EXTENSION \
|
||||
SELECT_IPMIP6MN_NEMO \
|
||||
SELECT_IPMIP6MN_DUAL_STACK_NEMO
|
||||
DEFAULTS INCLUDE_IPMIP6MN \
|
||||
INCLUDE_IPMIP6MN_CMD \
|
||||
INCLUDE_IPMIP6MN_SERVICE_SELECTION \
|
||||
INCLUDE_IPMIP6MN_DUAL_STACK
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_FEATURE_EXTENSION {
|
||||
NAME IPv6 Mobile Node Feature Extension
|
||||
SYNOPSIS This feature should be included if one wants to add \
|
||||
a new feature to the mobile node v6, and have the \
|
||||
feature hook being registered during initialization.
|
||||
REQUIRES INCLUDE_IPMIP6MN
|
||||
CFG_PARAMS MIP6MN_FEATURE_INITIALIZATION_HOOK
|
||||
}
|
||||
|
||||
|
||||
Component INCLUDE_IPMIP6MN_SERVICE_SELECTION {
|
||||
NAME IPv6 Mobile Node Service Selection Support
|
||||
SYNOPSIS IPv6 Mobile Node Service Selection Support
|
||||
REQUIRES INCLUDE_IPMIP6MN
|
||||
CFG_PARAMS MIP6MN_SERVICE_SELECTION
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_SERVICE_VENDOR_EXTENSION {
|
||||
NAME IPv6 Mobile Node Generic Vendor Extension Support
|
||||
SYNOPSIS IPv6 Mobile Node Generic Vendor Extension Support
|
||||
REQUIRES INCLUDE_IPMIP6MN
|
||||
CFG_PARAMS MIP6MN_SERVICE_VENDOR_EXTENSION_ENUM
|
||||
}
|
||||
|
||||
|
||||
Component INCLUDE_IPMIP6MN_MOBILE_PREFIX_RENUMBER_SUPPORT {
|
||||
NAME IPv6 Mobile Node Mobile Prefix Renumbering Support
|
||||
SYNOPSIS IPv6 Mobile Node Mobile Prefix Renumbering Support
|
||||
REQUIRES INCLUDE_IPMIP6MN
|
||||
CFG_PARAMS MIP6MN_MOBILE_PREFIX_RENUMBER_FROM_CONFIGURED \
|
||||
MIP6MN_MOBILE_PREFIX_RENUMBER_FROM_INTERFACE
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_IPSEC {
|
||||
NAME IPv6 Mobile Node Security Parameters
|
||||
SYNOPSIS IPv6 Mobile Node Security Parameters
|
||||
REQUIRES INCLUDE_IP_SECURITY INCLUDE_IPMIP6MN
|
||||
CFG_PARAMS MIP6MN_SA_AUTH_MODE \
|
||||
MIP6MN_SA_AUTH_KEY MIP6MN_SA_ENC_MODE MIP6MN_SA_ENC_KEY \
|
||||
MIP6MN_SA_AUTH_MODE_LIST MIP6MN_SA_AUTH_KEY_LIST \
|
||||
MIP6MN_SA_ENC_MODE_LIST MIP6MN_SA_ENC_KEY_LIST \
|
||||
MIP6MN_IPSEC_MH_ENABLED MIP6MN_IPSEC_MH_SPI_IN \
|
||||
MIP6MN_IPSEC_MH_SPI_OUT MIP6MN_IPSEC_PAYLOAD_ENABLED \
|
||||
MIP6MN_IPSEC_PAYLOAD_SPI_IN MIP6MN_IPSEC_PAYLOAD_SPI_OUT
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_DUAL_STACK {
|
||||
NAME IPv6 Mobile Node Dual Stack Support
|
||||
SYNOPSIS IPv6 Mobile Node Dual Stack Support
|
||||
REQUIRES INCLUDE_IPMIP6MN
|
||||
CFG_PARAMS MIP6MN_INET_HOMEADDRESS \
|
||||
MIP6MN_INET_FORCEIPV4UDPENCAPSULATION \
|
||||
MIP6MN_INET_IPV4UDPENCAPSULATIONNATTIMEOUT
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_DUAL_STACK_NEMO {
|
||||
NAME IPv6 Mobile Node Dual Stack Mobile Router Support
|
||||
SYNOPSIS IPv6 Mobile Node Dual Stack Mobile Router Support
|
||||
REQUIRES INCLUDE_IPMIP6MN_DUAL_STACK SELECT_IPMIP6MN_DUAL_STACK_NEMO
|
||||
CFG_PARAMS MIP6MN_NEMO_INET_INGRESS
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER {
|
||||
NAME IPv6 Mobile Node Dual Stack Mobile Router DHCP Server
|
||||
SYNOPSIS IPv6 Mobile Node NEMO Dual Stack DHCP Server enabled the \
|
||||
internal DHCP server for providing nodes connected to the \
|
||||
ingress interface with INET addresses using DHCP. Unless \
|
||||
you implement your own solution, this option should be \
|
||||
enabled when using Dual Stack Mobile Router support.
|
||||
REQUIRES INCLUDE_IPMIP6MN_DUAL_STACK INCLUDE_IPMIP6MN_DUAL_STACK_NEMO
|
||||
CFG_PARAMS MIP6MN_NEMO_INET_DHCP_SERVER_OFFER_TIMEOUT \
|
||||
MIP6MN_NEMO_INET_DHCP_SERVER_OPTION
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_NEMO {
|
||||
NAME IPv6 Mobile Node Mobile Router Support
|
||||
SYNOPSIS IPv6 Mobile Node Mobile Router Support
|
||||
REQUIRES INCLUDE_IPMIP6MN SELECT_IPMIP6MN_NEMO
|
||||
CFG_PARAMS MIP6MN_NEMO_MODE \
|
||||
MIP6MN_NEMO_INGRESS
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_NEMO_RADVD {
|
||||
NAME IPv6 Mobile Node Mobile Router Router Advertisement Support
|
||||
SYNOPSIS IPv6 Mobile Node Mobile Router Router Router Advertisement \
|
||||
Support allows the Mobile Node to automatically configure \
|
||||
RADVD on ingress interface. If this option is disabled, you \
|
||||
will need to configure RADVD manually.
|
||||
REQUIRES INCLUDE_IPMIP6MN_NEMO
|
||||
CFG_PARAMS MIP6MN_NEMO_RADVD_MANAGED \
|
||||
MIP6MN_NEMO_RADVD_OTHER
|
||||
}
|
||||
|
||||
Component INCLUDE_IPMIP6MN_CMD {
|
||||
NAME IPv6 Mobile Node IPCOM commands
|
||||
SYNOPSIS IPv6 Mobile Node IPCOM commands.
|
||||
MODULES ipmip6mn_cmd_mn6.o
|
||||
REQUIRES INCLUDE_IPCOM_SHELL_CMD INCLUDE_IPMIP6MN
|
||||
}
|
||||
|
||||
/* INCLUDE_IPMIP6MN configuration parameters */
|
||||
Parameter MIP6MN_NETWORK_ENUM {
|
||||
NAME Network enumeration
|
||||
SYNOPSIS The mobile node configuration always start with the \
|
||||
network enumeration. The network enumeration tells the \
|
||||
system what configurations are available and should be \
|
||||
activated.
|
||||
TYPE char *
|
||||
DEFAULT "windriver"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_INTERFACES {
|
||||
NAME Interface list
|
||||
SYNOPSIS The interface list specifies what interfaces \
|
||||
should be used for a particular network configuration.The \
|
||||
format of this configuration parameter is a comma separated \
|
||||
list of interface names. E.g. "eth0,eth1"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_HOMEAGENTS {
|
||||
NAME Home Agent List
|
||||
SYNOPSIS Specifies what home agents should be used for a particular \
|
||||
network configuration in the form of a comma separated list \
|
||||
of homeagents in the form \
|
||||
"[<priority>/]<INET6 Home Agent>[/<INET Home Agent>]" If no \
|
||||
home agents are specified, the Mobile Node will resort to \
|
||||
Dynamic Home Agent Address Discovery (DHAAD). A home agent with \
|
||||
higher priority is always used before one with lower. In the \
|
||||
case of equal priorities it will be randomly decided. \
|
||||
If DSMIPv6 is beingused, you may also specify an IPv4 address \
|
||||
for the home agent for use with DSMIPv6 IPv4 care-of addresses. \
|
||||
E.g. "5/3ffe:302:111:3::1;1=4/3ffe:302:111:3::6" \
|
||||
DSMIPv6 example."5/3ffe:302:111:3::1/10.1.2.3"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_HOME_ADDRESS {
|
||||
NAME Home address
|
||||
SYNOPSIS The address the mobile node has on this particular home \
|
||||
network. The address is specified in two parts separated \
|
||||
by "/". The first part is the IPv6 home address and the \
|
||||
second the prefix length. E.g. "3ffe:302:111:3::4/64".
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_LIFETIME {
|
||||
NAME Requested binding lifetime
|
||||
SYNOPSIS Specifies the requested binding lifetime (in seconds) for \
|
||||
this mobile node network. The binding lifetime is determined \
|
||||
by the home agent, but it may never be larger than the value \
|
||||
specified here. It determines how long a binding will live \
|
||||
without having to be refreshed.
|
||||
TYPE char *
|
||||
DEFAULT "120"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_REG_TIMEOUT {
|
||||
NAME 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.
|
||||
TYPE char *
|
||||
DEFAULT "1500"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_AUTH_MODE {
|
||||
NAME Security association auth mode
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_AUTH_KEY {
|
||||
NAME Security association auth key
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_ENC_MODE {
|
||||
NAME Security association enc mode
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_ENC_KEY {
|
||||
NAME Security association enc key
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_AUTH_MODE_LIST {
|
||||
NAME Security association auth mode list
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic. This parameter is specified in the form of \
|
||||
"<spi_value>=<value>", each separated from the other \
|
||||
by a semicolon. E.g. "0=SHA1;1=PADL"
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_AUTH_KEY_LIST {
|
||||
NAME Security association auth key list
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic. This parameter is specified in the form of \
|
||||
"<spi_value>=<value>", each separated from the other \
|
||||
by a semicolon. E.g. "0=HMACSHA196;1=Private".
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_ENC_MODE_LIST {
|
||||
NAME Security association enc mode list
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic. This parameter is specified in the form of \
|
||||
"<spi_value>=<value>", each separated from the other \
|
||||
by a semicolon. E.g. "0=3DES;1=3DES".
|
||||
TYPE char *
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SA_ENC_KEY_LIST {
|
||||
NAME Security association enc key list
|
||||
SYNOPSIS Specifies the security association configuration that the \
|
||||
mobile node should use for a particular mobile node and \
|
||||
traffic. This parameter is specified in the form of \
|
||||
"<spi_value>=<value>", each separated from the other \
|
||||
by a semicolon. E.g. "0=3DES-CBC".
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_IPSEC_MH_ENABLED {
|
||||
NAME Enable mobile header signaling
|
||||
SYNOPSIS Enable security for the Mobility Header signalling using \
|
||||
IPSEC in transport mode. In order to provide this security, \
|
||||
the MIP6MN_IPSEC_MH_SPI_IN and MIP6MN_IPSEC_MH_SPI_OUT \
|
||||
security association must also be specified.
|
||||
TYPE char *
|
||||
DEFAULT "0"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_IPSEC_MH_SPI_IN {
|
||||
NAME IPSec MH SPI In
|
||||
SYNOPSIS Specifies the IPSec SPI In for Mobility Header signalling.
|
||||
TYPE char *
|
||||
DEFAULT "200"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_IPSEC_MH_SPI_OUT {
|
||||
NAME IPSec MH SPI Out
|
||||
SYNOPSIS Specifies the IPSec SPI In for Mobility Header signalling.
|
||||
TYPE char *
|
||||
DEFAULT "201"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_IPSEC_PAYLOAD_ENABLED {
|
||||
NAME Enable payload data protection
|
||||
SYNOPSIS Enable payload data protection for any data tunneled to \
|
||||
and from the home agent using IPSEC. The SPI specified \
|
||||
here MUST be different from those specified for Mobility \
|
||||
Header Signalling Security. This is due to the fact that \
|
||||
the Mobility Header Signalling Security is a static SA \
|
||||
where the end points do not move upon movement, while the \
|
||||
payload security is dependent on the CoA currently being \
|
||||
used. In order to provide this security, the security \
|
||||
association for MIP6MN_IPSEC_PAYLOAD_SPI_IN and \
|
||||
MIP6MN_IPSEC_PAYLOAD_SPI_OUT must also be specified.
|
||||
TYPE char *
|
||||
DEFAULT "0"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_IPSEC_PAYLOAD_SPI_IN {
|
||||
NAME IPSec Payload SPI In
|
||||
SYNOPSIS Specifies the IPSec payload SPI In for payload data \
|
||||
protection.
|
||||
TYPE char *
|
||||
DEFAULT "204"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_IPSEC_PAYLOAD_SPI_OUT {
|
||||
NAME IPSec Payload SPI Out
|
||||
SYNOPSIS Specifies the IPSec payload SPI Out for payload data \
|
||||
protection.
|
||||
TYPE char *
|
||||
DEFAULT "205"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NEMO_MODE {
|
||||
NAME NEMO Mode
|
||||
SYNOPSIS Specifies whether or not NEMO should run in explicit or \
|
||||
implicit mode. Valid values are "explicit","implicit" and \
|
||||
"disabled". If MIP6MN_NEMO_INGRESS has been configured, \
|
||||
MIP6MN_NEMO_MODE will default to "explicit". If no nemo \
|
||||
configuration is available, the nemo mode is always "disabled" \
|
||||
regardless of setting.
|
||||
TYPE char *
|
||||
DEFAULT "explicit"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NEMO_INGRESS {
|
||||
NAME NEMO Ingress Interface Configuration
|
||||
SYNOPSIS Specifies the INGRESS interfaces and their corresponding \
|
||||
prefixes. Syntax is <interface name1>=<prefix1>/<prefixlen1>, \
|
||||
<prefix2>/<prefixlen2>; <interface name2>=<prefix3>/<prefixlen3>
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NAI_MN {
|
||||
NAME Mobile Node Network Access Identifier
|
||||
SYNOPSIS The mobile node network access identifier provides the \
|
||||
user identity of the connecting node to other mobility \
|
||||
resources that the mobile node contacts. The format of the \
|
||||
NAI should be user@domain.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NEMO_INET_INGRESS {
|
||||
NAME INET DSMIPv6 NEMO Ingress Interface Configuration
|
||||
SYNOPSIS Specifies the INET DSMIPV6 INGRESS interfaces and their corresponding \
|
||||
inet prefixes. Syntax is <interface name1>=<prefix1>/<prefixlen1>, \
|
||||
<prefix2>/<prefixlen2>; <interface name2>=<prefix3>/<prefixlen3>. \
|
||||
For example eth0=10.1.2.0/24. If the address 0.0.0.0 is specified \
|
||||
it will request the home agent to dynamically allocate a prefix.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NEMO_INET_DHCP_SERVER_OFFER_TIMEOUT {
|
||||
NAME INET DSMIPV6 NEMO DHCP Server Offer Timeout
|
||||
SYNOPSIS This item specifies the time interval in seconds the DHCP \
|
||||
server will reserve an offered lease before making it \
|
||||
available for other nodes to allocate.
|
||||
TYPE char *
|
||||
DEFAULT "10"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NEMO_INET_DHCP_SERVER_OPTION {
|
||||
NAME INET DSMIPV6 NEMO DHCP Server Options
|
||||
SYNOPSIS This item defines the extra DHCP options that should be \
|
||||
provided during DHCP negotiation. The syntax is \
|
||||
<type>.<code>=<value>. <type> is one of bool,u8,u16,u32,ip,\
|
||||
ip_pair and string. The type specifies how the following \
|
||||
values should be parsed. Type string will not parse the value \
|
||||
in any way, only add the entire value to the DHCP option. If \
|
||||
more than one space separated value is provided, they will \
|
||||
be added in an array fashion to the DHCP option. <code> is \
|
||||
the DHCP option code as defined by IANA. For example \
|
||||
"ip.6=10.1.2.3 10.2.3.3" will add a DNS server option with \
|
||||
two servers.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_INET_HOMEADDRESS {
|
||||
NAME INET DSMIPV6 Homeaddress
|
||||
SYNOPSIS Specify the IPv4 INET DSMIPv6 home address to be used by the mobile\
|
||||
node. If the specified address is 0.0.0.0, the mobile node \
|
||||
will request the home agent to dynamically allocate an \
|
||||
address that the mobile node may use.
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SERVICE_SELECTION {
|
||||
NAME Service Selection
|
||||
SYNOPSIS Specify the service selection that this mobile node should \
|
||||
request
|
||||
TYPE char *
|
||||
DEFAULT ""
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NEMO_RADVD_MANAGED {
|
||||
NAME NEMO RADVD Managed Flag
|
||||
SYNOPSIS Enable or disable the MANAGED flag for RADVD.
|
||||
TYPE char *
|
||||
DEFAULT "false"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_NEMO_RADVD_OTHER {
|
||||
NAME NEMO RADVD Other Config Flag
|
||||
SYNOPSIS Enable or disable the Other configuration flag for RADVD.
|
||||
TYPE char *
|
||||
DEFAULT "false"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_MOBILE_PREFIX_RENUMBER_FROM_CONFIGURED {
|
||||
NAME Mobile Prefix Renumber from Configuration
|
||||
SYNOPSIS Enable or disable renumber from configuration functionality. \
|
||||
If enabled, the mobile node will derive any new home addresses \
|
||||
using the previously configured home address and the newly \
|
||||
provided mobile prefix.
|
||||
TYPE char *
|
||||
DEFAULT "false"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_MOBILE_PREFIX_RENUMBER_FROM_INTERFACE {
|
||||
NAME Mobile Prefix Renumber from Interface
|
||||
SYNOPSIS Enable or disable renumber from configuration functionality. \
|
||||
If enabled, the mobile node will derive any new home addresses \
|
||||
by forming a home address based on an interface and the provided \
|
||||
mobile prefix. Valid values are true, false or an interface \
|
||||
name. If an interface has been specified, that interface will \
|
||||
be used to form the address. Otherwise any currently available \
|
||||
interface may be used.
|
||||
TYPE char *
|
||||
DEFAULT "false"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_FEATURE_INITIALIZATION_HOOK {
|
||||
NAME Mobile Node Service Initialization Hook
|
||||
SYNOPSIS This is the function hook that you may define in order to \
|
||||
register extra functional extensions to the mobile node.\
|
||||
extensions, this is the function you should change to point \
|
||||
to your initialization routine.
|
||||
TYPE FUNCPTR
|
||||
DEFAULT your_function_here
|
||||
}
|
||||
|
||||
Parameter MIP6MN_INET_FORCEIPV4UDPENCAPSULATION {
|
||||
NAME Force INET DSMIPv6 UDP encapsulation
|
||||
SYNOPSIS If set to "true", this configuration item will indicate to\
|
||||
the mobile node that UDP encapsulation should be forced. If\
|
||||
the home agent disallows forced UDP encapsulation, the \
|
||||
mobile node will attempt registration without it after \
|
||||
receiving the appropriate error message.
|
||||
TYPE char *
|
||||
DEFAULT "false"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_INET_IPV4UDPENCAPSULATIONNATTIMEOUT {
|
||||
NAME INET DSMIPv6 UDP NAT Timeout Value
|
||||
SYNOPSIS This parameter specifies in seconds for how long any NAT \
|
||||
bindings is expected to survive. If the Mobile Node uses \
|
||||
NAT to communicate with the Home Agent, this parameter \
|
||||
will configure the maximum timeout the Mobile Node will \
|
||||
wait before refreshing the binding.
|
||||
TYPE char *
|
||||
DEFAULT "110"
|
||||
}
|
||||
|
||||
Parameter MIP6MN_SERVICE_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 ""
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: common.vxconfig,v $ $Revision: 1.10 $
|
||||
# $Source: /home/interpeak/CVSRoot/ipmip6mn/config/common.vxconfig,v $
|
||||
# $Author: myakan $
|
||||
# $State: Exp $ $Locker: $
|
||||
#
|
||||
# INTERPEAK_COPYRIGHT_STRING
|
||||
|
||||
#hidden option that enables IPMIP6MN
|
||||
config SUPPORTS_MIP6MN
|
||||
bool
|
||||
default y
|
||||
|
||||
@@ -0,0 +1,342 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK CONFIGURATION SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_config.c,v $ $Revision: 1.24 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_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_err.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
|
||||
/* #include "ipmip6mn_cmd_mn6.h" */
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_IPMIP6MN
|
||||
|
||||
/* Define some parameters that we need */
|
||||
#if !defined(IP_PORT_LAS)
|
||||
#define INCLUDE_IPMIP6MN_CMD
|
||||
#endif
|
||||
|
||||
#define INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER 1
|
||||
#define INCLUDE_IPMIP6MN_NEMO 1
|
||||
#define INCLUDE_IPMIP6MN_MOBILE_PREFIX_RENUMBER_SUPPORT 1
|
||||
#define INCLUDE_IPMIP6MN_DUAL_STACK 1
|
||||
#define INCLUDE_IPMIP6MN_IPSEC 1
|
||||
#define INCLUDE_IPMIP6MN_NEMO_RADVD 1
|
||||
#define INCLUDE_IPMIP6MN_SERVICE_SELECTION 1
|
||||
#define INCLUDE_IPMIP6MN_SERVICE_VENDOR_EXTENSION 1
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef void (*Ipmip6mn_config_func_t) (void *);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_GLOBAL int ipmip6mn_cmd_mn6(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Basic MIP6 Mobile Node(mn) sysvar Configuration
|
||||
*===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_IPMIP6MN
|
||||
|
||||
IP_STATIC IP_CONST Ipcom_sysvar ipmip6_mn_conf_sysvar[] =
|
||||
{
|
||||
/* Configuration delimiter - DO NOT EDIT! */
|
||||
{ IP_NULL, IP_NULL }
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
IP_STATIC IP_CONST Ipcom_sysvar ipmip6_mn_conf_sysvar[] =
|
||||
{
|
||||
/* Enumeration of the Mobile Node configurations */
|
||||
{ "ipmip6mn.enum.0", MIP6MN_NETWORK_ENUM},
|
||||
|
||||
/* Home agents */
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".homeagent", MIP6MN_HOMEAGENTS},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".interfaces", MIP6MN_INTERFACES},
|
||||
|
||||
/* Home address and netmask */
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".homeaddress", MIP6MN_HOME_ADDRESS},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".lifetime", MIP6MN_LIFETIME},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".registration_timeout", MIP6MN_REG_TIMEOUT},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".nai.mn",MIP6MN_NAI_MN},
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_IPSEC)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa.authalg", MIP6MN_SA_AUTH_MODE},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa.authkey",MIP6MN_SA_AUTH_KEY},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa.encalg", MIP6MN_SA_ENC_MODE},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa.enckey", MIP6MN_SA_ENC_KEY},
|
||||
|
||||
/* Enable security for MH signalling 1 == enable */
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.mh", MIP6MN_IPSEC_MH_ENABLED},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.mh.spi.in", MIP6MN_IPSEC_MH_SPI_IN},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.mh.spi.out",MIP6MN_IPSEC_MH_SPI_OUT},
|
||||
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.payload",MIP6MN_IPSEC_PAYLOAD_ENABLED},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.payload.spi.in", MIP6MN_IPSEC_PAYLOAD_SPI_IN },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.payload.spi.out", MIP6MN_IPSEC_PAYLOAD_SPI_OUT},
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_NEMO)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_router.mode", MIP6MN_NEMO_MODE},
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_DUAL_STACK)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet", "enabled" },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.homeaddress", MIP6MN_INET_HOMEADDRESS},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.ForceIPv4UDPEncapsulation", MIP6MN_INET_FORCEIPV4UDPENCAPSULATION },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.IPv4UDPEncapsulationNATTimeout",MIP6MN_INET_IPV4UDPENCAPSULATIONNATTIMEOUT },
|
||||
#else
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet", "disabled" },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.mobile_router.dhcp.server", "enabled" },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.mobile_router.dhcp.server.offer.timeout", MIP6MN_NEMO_INET_DHCP_SERVER_OFFER_TIMEOUT },
|
||||
#else
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.mobile_router.dhcp.server", "disabled" },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_SERVICE_SELECTION)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".service_selection", MIP6MN_SERVICE_SELECTION },
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_NEMO_RADVD)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_router.radvd", "enabled" },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_router.radvd.AdvManagedFlag", MIP6MN_NEMO_RADVD_MANAGED },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_router.radvd.AdvOtherConfigFlag", MIP6MN_NEMO_RADVD_OTHER },
|
||||
#else
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_router.radvd", "disabled" },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_MOBILE_PREFIX_RENUMBER_SUPPORT)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_prefix.renumber.derive_from_configured", MIP6MN_MOBILE_PREFIX_RENUMBER_FROM_CONFIGURED },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_prefix.renumber.derive_from_interface", MIP6MN_MOBILE_PREFIX_RENUMBER_FROM_INTERFACE },
|
||||
#endif
|
||||
|
||||
/* Configuration delimiter - DO NOT EDIT! */
|
||||
{ IP_NULL, IP_NULL }
|
||||
};
|
||||
|
||||
|
||||
/* Interface specific list configurations */
|
||||
IP_CONST Ipcom_sysvar_ext ipmip6_mn_conf_sysvar_ext[] =
|
||||
{
|
||||
#if defined(INCLUDE_IPMIP6MN_IPSEC)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa", "authalg", MIP6MN_SA_AUTH_MODE_LIST },
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa", "authkey", MIP6MN_SA_AUTH_KEY_LIST},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa", "encalg", MIP6MN_SA_ENC_MODE_LIST},
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".ipsec.sa", "enckey", MIP6MN_SA_ENC_KEY_LIST},
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_NEMO)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".mobile_router.ingress", IP_NULL, MIP6MN_NEMO_INGRESS},
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_DUAL_STACK_NEMO)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.mobile_router.ingress", IP_NULL, MIP6MN_NEMO_INET_INGRESS},
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".inet.mobile_router.dhcp.server.option", IP_NULL, MIP6MN_NEMO_INET_DHCP_SERVER_OPTION },
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_SERVICE_VENDOR_EXTENSION)
|
||||
{ "ipmip6mn." MIP6MN_NETWORK_ENUM ".vendor_extension", IP_NULL, MIP6MN_SERVICE_VENDOR_EXTENSION_ENUM },
|
||||
#endif
|
||||
|
||||
/* Configuration delimiter - DO NOT EDIT! */
|
||||
{ IP_NULL, IP_NULL, IP_NULL }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER)
|
||||
extern void ipmip6mn_service_dsmipv6_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_MOBILE_PREFIX_RENUMBER_SUPPORT)
|
||||
extern void ipmip6mn_service_mpdisc_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_NEMO_RADVD)
|
||||
extern void ipmip6mn_service_radvd_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_SERVICE_SELECTION)
|
||||
extern void ipmip6mn_service_selection_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_SERVICE_VENDOR_EXTENSION)
|
||||
extern void ipmip6mn_service_vendor_extension_install(void *);
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_IPMIP6MN_FEATURE_EXTENSION)
|
||||
extern void MIP6MN_FEATURE_INITIALIZATION_HOOK(void *);
|
||||
#endif
|
||||
|
||||
Ipmip6mn_config_func_t ipmip6mn_service_registrations[] =
|
||||
{
|
||||
#if defined(INCLUDE_IPMIP6MN_DUAL_STACK_NEMO_DHCP_SERVER)
|
||||
ipmip6mn_service_dsmipv6_install,
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6MN_MOBILE_PREFIX_RENUMBER_SUPPORT)
|
||||
ipmip6mn_service_mpdisc_install,
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6MN_NEMO_RADVD)
|
||||
ipmip6mn_service_radvd_install,
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6MN_SERVICE_SELECTION)
|
||||
ipmip6mn_service_selection_install,
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6MN_SERVICE_VENDOR_EXTENSION)
|
||||
ipmip6mn_service_vendor_extension_install,
|
||||
#endif
|
||||
#if defined(INCLUDE_IPMIP6MN_FEATURE_EXTENSION)
|
||||
MIP6MN_FEATURE_INITIALIZATION_HOOK,
|
||||
#endif
|
||||
IP_NULL
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6_configure
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6mn_configure(void);
|
||||
IP_PUBLIC Ip_err
|
||||
ipmip6mn_configure(void)
|
||||
{
|
||||
/* Initialize IPMIPMN system variables. */
|
||||
if (ipcom_sysvar_setv(ipmip6_mn_conf_sysvar, 0) == IPCOM_SUCCESS)
|
||||
{
|
||||
#ifdef INCLUDE_IPMIP6MN
|
||||
/* now configure the interface-specific sysvars */
|
||||
return ipcom_sysvar_ext_setv (ipmip6_mn_conf_sysvar_ext, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_init
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6mn_init(void);
|
||||
IP_PUBLIC Ip_err
|
||||
ipmip6mn_init(void)
|
||||
{
|
||||
#ifdef INCLUDE_IPMIP6MN_CMD
|
||||
ipcom_shell_add_cmd("mn6", "mn6 <command> [modifiers]", "Mobile IPv6 Mobile Node",
|
||||
ipmip6mn_cmd_mn6,
|
||||
IPCOM_PRIORITY_DEFAULT, IPCOM_PROC_STACK_SMALL);
|
||||
#endif
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_exit
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipmip6mn_exit(void);
|
||||
IP_PUBLIC Ip_err
|
||||
ipmip6mn_exit(void)
|
||||
{
|
||||
#ifdef INCLUDE_IPMIP6MN_CMD
|
||||
/* Remove the shell command */
|
||||
ipcom_shell_remove_cmd("mn6", ipmip6mn_cmd_mn6);
|
||||
#endif
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK CONFIGURATION HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_config.h,v $ $Revision: 1.10 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_config.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-03-02 11:45:20 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6MN_CONFIG_H
|
||||
#define IPMIP6MN_CONFIG_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmip6_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#ifdef IP_DEBUG
|
||||
#define IPMIP6MN_EVENT_BACKLOG 300
|
||||
#else
|
||||
#define IPMIP6MN_EVENT_BACKLOG 100
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmip6mn_context;
|
||||
struct Ipmip_proc;
|
||||
|
||||
typedef Ip_bool (*Ipmip6mn_service_init_t)
|
||||
(
|
||||
struct Ipmip6mn_context *ctx
|
||||
);
|
||||
|
||||
extern Ipmip6mn_service_init_t ipmip6mn_service_registrations[];
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_err ipmip6mn_init(void);
|
||||
IP_PUBLIC Ip_err ipmip6mn_exit(void);
|
||||
IP_PUBLIC Ip_err ipmip6mn_configure(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,167 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_pktbuf.c,v $ $Revision: 1.5 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_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 "ipmip6mn_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 "ipmip6mn_h.h"
|
||||
#include "ipmip6mn_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_pktbuf_alloc
|
||||
*===========================================================================
|
||||
* Description: Allocate a packet buffer
|
||||
* Parameters:
|
||||
* Returns: A newly allocated packet buffer
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipmip_pktbuf_t *
|
||||
ipmip6mn_pktbuf_alloc(Ipmip6mn_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ip_size_t extra)
|
||||
{
|
||||
Ipmip6mn_pktbuf_t *pbuf;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
/* Return a Ipmipfa_pktbuf_t */
|
||||
pbuf = ipcom_calloc(1, sizeof(Ipmip6mn_pktbuf_t) + extra);
|
||||
if (pbuf)
|
||||
{
|
||||
pbuf->ipmip6.ipmip.pktend = (void *) (pbuf + 1);
|
||||
return &pbuf->ipmip6.ipmip;
|
||||
}
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_pktbuf_free
|
||||
*===========================================================================
|
||||
* Description: Free a packet buffer
|
||||
* Parameters: pbuf - The packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmip6mn_pktbuf_free(Ipmip6mn_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6mn_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,130 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_pktbuf.h,v $ $Revision: 1.7 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_pktbuf.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-03-31 15:00:25 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIP6MN_PKTBUF_H
|
||||
#define IPMIP6MN_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 Ipmip6_bc;
|
||||
struct Ipmip6mn_context;
|
||||
|
||||
typedef struct Ipmip6mn_pktbuf_pktinfo
|
||||
{
|
||||
struct Ip_in6_addr *src;
|
||||
struct Ip_in6_addr *home;
|
||||
Ip_u8 iperr;
|
||||
Ip_u32 refresh;
|
||||
Ip_u16 flags;
|
||||
} Ipmip6mn_pktbuf_pktinfo_t;
|
||||
|
||||
typedef struct Ipmip6mn_pktbuf
|
||||
{
|
||||
Ipmip6_pktbuf_t ipmip6;
|
||||
|
||||
Ip_u32 state;
|
||||
|
||||
Ip_u32 extensions_processed;
|
||||
|
||||
struct Ipmip6_bc *bc;
|
||||
Ipmip6mn_pktbuf_pktinfo_t pktinfo;
|
||||
|
||||
void **extensions;
|
||||
} Ipmip6mn_pktbuf_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_pktbuf_alloc
|
||||
*===========================================================================
|
||||
* Description: Allocate a packet buffer
|
||||
* Parameters: ctx - Context
|
||||
* proc - Process
|
||||
* Returns: A newly allocated packet buffer
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipmip_pktbuf_t *ipmip6mn_pktbuf_alloc(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ip_size_t extra);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_pktbuf_free
|
||||
*===========================================================================
|
||||
* Description: Free a packet buffer
|
||||
* Parameters: ctx - Context
|
||||
* proc - Process
|
||||
* pbuf - The packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipmip6mn_pktbuf_free(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmip6mn_pktbuf_t *pbuf);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,826 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_service_dsmipv6.c,v $ $Revision: 1.8 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_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 "ipmip6mn_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_strlib.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_context.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_netlink.h>
|
||||
#include <private/ipmip_dhcp.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_pkt.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6mn_h.h"
|
||||
#include "ipmip6mn_pktbuf.h"
|
||||
#include "ipmip6mn_bc.h"
|
||||
#include "ipmip6mn_mh.h"
|
||||
#include "ipmip6mn_mh_ha.h"
|
||||
#include "ipmip6mn_mib_update.h"
|
||||
#include "ipmip6mn_route.h"
|
||||
#include "ipmip6mn_attr_h.h"
|
||||
|
||||
#if defined(IPMIP_USE_INET)
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6MN_SERVICE_DSMIPV6_NAME "dsmipv6"
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipmip6mn_service_dsmipv6_config
|
||||
{
|
||||
Ip_bool dhcp_server;
|
||||
Ip_u32 offer_timeout;
|
||||
Ipcom_list options;
|
||||
} Ipmip6mn_service_dsmipv6_config_t;
|
||||
|
||||
typedef struct Ipmip6mn_service_dsmipv6_lease_lookup
|
||||
{
|
||||
Ip_size_t sz;
|
||||
Ip_u8 *data;
|
||||
} Ipmip6mn_service_dsmipv6_lease_lookup_t;
|
||||
|
||||
typedef struct Ipmip6mn_service_dsmipv6_gw
|
||||
{
|
||||
Ipcom_list next;
|
||||
Ipmip_dhcp_lease_t *lease;
|
||||
Ip_u32 mask;
|
||||
} Ipmip6mn_service_dsmipv6_gw_t;
|
||||
|
||||
typedef struct Ipmip6mn_service_dsmipv6_node_dhcp
|
||||
{
|
||||
Ipcom_list next;
|
||||
Ipmip_dhcp_pool_t *pool;
|
||||
Ipmip_dhcp_node_t node;
|
||||
Ipmip_if_t *iff;
|
||||
Ipmip_dhcp_rtab_t *rtab;
|
||||
Ipcom_hash *leases;
|
||||
Ipmip6mn_node_t *mn;
|
||||
Ipcom_list gws;
|
||||
Ipmip6mn_service_dsmipv6_config_t *cfg;
|
||||
} Ipmip6mn_service_dsmipv6_node_dhcp_t;
|
||||
|
||||
typedef struct Ipmip6mn_service_dsmipv6_lease
|
||||
{
|
||||
Ipmip_timer_t timer;
|
||||
Ipmip_dhcp_lease_t *lease;
|
||||
Ipmip6mn_service_dsmipv6_node_dhcp_t *db;
|
||||
Ip_u32 gateway;
|
||||
|
||||
Ip_size_t len;
|
||||
char identity[1];
|
||||
} Ipmip6mn_service_dsmipv6_lease_t;
|
||||
|
||||
typedef struct Ipmip6mn_service_dsmipv6_node
|
||||
{
|
||||
Ipcom_list pools;
|
||||
} Ipmip6mn_service_dsmipv6_node_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_dsmipv6_lease_free(Ipmip6mn_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_dhcp_lease_t *dlease)
|
||||
{
|
||||
Ipmip6mn_service_dsmipv6_lease_t *lease = dlease->opaque;
|
||||
if (lease != IP_NULL)
|
||||
{
|
||||
ipcom_hash_remove(lease->db->leases, lease);
|
||||
ipmip_timer_cancel(&ctx->ipmip6.ipmip, proc, &lease->timer);
|
||||
ipcom_free(lease);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_service_dsmipv6_key_hash_id
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_STATIC unsigned
|
||||
ipmip6mn_service_dsmipv6_key_hash_id(Ipmip6mn_service_dsmipv6_lease_lookup_t *id)
|
||||
{
|
||||
return ipcom_hash_update(id->data, (int)id->sz, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6mn_service_dsmipv6_obj_hash_id
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_STATIC unsigned
|
||||
ipmip6mn_service_dsmipv6_obj_hash_id(Ipmip6mn_service_dsmipv6_lease_t *lease)
|
||||
{
|
||||
return ipcom_hash_update(lease->identity, (int)lease->len, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmip6pm_node_cmp_nai
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6mn_service_dsmipv6_cmp_id(Ipmip6mn_service_dsmipv6_lease_t *lease, Ipmip6mn_service_dsmipv6_lease_lookup_t *id)
|
||||
{
|
||||
/* Compare */
|
||||
return ipmip_util_strnncmp(lease->identity, lease->len, (char *)id->data, id->sz);
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC Ipmip6mn_service_dsmipv6_gw_t *
|
||||
ipmip6mn_service_dsmipv6_gateway_get(Ipmip6mn_service_dsmipv6_node_dhcp_t *node,
|
||||
Ip_u32 addr)
|
||||
{
|
||||
Ipmip6mn_service_dsmipv6_gw_t *gw;
|
||||
|
||||
for (gw = IPCOM_LIST_FIRST(&node->gws); gw != IP_NULL; gw = IPCOM_LIST_NEXT(&gw->next))
|
||||
{
|
||||
if ((gw->lease->prefix & gw->mask) == (addr & gw->mask))
|
||||
return gw;
|
||||
}
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6mn_service_dsmipv6_lease_timeout(int event,
|
||||
Ipmip6mn_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6mn_service_dsmipv6_lease_t *lease,
|
||||
void *unused)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(unused);
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
ipmip_dhcp_lease_delete(&ctx->ipmip6.ipmip, proc, lease->lease);
|
||||
|
||||
return IPMIP_TIMER_RET_DONE;
|
||||
}
|
||||
|
||||
IP_STATIC Ipmip6mn_service_dsmipv6_lease_t *
|
||||
ipmip6mn_service_dsmipv6_lease_create(Ipmip6mn_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip6mn_service_dsmipv6_node_dhcp_t *node,
|
||||
Ip_u8 *ident,
|
||||
Ip_size_t sz,
|
||||
Ip_u32 req_addr,
|
||||
int rule)
|
||||
{
|
||||
Ipmip6mn_service_dsmipv6_lease_t *lease = ipcom_calloc(1, sizeof(*lease) + sz);
|
||||
Ipmip6mn_service_dsmipv6_gw_t *gw;
|
||||
|
||||
|
||||
ipcom_memcpy(&lease->identity[0], ident, sz);
|
||||
lease->len = sz;
|
||||
lease->db = node;
|
||||
lease->lease = ipmip_dhcp_pool_lease_alloc(&ctx->ipmip6.ipmip, proc, node->pool, req_addr, 32, rule, lease);
|
||||
if (lease->lease == IP_NULL)
|
||||
{
|
||||
ipcom_free(lease);
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
if ((gw = ipmip6mn_service_dsmipv6_gateway_get(node, lease->lease->prefix)) == IP_NULL)
|
||||
{
|
||||
ipmip_dhcp_lease_delete(&ctx->ipmip6.ipmip, proc, lease->lease);
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
/* OK */
|
||||
lease->gateway = gw->lease->prefix;
|
||||
ipcom_hash_add(node->leases, lease);
|
||||
|
||||
ipmip_timer_request(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
&lease->timer,
|
||||
node->node.lock,
|
||||
(Ipmip_timer_func_t)ipmip6mn_service_dsmipv6_lease_timeout,
|
||||
lease,
|
||||
IP_NULL,
|
||||
node->cfg->offer_timeout * 1000);
|
||||
return lease;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6mn_service_dsmipv6_dhcpv4_server(int event,
|
||||
Ipmip6mn_context_t *ctx,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_dhcp_node_t *dnode,
|
||||
Ipmip6mn_pktbuf_t *pbuf)
|
||||
{
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
Ipmip6mn_service_dsmipv6_node_dhcp_t *lnode = dnode->opaque;
|
||||
Ipmip_dhcp_hdr_t *pkt = (Ipmip_dhcp_hdr_t *)IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
|
||||
|
||||
if (pkt->op == IPMIP_DHCP_OP_BOOTREQUEST)
|
||||
{
|
||||
Ip_u8 *opt;
|
||||
|
||||
if ((opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_DHCP_MESSAGE_TYPE)) == IP_NULL)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"No MESSAGE TYPE in DHCP Request Received by %s",
|
||||
lnode->mn->name));
|
||||
goto done_out;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipmip6mn_pktbuf_t *rpkt = (Ipmip6mn_pktbuf_t*)ipmip_pktbuf_alloc(&ctx->ipmip6.ipmip, proc, 512);
|
||||
Ipmip_buffer_t *buf = &rpkt->ipmip6.ipmip.packet;
|
||||
Ipmip6mn_service_dsmipv6_lease_lookup_t dlookup;
|
||||
Ipmip6mn_service_dsmipv6_lease_t *lease = IP_NULL;
|
||||
Ipmip_dhcp_option_t *opt_entry;
|
||||
Ip_u8 type;
|
||||
Ip_u8 *req_opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_DHCP_PARAMETER_REQUEST_LIST);
|
||||
Ip_u8 *ra_opt = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_RELAY_AGENT_INFO);
|
||||
Ip_u8 *cid = ipmip_dhcp_option_buffer_find(&pbuf->ipmip6.ipmip.packet, IPMIP_DHCP_OPTCODE_CLIENT_IDENTIFIER);
|
||||
Ip_u32 tmp32;
|
||||
Ip_u32 sid = 0;
|
||||
Ip_time_t lifetime = ipmip_util_time();
|
||||
|
||||
if (lifetime >= lnode->mn->home_agent.expires)
|
||||
lifetime = 10;
|
||||
else
|
||||
lifetime = lnode->mn->home_agent.expires - lifetime;
|
||||
|
||||
/* Add the packet */
|
||||
ipmip_buffer_append(buf, pkt, sizeof(*pkt));
|
||||
|
||||
dlookup.data = cid? &cid[IPMIP_DHCP_OPT_DATA] : &pkt->chaddr[0];
|
||||
dlookup.sz = (Ip_size_t)(cid? cid[IPMIP_DHCP_OPT_LEN] : pkt->hlen);
|
||||
|
||||
lease = ipcom_hash_get(lnode->leases, &dlookup);
|
||||
|
||||
sid = ipmip_dhcp_option_buffer_find_ip(&pbuf->ipmip6.ipmip.packet,
|
||||
IPMIP_DHCP_OPTCODE_DHCP_SERVER_IDENTIFIER);
|
||||
|
||||
switch(opt[IPMIP_DHCP_OPT_DATA])
|
||||
{
|
||||
case IPMIP_DHCP_MSG_DISCOVER:
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Discover Received by %s",
|
||||
lnode->mn->name));
|
||||
type = IPMIP_DHCP_MSG_OFFER;
|
||||
|
||||
if (lease == IP_NULL)
|
||||
{
|
||||
if ((lease = ipmip6mn_service_dsmipv6_lease_create(ctx, proc, lnode, dlookup.data, dlookup.sz, 0, IPMIP_DHCP_ALLOC_ANY)) == IP_NULL)
|
||||
goto done_out;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IPMIP_DHCP_MSG_REQUEST:
|
||||
{
|
||||
Ip_u32 req_addr = 0;
|
||||
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Request Received by %s",
|
||||
lnode->mn->name));
|
||||
|
||||
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)
|
||||
{
|
||||
if (lease != IP_NULL)
|
||||
{
|
||||
if (lease->gateway != sid)
|
||||
goto done_out;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipmip6mn_service_dsmipv6_gw_t *gw;
|
||||
for (gw = IPCOM_LIST_FIRST(&lnode->gws); gw != IP_NULL; gw = IPCOM_LIST_NEXT(&gw->next))
|
||||
if (gw->lease->prefix == sid)
|
||||
break;
|
||||
|
||||
if (gw == IP_NULL)
|
||||
goto done_out;
|
||||
}
|
||||
}
|
||||
|
||||
if (req_addr != 0 && (lease == IP_NULL || req_addr == lease->lease->prefix))
|
||||
{
|
||||
|
||||
type = IPMIP_DHCP_MSG_ACK;
|
||||
if (lease == IP_NULL)
|
||||
{
|
||||
if ((lease = ipmip6mn_service_dsmipv6_lease_create(ctx, proc, lnode, dlookup.data, dlookup.sz, req_addr, IPMIP_DHCP_ALLOC_EXACT)) == IP_NULL)
|
||||
{
|
||||
type = IPMIP_DHCP_MSG_NAK;
|
||||
break;
|
||||
}
|
||||
else
|
||||
sid = lease->gateway;
|
||||
}
|
||||
|
||||
/**/
|
||||
ipmip_timer_cancel(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
&lease->timer);
|
||||
ipmip_timer_request(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
&lease->timer,
|
||||
lnode->node.lock,
|
||||
(Ipmip_timer_func_t)ipmip6mn_service_dsmipv6_lease_timeout,
|
||||
lease,
|
||||
IP_NULL,
|
||||
(Ip_u32)lifetime * 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
type = IPMIP_DHCP_MSG_NAK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IPMIP_DHCP_MSG_DECLINE:
|
||||
/* Do what? */
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Decline Received by %s",
|
||||
lnode->mn->name));
|
||||
if (lease != IP_NULL)
|
||||
{
|
||||
ipmip_timer_cancel(&ctx->ipmip6.ipmip, proc, &lease->timer);
|
||||
ipcom_hash_remove(lnode->leases, lease);
|
||||
}
|
||||
|
||||
goto done_out;
|
||||
|
||||
case IPMIP_DHCP_MSG_RELEASE:
|
||||
/* Do what? */
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Release Received by %s",
|
||||
lnode->mn->name));
|
||||
if (lease != IP_NULL)
|
||||
ipmip_dhcp_lease_delete(&ctx->ipmip6.ipmip, proc, lease->lease);
|
||||
|
||||
|
||||
goto done_out;
|
||||
|
||||
case IPMIP_DHCP_MSG_INFORM:
|
||||
/* Do what? */
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Inform Received by %s",
|
||||
lnode->mn->name));
|
||||
|
||||
|
||||
if (lease != IP_NULL && IP_GET_32ON8(&pkt->ciaddr) == lease->lease->prefix)
|
||||
type = IPMIP_DHCP_MSG_INFORM_ACK;
|
||||
else
|
||||
type = IPMIP_DHCP_MSG_NAK;
|
||||
break;
|
||||
default:
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP unknown Received by %s",
|
||||
lnode->mn->name));
|
||||
goto done_out;
|
||||
}
|
||||
|
||||
if (sid == 0)
|
||||
{
|
||||
if (lease != IP_NULL)
|
||||
sid = lease->gateway;
|
||||
else
|
||||
{
|
||||
Ipmip6mn_service_dsmipv6_gw_t *gw = IPCOM_LIST_FIRST(&lnode->gws);
|
||||
sid = gw->lease->prefix;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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, sid);
|
||||
|
||||
if (type != IPMIP_DHCP_MSG_NAK)
|
||||
{
|
||||
/* ACK or INFORM_ACK */
|
||||
if (type != IPMIP_DHCP_MSG_INFORM_ACK)
|
||||
{
|
||||
ipmip_dhcp_option_buffer_append_u32(buf, IPMIP_DHCP_OPTCODE_DHCP_LEASE_TIME, (Ip_u32)lifetime);
|
||||
}
|
||||
|
||||
/* Add the basic options */
|
||||
|
||||
/* Subnet */
|
||||
tmp32 = 0;
|
||||
ipmip_util_create_mask((Ip_u8 *)&tmp32, lease->lease->netmask_bits);
|
||||
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, sid);
|
||||
|
||||
if (req_opt)
|
||||
{
|
||||
for (tmp32 = 0; tmp32 < req_opt[IPMIP_DHCP_OPT_LEN]; tmp32++)
|
||||
{
|
||||
opt_entry = ipmip_dhcp_option_entry_find(&lnode->cfg->options, req_opt[IPMIP_DHCP_OPT_DATA + tmp32]);
|
||||
if (opt_entry != IP_NULL)
|
||||
ipmip_dhcp_buffer_append_option_entry(buf, opt_entry);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add rest */
|
||||
for (opt_entry = IPCOM_LIST_FIRST(&lnode->cfg->options); opt_entry != IP_NULL; opt_entry = IPCOM_LIST_NEXT(&opt_entry->next))
|
||||
ipmip_dhcp_buffer_append_option_entry(buf, opt_entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NAK */
|
||||
}
|
||||
|
||||
if (ra_opt)
|
||||
ipmip_dhcp_option_buffer_append(buf, IPMIP_DHCP_OPTCODE_RELAY_AGENT_INFO, ra_opt[IPMIP_DHCP_OPT_LEN], &ra_opt[IPMIP_DHCP_OPT_DATA]);
|
||||
|
||||
ipmip_dhcp_option_buffer_close(buf);
|
||||
|
||||
pkt = (Ipmip_dhcp_hdr_t *)IPMIP_BUFFER_PTR(buf);
|
||||
pkt->op = IPMIP_DHCP_OP_BOOTREPLY;
|
||||
pkt->hops = 0;
|
||||
|
||||
if (type != IPMIP_DHCP_MSG_NAK && type != IPMIP_DHCP_MSG_INFORM_ACK)
|
||||
IP_SET_32ON8(&pkt->yiaddr, lease->lease->prefix);
|
||||
|
||||
ipmip_dhcp_server_reply(&ctx->ipmip6.ipmip, proc, &rpkt->ipmip6.ipmip, sid, lnode->iff, type == IPMIP_DHCP_MSG_NAK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"DHCP Reply Received for %s",
|
||||
lnode->mn->name));
|
||||
}
|
||||
}
|
||||
|
||||
done_out:
|
||||
/* Free the DHCP packet */
|
||||
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
||||
return IPMIP_TIMER_RET_DONE;
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_dsmipv6_config_dhcp_options(struct Ipmip_proc *proc,
|
||||
char *name,
|
||||
char *subkey,
|
||||
const char *value,
|
||||
Ipmip6mn_service_dsmipv6_config_t *priv_cfg)
|
||||
{
|
||||
Ipmip_dhcp_option_t *opt = ipmip_dhcp_option_parse_name(proc, subkey, value, IP_NULL);
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(name);
|
||||
|
||||
if (opt != IP_NULL)
|
||||
ipcom_list_insert_first(&priv_cfg->options, &opt->next);
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_dsmipv6_config(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_dsmipv6_config_t *priv_cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
ipcom_list_init(&priv_cfg->options);
|
||||
|
||||
priv_cfg->dhcp_server = ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.inet.mobile_router.dhcp.server", node->name);
|
||||
priv_cfg->offer_timeout = ipmip_sysvar_u32(10, "ipmip6mn.%s.inet.mobile_router.dhcp.server.offer.timeout", node->name);
|
||||
if (priv_cfg->dhcp_server)
|
||||
ipmip_dhcp_context_create(&ctx->ipmip6.ipmip, proc);
|
||||
|
||||
ipmip_sysvar_foreach(proc,
|
||||
(Ipmip_sysvar_foreach_t)ipmip6mn_service_dsmipv6_config_dhcp_options,
|
||||
priv_cfg,
|
||||
"ipmip6mn.%s.inet.mobile_router.dhcp.server.option.*",
|
||||
node->name);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
Ipmip_dhcp_option_t *opt;
|
||||
|
||||
/**/
|
||||
while ((opt = IPCOM_LIST_FIRST(&priv_cfg->options)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(&opt->next);
|
||||
ipcom_free(opt);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
Ipmip_dhcp_option_t *opt;
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.inet.mobile_router.dhcp.server=%s",
|
||||
node->name, priv_cfg->dhcp_server? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.inet.mobile_router.dhcp.server.offer.timeout=%d",
|
||||
node->name, priv_cfg->offer_timeout);
|
||||
|
||||
/**/
|
||||
for (opt = IPCOM_LIST_FIRST(&priv_cfg->options); opt != IP_NULL; opt = IPCOM_LIST_NEXT(&opt->next))
|
||||
{
|
||||
const Ipmip_dhcp_option_def_t *dopt = ipmip_dhcp_option_def_code_get(opt->option[IPMIP_DHCP_OPT_CODE]);
|
||||
if (dopt != IP_NULL)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.inet.mobile_router.dhcp.server.option.%s=%s",
|
||||
node->name, dopt->name, ipmip_dhcp_option_print(proc, opt->option, opt->type));
|
||||
}
|
||||
else
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.inet.mobile_router.dhcp.server.option.%s.%u=%s",
|
||||
node->name, ipmip_dhcp_type_name[opt->type], opt->option[IPMIP_DHCP_OPT_CODE], ipmip_dhcp_option_print(proc, opt->option, opt->type));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6mn_service_dsmipv6_provide(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_dsmipv6_config_t *dscfg,
|
||||
Ipmip6mn_service_dsmipv6_node_t *handle,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
Ipmip6mn_dsmipv6_nemo_prefix_t *dsnemo;
|
||||
Ipmip6mn_service_dsmipv6_node_dhcp_t *dhcp;
|
||||
Ipmip6mn_service_dsmipv6_gw_t *gw;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(dscfg);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
|
||||
if (action == IPMIP_CALLBACK_ENABLE)
|
||||
{
|
||||
ipcom_list_init(&handle->pools);
|
||||
if (dscfg->dhcp_server)
|
||||
{
|
||||
for (dsnemo = IPCOM_LIST_FIRST(&cfg->dsmipv6.prefixes); dsnemo != IP_NULL; dsnemo = IPCOM_LIST_NEXT(&dsnemo->next))
|
||||
{
|
||||
if (dsnemo->nemo && dsnemo->nemo->nemo_if.ifindex != 0 && dsnemo->request_prefix && dsnemo->updated == IP_TRUE && dsnemo->status == IPMIP6_MH_BU_DSMIPV6_HOA_ACK_SUCCESS)
|
||||
{
|
||||
/* Do some kind of processing based on the data */
|
||||
Ip_u32 subnet = dsnemo->runtime_prefix;
|
||||
|
||||
/* Do we have a pool for this already? */
|
||||
for (dhcp = IPCOM_LIST_FIRST(&handle->pools); dhcp != IP_NULL; dhcp = IPCOM_LIST_NEXT(&dhcp->next))
|
||||
if (dhcp->node.ifindex == dsnemo->nemo->nemo_if.ifindex)
|
||||
break;
|
||||
|
||||
/**/
|
||||
if (dhcp == IP_NULL)
|
||||
{
|
||||
dhcp = ipcom_calloc(1, sizeof(*dhcp));
|
||||
dhcp->cfg = dscfg;
|
||||
dhcp->rtab = ipmip_dhcp_rtab_create(&ctx->ipmip6.ipmip, proc, (Ipmip_dhcp_lease_free_t)ipmip6mn_service_dsmipv6_lease_free);
|
||||
dhcp->pool = ipmip_dhcp_pool_create(&ctx->ipmip6.ipmip, proc, dsnemo->nemo->nemo_if.ifname, dhcp->rtab);
|
||||
dhcp->mn = node;
|
||||
dhcp->iff = &dsnemo->nemo->nemo_if;
|
||||
dhcp->leases = ipcom_hash_new((Ipcom_hash_obj_func) ipmip6mn_service_dsmipv6_obj_hash_id,
|
||||
(Ipcom_hash_key_func) ipmip6mn_service_dsmipv6_key_hash_id,
|
||||
(Ipcom_hash_cmp_func) ipmip6mn_service_dsmipv6_cmp_id);
|
||||
|
||||
/**/
|
||||
dhcp->node.ifindex = dsnemo->nemo->nemo_if.ifindex;
|
||||
dhcp->node.lock = node->persistent.lock;
|
||||
dhcp->node.opaque = dhcp;
|
||||
dhcp->node.process_func = (Ipmip_timer_func_t)ipmip6mn_service_dsmipv6_dhcpv4_server;
|
||||
|
||||
ipcom_list_init(&dhcp->gws);
|
||||
/* Register this pool */
|
||||
ipmip_dhcp_register(&ctx->ipmip6.ipmip, proc, &dhcp->node);
|
||||
ipcom_list_insert_last(&handle->pools, &dhcp->next);
|
||||
}
|
||||
|
||||
|
||||
ipmip_dhcp_pool_add_slice(dhcp->pool, subnet, 0, dsnemo->runtime_prefix_length, 32);
|
||||
|
||||
/* Need to add a gateway? */
|
||||
if (ipmip6mn_service_dsmipv6_gateway_get(dhcp, subnet) == IP_NULL)
|
||||
{
|
||||
/* Create a static lease for the gateway for this subnet */
|
||||
gw = ipcom_calloc(1, sizeof(*gw));
|
||||
gw->lease = ipmip_dhcp_pool_lease_alloc(&ctx->ipmip6.ipmip, proc, dhcp->pool, ipcom_htonl(ip_ntohl(subnet) + 1), 32, IPMIP_DHCP_ALLOC_EXACT, IP_NULL);
|
||||
ipmip_util_create_mask((Ip_u8 *)&gw->mask, dsnemo->runtime_prefix_length);
|
||||
ipcom_list_insert_last(&dhcp->gws, &gw->next);
|
||||
|
||||
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET, IP_RTM_NEWADDR, dhcp->node.ifindex, &gw->lease->prefix, gw->lease->netmask_bits, 0, 0) < 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s unable to add address %s/%d to interface %s",
|
||||
node->name,
|
||||
ipmip_ntop_inet(proc, gw->lease->prefix),
|
||||
gw->lease->netmask_bits,
|
||||
dsnemo->nemo->nemo_if.ifname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE)
|
||||
{
|
||||
while ((dhcp = IPCOM_LIST_FIRST(&handle->pools)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(&dhcp->next);
|
||||
|
||||
while ((gw = IPCOM_LIST_FIRST(&dhcp->gws)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(&gw->next);
|
||||
if (ipmip_netlink_inX_addr(&ctx->ipmip6.ipmip, proc, IP_AF_INET, IP_RTM_DELADDR, dhcp->node.ifindex, &gw->lease->prefix, gw->lease->netmask_bits, 0, 0) < 0)
|
||||
{
|
||||
IPMIP6_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s unable to add address %s/%d to interface %s",
|
||||
node->name,
|
||||
ipmip_ntop_inet(proc, gw->lease->prefix),
|
||||
gw->lease->netmask_bits,
|
||||
dhcp->iff->ifname));
|
||||
}
|
||||
ipcom_free(gw);
|
||||
}
|
||||
|
||||
|
||||
ipmip_dhcp_pool_destroy(&ctx->ipmip6.ipmip, proc, dhcp->pool);
|
||||
ipmip_dhcp_rtab_destroy(dhcp->rtab);
|
||||
ipcom_hash_delete(dhcp->leases);
|
||||
ipcom_free(dhcp);
|
||||
}
|
||||
}
|
||||
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6mn_service_dsmipv6_install(struct Ipmip6mn_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6mn_service_dsmipv6_install(struct Ipmip6mn_context *ctx)
|
||||
{
|
||||
static Ipmip6mn_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6MN_SERVICE_DSMIPV6_NAME;
|
||||
srv.node_data_size = sizeof(Ipmip6mn_service_dsmipv6_node_t);
|
||||
srv.node_config_size = sizeof(Ipmip6mn_service_dsmipv6_config_t);
|
||||
|
||||
srv.config = (Ipmip6mn_extension_config_t)ipmip6mn_service_dsmipv6_config;
|
||||
srv.provide = (Ipmip6mn_extension_provide_t)ipmip6mn_service_dsmipv6_provide;
|
||||
|
||||
/* This is a PMIP only feature */
|
||||
ipmip6mn_context_register_extension(ctx, &srv);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#else /* IPMIP_USE_INET */
|
||||
IP_GLOBAL void ipmip6mn_service_dsmipv6_install(struct Ipmip6mn_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6mn_service_dsmipv6_install(struct Ipmip6mn_context *ctx)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,357 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_service_mpdisc.c,v $ $Revision: 1.6 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_service_mpdisc.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 "ipmip6mn_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 <private/ipmip_cli.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_pkt.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6mn_h.h"
|
||||
#include "ipmip6mn_pktbuf.h"
|
||||
#include "ipmip6mn_coa.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipmip6mn_service_mpdisc_config
|
||||
{
|
||||
Ip_bool save_config;
|
||||
Ip_bool derive_from_config;
|
||||
Ip_u32 derive_from_ifindex;
|
||||
Ip_bool derive_from_interface;
|
||||
} Ipmip6mn_service_mpdisc_config_t;
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6mn_mpdisc_prefix_renumber_if(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6mn_node *node,
|
||||
Ip_u32 ifindex,
|
||||
struct Ip_in6_addr *prefix,
|
||||
Ip_u8 *prefix_len)
|
||||
{
|
||||
Ipmip6_address_t reply;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
|
||||
if (ifindex == 0)
|
||||
return IP_FALSE;
|
||||
|
||||
if (ipmip6_netlink_prefix_generate(&ctx->ipmip6,
|
||||
proc,
|
||||
ifindex,
|
||||
prefix,
|
||||
*prefix_len,
|
||||
&reply))
|
||||
{
|
||||
ipcom_memcpy(prefix, &reply.prefix, sizeof(*prefix));
|
||||
*prefix_len = reply.len;
|
||||
return IP_TRUE;
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmip6mn_mpdisc_prefix_renumber_resolve(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6mn_node *node,
|
||||
Ipmip6mn_service_mpdisc_config_t *rcfg,
|
||||
struct Ip_in6_addr *new_addr,
|
||||
Ip_u8 *new_addr_len)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (rcfg->derive_from_config)
|
||||
{
|
||||
for (i = 0; i < node->mobile_prefix.mobile_prefix_size; i++)
|
||||
{
|
||||
Ipmip6_pkt_nd_opt_prefix_info_t *pinfo = &node->mobile_prefix.mobile_prefix[i];
|
||||
if (IP_BIT_ISSET(pinfo->nd_opt_pi_flags_reserved, IPMIP6_ND_OPT_PI_FLAG_AUTO))
|
||||
{
|
||||
*new_addr_len = pinfo->nd_opt_pi_prefix_len;
|
||||
if (*new_addr_len == node->config->inet6.len)
|
||||
{
|
||||
ipcom_memcpy(new_addr, &node->config->inet6.prefix, sizeof(*new_addr));
|
||||
ipmip6_address_apply_prefix(new_addr, &pinfo->nd_opt_pi_prefix, *new_addr_len);
|
||||
return IP_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rcfg->derive_from_interface)
|
||||
{
|
||||
Ipmip6mn_coa_notify_t *ifn;
|
||||
|
||||
/* Try form a CoA based on explicitly specified interface */
|
||||
if (rcfg->derive_from_ifindex != 0)
|
||||
{
|
||||
for (i = 0; i < node->mobile_prefix.mobile_prefix_size; i++)
|
||||
{
|
||||
Ipmip6_pkt_nd_opt_prefix_info_t *pinfo = &node->mobile_prefix.mobile_prefix[i];
|
||||
if (IP_BIT_ISSET(pinfo->nd_opt_pi_flags_reserved, IPMIP6_ND_OPT_PI_FLAG_AUTO))
|
||||
{
|
||||
*new_addr_len = pinfo->nd_opt_pi_prefix_len;
|
||||
ipcom_memcpy(new_addr, &pinfo->nd_opt_pi_prefix, sizeof(*new_addr));
|
||||
if (ipmip6mn_mpdisc_prefix_renumber_if(ctx, proc, node, rcfg->derive_from_ifindex, new_addr, new_addr_len))
|
||||
return IP_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Try form an address based on current CoA interface */
|
||||
for (i = 0; i < node->mobile_prefix.mobile_prefix_size; i++)
|
||||
{
|
||||
Ipmip6_pkt_nd_opt_prefix_info_t *pinfo = &node->mobile_prefix.mobile_prefix[i];
|
||||
if (IP_BIT_ISSET(pinfo->nd_opt_pi_flags_reserved, IPMIP6_ND_OPT_PI_FLAG_AUTO))
|
||||
{
|
||||
*new_addr_len = pinfo->nd_opt_pi_prefix_len;
|
||||
ipcom_memcpy(new_addr, &pinfo->nd_opt_pi_prefix, sizeof(*new_addr));
|
||||
if (ipmip6mn_mpdisc_prefix_renumber_if(ctx, proc, node, node->ha.coa->ifn->ipmip6.ifp->iff.ifindex, new_addr, new_addr_len))
|
||||
return IP_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Go through the interfaces; select the best we'll get */
|
||||
for (ifn = IPCOM_LIST_FIRST(&node->config->ifs); ifn != IP_NULL; ifn = IPCOM_LIST_NEXT(&ifn->next))
|
||||
{
|
||||
if (ifn != node->ha.coa->ifn && ifn->ipmip6.ifp->iff_down == IP_FALSE)
|
||||
{
|
||||
/* Try form an address based on current CoA interface */
|
||||
for (i = 0; i < node->mobile_prefix.mobile_prefix_size; i++)
|
||||
{
|
||||
Ipmip6_pkt_nd_opt_prefix_info_t *pinfo = &node->mobile_prefix.mobile_prefix[i];
|
||||
if (IP_BIT_ISSET(pinfo->nd_opt_pi_flags_reserved, IPMIP6_ND_OPT_PI_FLAG_AUTO))
|
||||
{
|
||||
*new_addr_len = pinfo->nd_opt_pi_prefix_len;
|
||||
ipcom_memcpy(new_addr, &pinfo->nd_opt_pi_prefix, sizeof(*new_addr));
|
||||
if (ipmip6mn_mpdisc_prefix_renumber_if(ctx, proc, node, ifn->ipmip6.ifp->iff.ifindex, new_addr, new_addr_len))
|
||||
return IP_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6mn_service_mpdisc_provide(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_mpdisc_config_t *priv_cfg,
|
||||
void *node_data,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(node_data);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
|
||||
if (action == IPMIP_CALLBACK_ENABLE)
|
||||
{
|
||||
struct Ip_in6_addr new_addr;
|
||||
Ip_u8 new_addr_len;
|
||||
|
||||
if (ipmip6mn_mpdisc_prefix_renumber_resolve(ctx, proc, node, priv_cfg, &new_addr, &new_addr_len))
|
||||
{
|
||||
if (priv_cfg->save_config)
|
||||
{
|
||||
ipcom_snprintf(proc->ntop.ntop_pbuf, sizeof(proc->ntop.ntop_pbuf), "%s/%d", ipmip_ntop_inet6(proc, &new_addr, IP_NULL), new_addr_len);
|
||||
ipmip_sysvar_set(proc->ntop.ntop_pbuf, "ipmip6mn.%s.homeaddress", node->name);
|
||||
}
|
||||
|
||||
/* Do renumber */
|
||||
ipmip6mn_node_renumber(ctx, proc, node, &new_addr, new_addr_len);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE)
|
||||
{
|
||||
/* Currently no action */
|
||||
}
|
||||
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_mpdisc_config(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_mpdisc_config_t *priv_cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
char *ifname = ipmip_sysvar("ipmip6mn.%s.mobile_prefix.renumber.derive_from_interface", node->name);
|
||||
|
||||
priv_cfg->derive_from_config = ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_prefix.renumber.derive_from_configured", node->name);
|
||||
if (ifname)
|
||||
{
|
||||
priv_cfg->derive_from_ifindex = ipcom_if_nametoindex(ifname);
|
||||
if (priv_cfg->derive_from_ifindex == 0)
|
||||
{
|
||||
int op_val = ipmip_sysvar_cmd_str_to_key(ipmip_sysvar_bool_ops, ifname);
|
||||
if (op_val != -1)
|
||||
priv_cfg->derive_from_interface = IP_TRUE;
|
||||
}
|
||||
else
|
||||
priv_cfg->derive_from_interface = IP_TRUE;
|
||||
ipcom_free(ifname);
|
||||
}
|
||||
priv_cfg->save_config = ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_prefix.renumber.save", node->name);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (priv_cfg->derive_from_ifindex)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_prefix.renumber.derive_from_interface=%s",
|
||||
node->name, ipcom_if_indextoname(priv_cfg->derive_from_ifindex, proc->ntop.ntop_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_prefix.renumber.derive_from_interface=%s",
|
||||
node->name, priv_cfg->derive_from_interface? "true" : "false");
|
||||
}
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_prefix.renumber.derive_from_configured=%s",
|
||||
node->name, priv_cfg->derive_from_config? "true" : "false");
|
||||
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_prefix.renumber.save=%s",
|
||||
node->name, priv_cfg->save_config? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6mn_service_mpdisc_install(struct Ipmip6mn_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6mn_service_mpdisc_install(struct Ipmip6mn_context *ctx)
|
||||
{
|
||||
static Ipmip6mn_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6MN_SERVICE_NAME_MPDISC;
|
||||
srv.node_data_size = 0;
|
||||
srv.node_config_size = sizeof(Ipmip6mn_service_mpdisc_config_t);
|
||||
|
||||
srv.config = (Ipmip6mn_extension_config_t)ipmip6mn_service_mpdisc_config;
|
||||
srv.provide = (Ipmip6mn_extension_provide_t)ipmip6mn_service_mpdisc_provide;
|
||||
|
||||
/* This is a PMIP only feature */
|
||||
ipmip6mn_context_register_function_mpdisc(ctx, &srv);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,406 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_service_radvd.c,v $ $Revision: 1.11 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_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 "ipmip6mn_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 <ipnet.h>
|
||||
#include <ipnet_radvd.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_cli.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_pkt.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_netlink.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
|
||||
#include "ipmip6mn_h.h"
|
||||
#include "ipmip6mn_pktbuf.h"
|
||||
#include "ipmip6mn_coa.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPMIP6MN_SERVICE_RADVD_NAME "RADVD"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipmip6mn_service_radvd_config
|
||||
{
|
||||
Ip_bool enabled;
|
||||
Ipnet_radvd_if_data radvd;
|
||||
Ipnet_radvd_if_prefix_data prefix;
|
||||
} Ipmip6mn_service_radvd_config_t;
|
||||
|
||||
typedef struct Ipmip6mn_service_radvd_handle_data
|
||||
{
|
||||
Ipnet_radvd_if_handle radvd;
|
||||
} Ipmip6mn_service_radvd_handle_data_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC int
|
||||
ipmip6mn_service_radvd_provide(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_radvd_config_t *priv_cfg,
|
||||
Ipmip6mn_service_radvd_handle_data_t *handle,
|
||||
struct Ipmip_timer *service)
|
||||
{
|
||||
Ipmip6mn_entry_nemo_t *nemo;
|
||||
unsigned i;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(service);
|
||||
|
||||
if (action == IPMIP_CALLBACK_ENABLE)
|
||||
{
|
||||
if (priv_cfg->enabled)
|
||||
{
|
||||
for (nemo = IPCOM_LIST_FIRST(&node->config->nemo); nemo != IP_NULL; nemo = IPCOM_LIST_NEXT(&nemo->nemo_next))
|
||||
{
|
||||
Ipnet_radvd_if_data radvd;
|
||||
|
||||
ipcom_memcpy(&radvd, &priv_cfg->radvd, sizeof(radvd));
|
||||
ipcom_strcpy(radvd.ifname, nemo->nemo_ingress);
|
||||
|
||||
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 Mobile node %s",
|
||||
node->name));
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipnet_radvd_if_prefix_handle phandle;
|
||||
Ipnet_radvd_if_prefix_data pdata;
|
||||
|
||||
ipcom_memcpy(&pdata, &priv_cfg->prefix, sizeof(pdata));
|
||||
|
||||
/* Do the prefixes */
|
||||
for (i = 0; i < nemo->nemo_prefixes.numelem; i++)
|
||||
{
|
||||
Ipmip6_mh_mo_mobile_prefix_t *mo = (Ipmip6_mh_mo_mobile_prefix_t *)nemo->nemo_prefixes.hdrs[i];
|
||||
|
||||
/* Add prefix by prefix */
|
||||
ipcom_memcpy(&pdata.prefix, &mo->prefix, sizeof(pdata.prefix));
|
||||
pdata.prefixlen = mo->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 Mobile node %s",
|
||||
ipmip_ntop_inet6(proc, &pdata.prefix, IP_NULL),
|
||||
pdata.prefixlen,
|
||||
node->name));
|
||||
}
|
||||
}
|
||||
|
||||
/* Start it */
|
||||
ipnet_radvd_if_start(handle->radvd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_DISABLE)
|
||||
{
|
||||
if (priv_cfg->enabled)
|
||||
{
|
||||
if (handle)
|
||||
ipnet_radvd_if_close(handle->radvd);
|
||||
}
|
||||
}
|
||||
|
||||
return IPMIP_CALLBACK_RET_SUCCESS;
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_radvd_config(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_radvd_config_t *priv_cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
priv_cfg->enabled = ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_router.radvd", node->name);
|
||||
|
||||
priv_cfg->radvd.max_rtr_adv_interval =
|
||||
ipmip_sysvar_u32(600000, "ipmip6mn.%s.mobile_router.radvd.MaxRtrAdvInterval", node->name);
|
||||
|
||||
priv_cfg->radvd.min_rtr_adv_interval =
|
||||
ipmip_sysvar_u32(priv_cfg->radvd.max_rtr_adv_interval / 3, "ipmip6mn.%s.mobile_router.radvd.MinRtrAdvInterval", node->name);
|
||||
|
||||
priv_cfg->radvd.min_delay_between_ras =
|
||||
ipmip_sysvar_u32(IP_MIN(priv_cfg->radvd.min_rtr_adv_interval, 3000), "ipmip6mn.%s.mobile_router.radvd.MinDelayBetweenRAs", node->name);
|
||||
|
||||
priv_cfg->radvd.default_lifetime =
|
||||
ipmip_sysvar_u32(IP_MAX(1000, (3 * priv_cfg->radvd.max_rtr_adv_interval)), "ipmip6mn.%s.mobile_router.radvd.AdvDefaultLifetime", node->name);
|
||||
|
||||
priv_cfg->radvd.link_mtu =
|
||||
ipmip_sysvar_u32(0, "ipmip6mn.%s.mobile_router.radvd.AdvLinkMTU", node->name);
|
||||
|
||||
priv_cfg->radvd.reachable_time =
|
||||
ipmip_sysvar_u32(0, "ipmip6mn.%s.mobile_router.radvd.AdvReachableTime", node->name);
|
||||
|
||||
priv_cfg->radvd.retrans_timer =
|
||||
ipmip_sysvar_ulong(0, "ipmip6mn.%s.mobile_router.radvd.AdvRetransTimer", node->name);
|
||||
|
||||
priv_cfg->radvd.hoplimit =
|
||||
(Ip_u8)ipmip_sysvar_ulong(64, "ipmip6mn.%s.mobile_router.radvd.AdvCurHopLimit", node->name);
|
||||
|
||||
priv_cfg->radvd.managed =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_router.radvd.AdvManagedFlag", node->name);
|
||||
|
||||
priv_cfg->radvd.other_config =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_router.radvd.AdvOtherConfigFlag", node->name);
|
||||
|
||||
priv_cfg->radvd.home_agent =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentFlag", node->name);
|
||||
|
||||
priv_cfg->radvd.adv_interval_opt =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_router.radvd.AdvIntervalOpt", node->name);
|
||||
|
||||
priv_cfg->radvd.adv_home_agent_opt =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentOpt", node->name);
|
||||
|
||||
priv_cfg->radvd.adv_home_agent_opt_lifetime =
|
||||
ipmip_sysvar_u32(0, "ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentOptLifetime", node->name);
|
||||
|
||||
priv_cfg->radvd.adv_home_agent_opt_preference =
|
||||
ipmip_sysvar_u32(0, "ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentOptPreference", node->name);
|
||||
|
||||
|
||||
/* Do prefix */
|
||||
|
||||
priv_cfg->prefix.valid_lifetime =
|
||||
ipmip_sysvar_u32(2592000, "ipmip6mn.%s.mobile_router.radvd.prefix.AdvValidLifetime", node->name);
|
||||
|
||||
priv_cfg->prefix.preferred_lifetime =
|
||||
ipmip_sysvar_u32(604800, "ipmip6mn.%s.mobile_router.radvd.prefix.AdvPreferredLifetime", node->name);
|
||||
|
||||
priv_cfg->prefix.on_link =
|
||||
ipmip_sysvar_bool(IP_TRUE, "ipmip6mn.%s.mobile_router.radvd.prefix.AdvOnLinkFlag", node->name);
|
||||
|
||||
priv_cfg->prefix.autonomous =
|
||||
ipmip_sysvar_bool(IP_TRUE, "ipmip6mn.%s.mobile_router.radvd.prefix.AdvAutonomousFlag", node->name);
|
||||
|
||||
priv_cfg->prefix.router_address =
|
||||
ipmip_sysvar_bool(IP_FALSE, "ipmip6mn.%s.mobile_router.radvd.prefix.AdvRouterAddressFlag", node->name);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd=%s",
|
||||
node->name, priv_cfg->enabled? "enabled" : "disabled");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.MaxRtrAdvInterval=%u",
|
||||
node->name, priv_cfg->radvd.max_rtr_adv_interval);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.MinRtrAdvInterval=%u",
|
||||
node->name, priv_cfg->radvd.min_rtr_adv_interval);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.MinDelayBetweenRAs=%u",
|
||||
node->name, priv_cfg->radvd.min_delay_between_ras);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvDefaultLifetime=%u",
|
||||
node->name, priv_cfg->radvd.default_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvLinkMTU=%u",
|
||||
node->name, priv_cfg->radvd.link_mtu);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvReachableTime=%u",
|
||||
node->name, priv_cfg->radvd.reachable_time);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvRetransTimer=%u",
|
||||
node->name, priv_cfg->radvd.retrans_timer);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvCurHopLimit=%u",
|
||||
node->name, priv_cfg->radvd.hoplimit);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvManagedFlag=%s",
|
||||
node->name, priv_cfg->radvd.managed? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvOtherConfigFlag=%s",
|
||||
node->name, priv_cfg->radvd.other_config? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentFlag=%s",
|
||||
node->name, priv_cfg->radvd.home_agent? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvIntervalOpt=%s",
|
||||
node->name, priv_cfg->radvd.adv_interval_opt? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentOpt=%s",
|
||||
node->name, priv_cfg->radvd.adv_home_agent_opt? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentOptLifetime=%u",
|
||||
node->name, priv_cfg->radvd.adv_home_agent_opt_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.AdvHomeAgentOptPreference=%u",
|
||||
node->name, priv_cfg->radvd.adv_home_agent_opt_preference);
|
||||
|
||||
/* Do prefix */
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.prefix.AdvValidLifetime=%u",
|
||||
node->name, priv_cfg->prefix.valid_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.prefix.AdvPreferredLifetime=%u",
|
||||
node->name, priv_cfg->prefix.preferred_lifetime);
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.prefix.AdvOnLinkFlag=%s",
|
||||
node->name, priv_cfg->prefix.on_link? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.prefix.AdvAutonomousFlag=%s",
|
||||
node->name, priv_cfg->prefix.autonomous? "true" : "false");
|
||||
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.mobile_router.radvd.prefix.AdvRouterAddressFlag=%s",
|
||||
node->name, priv_cfg->prefix.router_address? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6mn_service_radvd_install(struct Ipmip6mn_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6mn_service_radvd_install(struct Ipmip6mn_context *ctx)
|
||||
{
|
||||
static Ipmip6mn_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6MN_SERVICE_RADVD_NAME;
|
||||
srv.node_data_size = sizeof(Ipmip6mn_service_radvd_handle_data_t);
|
||||
srv.node_config_size = sizeof(Ipmip6mn_service_radvd_config_t);
|
||||
|
||||
srv.config = (Ipmip6mn_extension_config_t)ipmip6mn_service_radvd_config;
|
||||
srv.provide = (Ipmip6mn_extension_provide_t)ipmip6mn_service_radvd_provide;
|
||||
|
||||
/* This is a PMIP only feature */
|
||||
ipmip6mn_context_register_extension(ctx, &srv);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,215 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_service_selection.c,v $ $Revision: 1.5 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_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 "ipmip6mn_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_strlib.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_context.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_netlink.h>
|
||||
#include <private/ipmip_dhcp.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_pkt.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
#include <private/ipmip6_sysext.h>
|
||||
|
||||
#include "ipmip6mn_h.h"
|
||||
#include "ipmip6mn_pktbuf.h"
|
||||
#include "ipmip6mn_bc.h"
|
||||
#include "ipmip6mn_mh.h"
|
||||
#include "ipmip6mn_mh_ha.h"
|
||||
#include "ipmip6mn_mib_update.h"
|
||||
#include "ipmip6mn_route.h"
|
||||
#include "ipmip6mn_attr_h.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6MN_SERVICE_SELECTION_NAME "service-selection"
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipmip6mn_service_selection_config
|
||||
{
|
||||
Ipmip6_mh_mo_service_selection_mobility_option_t *selection;
|
||||
} Ipmip6mn_service_selection_config_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_selection_request_apply(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_selection_config_t *priv_cfg,
|
||||
void *node_data,
|
||||
struct Ipmip6mn_pktbuf *pbuf,
|
||||
struct Ipmip6_bc *bc)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(node_data);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
|
||||
if (priv_cfg->selection != IP_NULL)
|
||||
{
|
||||
/* This BC is not yet registered? */
|
||||
if (bc->mip6MnBLTable.mip6MnBLAccepted == IP_FALSE)
|
||||
{
|
||||
IPMIP6_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&ctx->ipmip6.ipmip,
|
||||
proc,
|
||||
"%s requesting service selection '%s'",
|
||||
node->name,
|
||||
(char *)&priv_cfg->selection->identifier[0]));
|
||||
|
||||
ipmip6_mh_pkt_opt_add_mo(&ctx->ipmip6,
|
||||
proc,
|
||||
&pbuf->ipmip6,
|
||||
&priv_cfg->selection->hdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_selection_config(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_service_selection_config_t *priv_cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
priv_cfg->selection = ipmip6_sysext_service_selection("ipmip6mn.%s.service_selection", node->name);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
if (priv_cfg->selection)
|
||||
ipcom_free(priv_cfg->selection);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
if (priv_cfg->selection)
|
||||
{
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmip6mn.%s.service_selection=%s",
|
||||
node->name, (char *)&priv_cfg->selection->identifier[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6mn_service_selection_install(struct Ipmip6mn_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6mn_service_selection_install(struct Ipmip6mn_context *ctx)
|
||||
{
|
||||
static Ipmip6mn_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6MN_SERVICE_SELECTION_NAME;
|
||||
srv.node_config_size = sizeof(Ipmip6mn_service_selection_config_t);
|
||||
|
||||
srv.config = (Ipmip6mn_extension_config_t)ipmip6mn_service_selection_config;
|
||||
srv.pkt_req_apply = (Ipmip6mn_extension_req_apply_t)ipmip6mn_service_selection_request_apply;
|
||||
|
||||
/* This is a PMIP only feature */
|
||||
ipmip6mn_context_register_extension(ctx, &srv);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,313 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_service_vendor_extension.c,v $ $Revision: 1.4 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_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 "ipmip6mn_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_strlib.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_context.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_util.h>
|
||||
#include <private/ipmip_netlink.h>
|
||||
#include <private/ipmip_dhcp.h>
|
||||
|
||||
#include <ipmip6.h>
|
||||
#include <private/ipmip6_pkt.h>
|
||||
#include <private/ipmip6_context.h>
|
||||
#include <private/ipmip6_util.h>
|
||||
#include <private/ipmip6_sysext.h>
|
||||
|
||||
#include "ipmip6mn_h.h"
|
||||
#include "ipmip6mn_pktbuf.h"
|
||||
#include "ipmip6mn_bc.h"
|
||||
#include "ipmip6mn_mh.h"
|
||||
#include "ipmip6mn_mh_ha.h"
|
||||
#include "ipmip6mn_mib_update.h"
|
||||
#include "ipmip6mn_route.h"
|
||||
#include "ipmip6mn_attr_h.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIP6MN_SERVICE_VENDOR_EXTENSION_NAME "vendor-extension"
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipmip6mn_vendor_extension_config_ext
|
||||
{
|
||||
Ipcom_list next;
|
||||
Ipmip6_mh_mo_vendor_specific_mobility_option_t *mo;
|
||||
} Ipmip6mn_vendor_extension_config_ext_t;
|
||||
|
||||
typedef struct Ipmip6mn_vendor_extension_config
|
||||
{
|
||||
Ipcom_list vext;
|
||||
} Ipmip6mn_vendor_extension_config_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_vendor_extension_request_apply(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_vendor_extension_config_t *priv_cfg,
|
||||
void *node_data,
|
||||
struct Ipmip6mn_pktbuf *pbuf,
|
||||
struct Ipmip6_bc *bc)
|
||||
{
|
||||
Ipmip6mn_vendor_extension_config_ext_t *nmo;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(node_data);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(bc);
|
||||
|
||||
for (nmo = IPCOM_LIST_FIRST(&priv_cfg->vext); 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 Ip_bool
|
||||
ipmip6mn_service_vendor_extension_rep_accept(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_vendor_extension_config_t *priv_cfg,
|
||||
void *node_data,
|
||||
struct Ipmip6mn_pktbuf *pbuf,
|
||||
Ipmip_timer_t *service)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(node_data);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
IPMIP_UNUSED_PARAMETER(priv_cfg);
|
||||
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",
|
||||
node->name,
|
||||
IP_GET_NTOHL(&mo->vendor_id), mo->sub_type));
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't delay */
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_vendor_extension_foreach(struct Ipmip_proc *proc,
|
||||
char *name,
|
||||
char *subkey,
|
||||
const char *value,
|
||||
Ipmip6mn_vendor_extension_config_t *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 = (Ip_u8)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)
|
||||
{
|
||||
Ipmip6mn_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->vext, &nmo->next);
|
||||
ipcom_free(vp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmip6mn_service_vendor_extension_config(struct Ipmip6mn_context *ctx,
|
||||
struct Ipmip_proc *proc,
|
||||
int action,
|
||||
struct Ipmip6mn_node *node,
|
||||
struct Ipmip6mn_node_config *cfg,
|
||||
Ipmip6mn_vendor_extension_config_t *priv_cfg,
|
||||
Ipmip_cli_message_t *request)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(ctx);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(cfg);
|
||||
|
||||
if (action == IPMIP_CALLBACK_CONFIG_READ)
|
||||
{
|
||||
ipcom_list_init(&priv_cfg->vext);
|
||||
ipmip_sysvar_foreach(proc,
|
||||
(Ipmip_sysvar_foreach_t) ipmip6mn_service_vendor_extension_foreach,
|
||||
priv_cfg,
|
||||
"ipmip6mn.%s.vendor_extension.*", node->name);
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_FREE)
|
||||
{
|
||||
Ipmip6mn_vendor_extension_config_ext_t *nmo;
|
||||
while ((nmo = IPCOM_LIST_FIRST(&priv_cfg->vext)) != IP_NULL)
|
||||
{
|
||||
ipcom_list_remove(&nmo->next);
|
||||
ipcom_free(nmo->mo);
|
||||
ipcom_free(nmo);
|
||||
}
|
||||
}
|
||||
else if (action == IPMIP_CALLBACK_CONFIG_DUMP)
|
||||
{
|
||||
Ipmip6mn_vendor_extension_config_ext_t *nmo;
|
||||
for (nmo = IPCOM_LIST_FIRST(&priv_cfg->vext); 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),
|
||||
"ipmip6mn.%s.vendor_extension.%u.%u=",
|
||||
node->name, 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) - (unsigned int)off,
|
||||
"%s0x%02x", i > 0? "," : "", data[i]);
|
||||
ipmip_cli_config_printf(&request->message, proc->ntop.ntop_pbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void ipmip6mn_service_vendor_extension_install(struct Ipmip6mn_context *ctx);
|
||||
IP_GLOBAL void
|
||||
ipmip6mn_service_vendor_extension_install(struct Ipmip6mn_context *ctx)
|
||||
{
|
||||
static Ipmip6mn_extension_t srv;
|
||||
|
||||
srv.name = IPMIP6MN_SERVICE_VENDOR_EXTENSION_NAME;
|
||||
srv.node_config_size = sizeof(Ipmip6mn_vendor_extension_config_t);
|
||||
|
||||
srv.config = (Ipmip6mn_extension_config_t)ipmip6mn_service_vendor_extension_config;
|
||||
srv.pkt_req_apply = (Ipmip6mn_extension_req_apply_t)ipmip6mn_service_vendor_extension_request_apply;
|
||||
srv.pkt_rep_accept = (Ipmip6mn_extension_rep_accept_t)ipmip6mn_service_vendor_extension_rep_accept;
|
||||
|
||||
/* This is a PMIP only feature */
|
||||
ipmip6mn_context_register_extension(ctx, &srv);
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
Reference in New Issue
Block a user