192 lines
6.7 KiB
C
192 lines
6.7 KiB
C
|
|
/*
|
|
******************************************************************************
|
|
* INTERPEAK SOURCE FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_vendor_ext.c,v $ $Revision: 1.5 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmip4/config/ipmip4_vendor_ext.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 "ipmip4_config.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#define IPCOM_USE_CLIB_PROTO
|
|
#include <ipcom_clib.h>
|
|
#include <ipcom_drv_eth_filter.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_sysctl.h>
|
|
#include <ipcom_syslog.h>
|
|
#include <ipcom_netif.h>
|
|
#include <ipcom_sysvar.h>
|
|
|
|
#include "ipmip4.h"
|
|
#include <private/ipmip4_msgext.h>
|
|
#include <private/ipmip4_util.h>
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 EXTERN PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 7 LOCAL PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 8 DATA
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 9 STATIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 10 GLOBAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipmip4_vendor_ext_parse_cisco
|
|
*===========================================================================
|
|
* Description: Parse a cisco extension.
|
|
* Parameters: mobile - The mobile structure to store the result in.
|
|
* uhdr - The UHDR
|
|
* Returns: IPMIP4_REG_EXT_SUCCESS on succes, IPMIP4_REG_EXT_UNKNOWN if
|
|
* not known; other error code if failed.
|
|
*
|
|
*/
|
|
IP_GLOBAL int
|
|
ipmip4_vendor_ext_parse_cisco(struct Ipmip4_msgext_mobile *mobile,
|
|
union Ipmip4_msgext_uhdr *uhdr)
|
|
{
|
|
Ipmip4_nvse_t *nvse;
|
|
|
|
/* There are no CISCO CVSE's */
|
|
if (IPMIP4_MSGEXT_UHDR_TYPE(uhdr) == IPMIP4_EXT_TYPE_CVSE)
|
|
return IPMIP4_REG_EXT_UNKNOWN_VSE;
|
|
|
|
/* Get the NVSE data */
|
|
nvse = (Ipmip4_nvse_t *)IPMIP4_MSGEXT_SHDR_EXT_DATA(uhdr);
|
|
switch (IP_GET_NTOHS(nvse->vendor_type))
|
|
{
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF:
|
|
/* Must be the NVSE header + 2 byte subtype minimum */
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 2)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
switch (IP_GET_HTONS(IPMIP4_MSGEXT_NVSE_EXT_DATA(uhdr)))
|
|
{
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_REQ:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 4)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.cfg_req = uhdr;
|
|
break;
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_PREFIXLEN:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 4)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.prefixlen = uhdr;
|
|
break;
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_DNS_SERVER:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 10)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.dns_server = uhdr;
|
|
break;
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_DHCP_SERVER:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 6)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.dhcp_server = uhdr;
|
|
break;
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_DHCP_CID:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 4)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.dhcp_cid = uhdr;
|
|
break;
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_DEFAULT_GW:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 6)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.default_gw = uhdr;
|
|
break;
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_DNS_SUFFIX:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 3)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.dns_suffix = uhdr;
|
|
break;
|
|
case IPMIP4_VENDOR_EXT_MSGEXT_CISCO_HOSTCONF_CONFIG_URL:
|
|
if (IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) < 2)
|
|
return IPMIP4_REG_EXT_POORLY_FORMED;
|
|
mobile->vendor.cisco.config_url = uhdr;
|
|
break;
|
|
default:
|
|
return IPMIP4_REG_EXT_UNKNOWN_VSE;
|
|
}
|
|
break;
|
|
default:
|
|
return IPMIP4_REG_EXT_UNKNOWN_VSE;
|
|
}
|
|
|
|
return IPMIP4_REG_EXT_SUCCESS;
|
|
}
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 11 PUBLIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|