157 lines
4.9 KiB
C
157 lines
4.9 KiB
C
/* ipmacsec_config.c - IPMACSEC vxWorks specific configuration applet */
|
|
/*
|
|
* Copyright (c) 2010 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify, or otherwise make use
|
|
* of this software may be licensed only pursuant to the terms
|
|
* of an applicable Wind River license agreement.
|
|
*
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
--------------------
|
|
01a,08feb10,mry Created
|
|
*/
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include <ipcom_cstyle.h>
|
|
#include <ipcom_clib.h>
|
|
#include <ipcom_err.h>
|
|
#include <ipcom_sysvar.h>
|
|
#include <ipcom_syslog.h>
|
|
|
|
|
|
#include "ipmacsec_sysvar.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#if !defined(IPMACSEC_LOG_LEVEL) && !defined(IP_WB_BUILD)
|
|
#define IPMACSEC_LOG_LEVEL IPCOM_LOG_ERR
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 EXTERN PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifdef INCLUDE_IPMACSEC_CMD
|
|
IP_GLOBAL Ip_err ipmacsec_cmd_init(void);
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 LOCAL PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
IP_PUBLIC Ip_err ipmacsec_configure(void);
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 7 DATA
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* MACsec sysvars and their default values assigned from the kernel configurator */
|
|
IP_CONST Ipcom_sysvar ipmacsec_conf_sysvar[] =
|
|
{
|
|
#if defined(INCLUDE_IPMACSEC) || defined(IPMACSEC)
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_ENABLE, "0", IPMACSEC_SECY_ENABLE),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_INTERFACES, "", IPMACSEC_SECY_INTERFACES),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_PROTECTFRAMES, "1", IPMACSEC_SECY_PROTECTFRAMES),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_ALWAYSINCSCI, "0", IPMACSEC_SECY_ALWAYSINCSCI),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_USE_ES, "0", IPMACSEC_SECY_USE_ES),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_USE_SCB, "0", IPMACSEC_SECY_USE_SCB),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_CONFIDENTIALITY, "0", IPMACSEC_SECY_CONFIDENTIALITY),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_CONFIDENTIALITYOFF,
|
|
"0", IPMACSEC_SECY_CONFIDENTIALITY_OFFSET),
|
|
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_VALIDATEFRAMES, "Strict", IPMACSEC_SECY_VALIDATEFRAMES),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_REPLAYPROTECT, "1", IPMACSEC_SECY_REPLAYPROTECT),
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_SECY_REPLAYWINDOW, "0", IPMACSEC_SECY_REPLAYWINDOW),
|
|
|
|
IP_SYSVAR(IPMACSEC_SYSVAR_GCMAES_ACCEL_LEVEL, "4", IPMACSEC_GCMAES_ACCEL_LEVEL),
|
|
#endif
|
|
{ IP_NULL, IP_NULL}
|
|
};
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 8 STATIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 9 GLOBAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 10 PUBLIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipmacsec_configure
|
|
*===========================================================================
|
|
* Description: Configures the ipmacsec runtime syslog level and initializes
|
|
* it sysvars. Also calls the function to register the macsec
|
|
* commands if INCLUDE_IPMACSEC_CMD is selected.
|
|
* Parameters:
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err
|
|
ipmacsec_configure(void)
|
|
{
|
|
Ip_err rc = IPCOM_SUCCESS;
|
|
|
|
(void)ipcom_sysvar_setv(ipmacsec_conf_sysvar, 0);
|
|
|
|
ipcom_openlog(IP_NULL, 0, IPCOM_LOG_IPMACSEC);
|
|
(void)ipcom_setlogmask_on(IPMACSEC_LOG_LEVEL, IPCOM_LOG_IPMACSEC);
|
|
|
|
|
|
#ifdef INCLUDE_IPMACSEC_CMD
|
|
rc = ipmacsec_cmd_init();
|
|
#endif
|
|
|
|
return rc;
|
|
}
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|
|
|