1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166 |
- // /*****************************************************************
- // *****************************************************************
- // *** **
- // *** (C)Copyright 2005-2006, American Megatrends Inc. **
- // *** **
- // *** All Rights Reserved. **
- // *** **
- // *** 6145-F, Northbelt Parkway, Norcross, **
- // *** **
- // *** Georgia - 30071, USA. Phone-(770)-246-8600. **
- // *** **
- // *****************************************************************
- // ******************************************************************
- // *
- // * lanconfig.c
- // * Lan Configuration functions.
- // *
- // * Author: Bakka Ravinder Reddy <bakkar@ami.com>
- // *
- // ******************************************************************/
- // #define ENABLE_DEBUG_MACROS 0
- // #include "IPMIConf.h"
- // #include "LANConfig.h"
- // #include "MsgHndlr.h"
- // #include "Debug.h"
- // #include "Support.h"
- // #include "IPMI_LANConfig.h"
- // #include "PMConfig.h"
- // #include "SharedMem.h"
- // #include "IPMIDefs.h"
- // #include "NVRAccess.h"
- // #include "Util.h"
- // #include "Session.h"
- // #include "WDT.h"
- // #include "LANIfc.h"
- // #include "AppDevice.h"
- // #include "RMCP+.h"
- // #include "IPMI_Main.h"
- // #include "IPMI_LANConfig.h"
- // #include "nwcfg.h"
- // #include "PendTask.h"
- // #include "Ciphertable.h"
- // #include "Ethaddr.h"
- // #include "sendarp.h"
- // #include "PDKAccess.h"
- // #include "Message.h"
- // #include <linux/if.h>
- // #include "Badpasswd.h"
- // #include "libncsiconf.h"
- // #include <linux/ip.h>
- // #include <dlfcn.h>
- // #include <sys/prctl.h>
- // #include "featuredef.h"
- // #include <flashlib.h>
- // #include <libphyconf.h>
- // #include "safesystem.h"
- // /* Reserved bit macro definitions */
- // #define RESERVED_BITS_SUSPENDBMCARPS 0xF0 //(BIT7 | BIT6 | BIT5 | BIT4)
- // #define RESERVED_BITS_GETIPUDPRMCPSTATS_CH 0xF0 //(BIT7 | BIT6 | BIT5 | BIT4)
- // #define RESERVED_BITS_GETIPUDPRMCPSTATS_CLRSTATE 0xFE //(BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1)
- // /*** Local definitions ***/
- // #define CHANNEL_ID_MASK 0x0f
- // #define SET_IN_PROGRESS_MASK 0x03
- // #define PARAMETER_REVISION_MASK 0x0f
- // #define DEST_ADDR_DATA2_ADDR_FORMAT_MASK 0xf0
- // #define PARAMETER_REVISION_FORMAT 0x11
- // #define GET_PARAMETER_REVISION_MASK 0x80
- // #define LAN_CALLBACK_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
- // #define LAN_USER_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
- // #define LAN_OPERATOR_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
- // #define LAN_ADMIN_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
- // #define BRD_CAST_BIT_MASK 0xFF
- // #define LOOP_BACK_BIT_MASK 0x7F
- // #define SUBNET_MASK_BIT_CHECK 0x80
- // #define LAN_CONFIGURATION_SET_IN_PROGRESS 0x01
- // #define LAN_CONFIGURATION_SET_COMPLETE 0x00
- // #define GRATIUTOUS_ENABLE_MASK 1
- // #define ENABLE_ARP_RESPONSES 2
- // #define SUSPEND_ARP_RSVD_BIT_MASK 0xFC
- // #define ENABLE_ARPS 0x03
- // #define SUSPEND_GRAT_ARP 0x01
- // #define SUSPEND_ARP 0x02
- // #define ARP_IGNORE_ON 8
- // #define ARP_IGNORE_OFF 0
- // /* Reserved Bits */
- // #define RESERVED_VALUE_70 0x70
- // #define RESERVED_VALUE_F0 0xF0
- // /**
- // *@fn NwInterfacePresenceCheck
- // *@brief This function is invoked to check network interface presence
- // *@param Interface - Char Pointer to buffer for which interface to check
- // */
- // static int NwInterfacePresenceCheck (char * Interface);
- // /*** Module Variables ***/
- // //_FAR_ INT8U m_ArpSuspendReq;
- // char **explode(char separator, char *string);
- // int IPAddrCheck(INT8U *Addr,int params);
- // extern int GetLanAMIParamValue (INT8U* ParamSelect, INT8U* ImpType);
- // extern IfcName_T Ifcnametable[MAX_LAN_CHANNELS];
- // #define MAX_LAN_PARAMS_DATA 20
- // typedef struct
- // {
- // INT8U Params;
- // INT8U ReservedBits [MAX_LAN_PARAMS_DATA];
- // INT8U DataLen;
- // } LANCfgRsvdBits_T;
- // static LANCfgRsvdBits_T m_RsvdBitsCheck [] = {
- // /* Param Reserved Bits Data Size */
- // { 0, { 0xFC }, 0x1 }, /* Set In progress */
- // { 1, { 0xC8 }, 0x1 }, /* Authenication type */
- // { 2, { 0xC8,0xC8,0xC8,0xC8,0xC8 }, 0x5}, /* Authenication Support Enable */
- // { 4, { 0xF0 }, 0x1 }, /* l */
- // { 7, { 0x0,0x1F,0x01 }, 0x3 }, /* l */
- // { 0xA, { 0xFC }, 0x1 }, /* l */
- // { 0x11, { 0xF0 }, 0x1 }, /* l */
- // { 0x12, { 0xF0,0x78,0x0,0xF8 }, 0x4 },
- // { 0x13, { 0xF0,0x0F, 0xFE }, 0x3 },
- // { 0x14, { 0x0,0x70}, 0x2 },
- // { 0x15, { 0xF8 }, 0x1 },
- // { 0x16, { 0xE0 }, 0x1 },
- // { 0x17, { 0xFF }, 0x1 },
- // { 0x18, { 0xFF }, 0x1 },
- // { 0x19, { 0xF0,0x0F }, 0x2 },
- // { 0x1A, { 0xFE }, 0x1 }
- // };
- // typedef struct
- // {
- // INT8U OEMParam;
- // INT8U Length;
- // }OEMParameterLength_T;
- // static OEMParameterLength_T m_OEMParamLen [] = {
- // {LAN_PARAMS_AMI_OEM_IPV6_ENABLE, 1 },
- // {LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE, 1 },
- // {LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR, 17 },
- // {LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH, 2},
- // {LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP, 16}
- // };
- // /**
- // * @brief LAN configuration request parameter lengths
- // **/
- // static const INT8U LanconfigParameterLength [] = {
- // 1, /* Set in progress */
- // 1, /* Authentication type support */
- // 5, /* Authentication type enables */
- // 4, /* IP address */
- // 1, /* IP address source */
- // 6, /* MAC address */
- // 4, /* Subnet mask */
- // 3, /* IPv4 header parameters */
- // 2, /* Primary RMCP port number */
- // 2, /* Secondary RMCP port number */
- // 1, /* BMC generated ARP control */
- // 1, /* Gratuitous ARP */
- // 4, /* Default Gateway address */
- // 6, /* Default Gateway MAC address */
- // 4, /* Backup Gateway address */
- // 6, /* Backup Gateway MAC address */
- // 18, /* Community string */
- // 1, /* Number of destinations */
- // 4, /* Destination type */
- // 13, /* Destination address */
- // 2, /* VLAN ID */
- // 1, /* VLAN Priority */
- // 1, /* Cipher suite entry support */
- // 17, /* Cipher suite entries */
- // 9, /* Cipher suite Privilege levels */
- // 4, /* VLAN tags destination address */
- // 6, /* Bad Password Threshold */
- // (9+16) /* IPv6 Destination address */
- // };
- // /* A copy of ip_tos2prio with numeric format in "linux/net/ipv4/route.c" */
- // static const INT8U IP_TOS2PRIO[16] = {
- // 0, /* TC_PRIO_BESTEFFORT, */
- // 1, /* ECN_OR_COST(FILLER), */
- // 0, /* TC_PRIO_BESTEFFORT, */
- // 0, /* ECN_OR_COST(BESTEFFORT), */
- // 2, /* TC_PRIO_BULK, */
- // 2, /* ECN_OR_COST(BULK), */
- // 2, /* TC_PRIO_BULK, */
- // 2, /* ECN_OR_COST(BULK), */
- // 6, /* TC_PRIO_INTERACTIVE, */
- // 6, /* ECN_OR_COST(INTERACTIVE), */
- // 6, /* TC_PRIO_INTERACTIVE, */
- // 6, /* ECN_OR_COST(INTERACTIVE), */
- // 4, /* TC_PRIO_INTERACTIVE_BULK, */
- // 4, /* ECN_OR_COST(INTERACTIVE_BULK),*/
- // 4, /* TC_PRIO_INTERACTIVE_BULK, */
- // 4 /* ECN_OR_COST(INTERACTIVE_BULK) */
- // };
- // static BOOL enableSetMACAddr = FALSE; //jimbo notice
- // /*-------------------------------------------------------
- // * SetLanConfigParam
- // *-------------------------------------------------------*/
- // int
- // SetLanConfigParam (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
- // {
- // _NEAR_ SetLanConfigReq_T* pSetLanReq = (_NEAR_ SetLanConfigReq_T*) pReq;
- // _NEAR_ SetLanConfigRes_T* pSetLanRes = (_NEAR_ SetLanConfigRes_T*) pRes;
- // _FAR_ BMCSharedMem_T* pSharedMem = BMC_GET_SHARED_MEM (BMCInst);
- // _FAR_ ChannelInfo_T* ptrChannelInfo;
- // _FAR_ BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // NWCFG_STRUCT NWConfig;
- // NWCFG6_STRUCT NWConfig6;
- // INT32U GWIp,IPAddr;
- // INT32U Subnetmask;
- // int i,j=0;
- // INT8U IsOemDefined = FALSE;
- // INT8U EthIndex,netindex= 0xFF, currBmcGenArpCtrl;
- // BMCArg *pLANArg=NULL;
- // char VLANInterfaceName [32];
- // INT16U vlanID=0;
- // INT16U InvalidVlanID[3]={0,1,4095};
- // char cmdSetPriority[32];
- // int retValue=0,NIC_Count = 0;
- // INT16U PriorityLevel[MAX_LAN_CHANNELS]= {0};
- // INT8U m_Lan_SetInProgress; /**< Contains setting LAN configuration status */
-
- // ETHCFG_STRUCT PHYCfg;
- // static INT8U macEthIndex = 0xFF;
- // INT8U TOS = 0, SkbPriority = 0; /* For VLAN priority parameter */
- // int pendStatus = PEND_STATUS_COMPLETED;
- // char IfcName[16]; /* Eth interface name */
- // if ( ReqLen >= 2 )
- // {
- // ReqLen -= 2;
- // }
- // else
- // {
- // *pRes = CC_REQ_INV_LEN;
- // return sizeof (INT8U);
- // }
- // if(g_corefeatures.dual_image_support == ENABLED)
- // {
- // if(IsCardInFlashMode())
- // {
- // IPMI_WARNING("Card in Active flash mode, Not safe to set any of LAN configurations...\n");
- // *pRes = CC_DEV_IN_FIRMWARE_UPDATE_MODE;
- // return sizeof (*pRes);
- // }
- // }
- // EthIndex= GetEthIndex(pSetLanReq->ChannelNum & 0x0F, BMCInst);
- // if(0xff == EthIndex)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // memset(IfcName,0,sizeof(IfcName));
- // /*Get the EthIndex*/
- // if(GetIfcName(EthIndex,IfcName, BMCInst) == -1)
- // {
- // TCRIT("Error in Getting Ifc name\n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // for(i=0;i<sizeof(Ifcnametable)/sizeof(IfcName_T);i++)
- // {
- // if(strcmp(Ifcnametable[i].Ifcname,IfcName) == 0)
- // {
- // netindex= Ifcnametable[i].Index;
- // break;
- // }
- // }
- // if(netindex == 0xFF)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
-
- // if((pSetLanReq->ParameterSelect >= MIN_LAN_OEM_CONF_PARAM) &&
- // (pSetLanReq->ParameterSelect <= MAX_LAN_OEM_CONF_PARAM) )
- // {
- // /* Converts OEM parameter value to equivalent AMI parameter value */
- // if (0 != GetLanAMIParamValue (&pSetLanReq->ParameterSelect, &IsOemDefined) )
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // /* Hook for OEM to handle this parameter */
- // if ( (IsOemDefined) && (g_PDKHandle[PDK_SETLANOEMPARAM] != NULL) )
- // {
- // return ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_SETLANOEMPARAM]))(pReq, ReqLen, pRes, BMCInst);
- // }
-
- // }
- // if(0x1b >pSetLanReq->ParameterSelect ) //Max known Lan paramter
- // {
- // if (ReqLen != LanconfigParameterLength [pSetLanReq->ParameterSelect ])
- // {
- // *pRes = CC_REQ_INV_LEN;
- // return sizeof (INT8U);
- // }
- // }
- // /*Check the Request length for OEM parameter*/
- // for(i=0;i<sizeof(m_OEMParamLen)/sizeof(OEMParameterLength_T);i++)
- // {
- // if(m_OEMParamLen[i].OEMParam == pSetLanReq->ParameterSelect)
- // {
- // if(ReqLen != m_OEMParamLen[i].Length)
- // {
- // *pRes = CC_REQ_INV_LEN;
- // return sizeof(INT8U);
- // }
- // }
- // }
- // if(pSetLanReq->ChannelNum & RESERVED_VALUE_F0)
- // {
- // /* Alarm !!! Somebody is trying to set Reseved Bits */
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
-
- // /* Check for Reserved Bits */
- // for (i = 0; i < sizeof (m_RsvdBitsCheck)/ sizeof (m_RsvdBitsCheck[0]); i++)
- // {
- // /* Check if this Parameter Selector needs Reserved bit checking !! */
- // if (m_RsvdBitsCheck[i].Params == pSetLanReq->ParameterSelect)
- // {
- // //IPMI_DBG_PRINT_2 ("Param - %x, DataLen - %x\n", pSetLanReq->ParameterSelect, m_RsvdBitsCheck[i].DataLen);
- // for (j = 0; j < m_RsvdBitsCheck[i].DataLen; j++)
- // {
- // // IPMI_DBG_PRINT_2 ("Cmp %x, %x\n", pReq[2+j], m_RsvdBitsCheck[i].ReservedBits[j]);
- // if ( 0 != (pReq[2+j] & m_RsvdBitsCheck[i].ReservedBits[j]))
- // {
- // /* Alarm !!! Somebody is trying to set Reseved Bits */
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // }
- // }
- // }
- // ptrChannelInfo = getChannelInfo (pSetLanReq->ChannelNum & 0x0F, BMCInst);
- // if(NULL == ptrChannelInfo)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(*pRes);
- // }
-
- // IPMI_DBG_PRINT_1 ("Parameter = %X\n", pSetLanReq->ParameterSelect);
- // if (g_PDKHandle[PDK_BEFORESETLANPARM] != NULL )
- // {
- // retValue = ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_BEFORESETLANPARM]))(pReq, ReqLen, pRes, BMCInst);
- // if(retValue != 0)
- // {
- // return retValue;
- // }
- // }
- // if((pSetLanReq->ParameterSelect == LAN_PARAM_SELECT_DEST_ADDR) ||
- // (pSetLanReq->ParameterSelect == LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR))
- // {
- // /*Destination Address is allowed to configure only if DestType is LAN_PET_TRAP(SNMP alerts types)*/
- // if(pBMCInfo->LANCfs[EthIndex].DestType [pSetLanReq->ConfigData.DestAddr.SetSelect - 1].DestType == LAN_OEM1_ALERT)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // }
- // switch (pSetLanReq->ParameterSelect)
- // {
- // case LAN_PARAM_SET_IN_PROGRESS:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // m_Lan_SetInProgress = BMC_GET_SHARED_MEM(BMCInst)->m_Lan_SetInProgress;
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // /* Commit Write is optional and supported
- // * only if rollback is supported */
- // if ( (GetBits(pSetLanReq->ConfigData.SetInProgress, SET_IN_PROGRESS_MASK) !=
- // LAN_CONFIGURATION_SET_COMPLETE) &&
- // (GetBits(pSetLanReq->ConfigData.SetInProgress, SET_IN_PROGRESS_MASK) !=
- // LAN_CONFIGURATION_SET_IN_PROGRESS) )
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(*pSetLanRes);
- // }
- // else if ((GetBits(m_Lan_SetInProgress, SET_IN_PROGRESS_MASK) ==
- // LAN_CONFIGURATION_SET_IN_PROGRESS) &&
- // (GetBits(pSetLanReq->ConfigData.SetInProgress, SET_IN_PROGRESS_MASK) ==
- // LAN_CONFIGURATION_SET_IN_PROGRESS))
- // {
- // pSetLanRes->CompletionCode = CC_SET_IN_PROGRESS;
- // return sizeof(*pSetLanRes);
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // BMC_GET_SHARED_MEM(BMCInst)->m_Lan_SetInProgress = pSetLanReq->ConfigData.SetInProgress;
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_AUTH_TYPE_SUPPORT:
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // return sizeof(*pRes);
- // case LAN_PARAM_AUTH_TYPE_ENABLES:
- // for(i=0;i<5;i++)
- // {
- // /* Check for Unsupported AuthType */
- // if (pBMCInfo->LANCfs[EthIndex].AuthTypeSupport != (pBMCInfo->LANCfs[EthIndex].AuthTypeSupport |pReq[2+i]))
- // {
- // IPMI_DBG_PRINT_2("\n Alarm !!! Somebody is trying to Unsupported Bit :%d \t%d\n",pReq[2+i],i);
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].AuthTypeEnables,
- // &(pSetLanReq->ConfigData.AuthTypeEnables), sizeof(AuthTypeEnables_T));
- // _fmemcpy (ptrChannelInfo->AuthType,
- // &(pSetLanReq->ConfigData.AuthTypeEnables), sizeof(AuthTypeEnables_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_IP_ADDRESS:
- // pendStatus = GetPendStatus(PEND_OP_SET_IP);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // //we need to do a read in hte pend task and not here
- // // because if pend task is still working on setting the source for example t- by then we would have got the
- // // next command which is ip address and then we would read back DHCP since nwcfg hasnt done its work yet etc. and all hell will breakloose.
- // //nwReadNWCfg (&NWConfig);
- // if(pBMCInfo->LANCfs[EthIndex].IPAddrSrc == DHCP_IP_SOURCE)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // if(memcmp ( NWConfig.IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN ) == 0)
- // {
- // TCRIT("Same IP address, do nothing\n");
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN);
- // break;
- // }
- // if(IPAddrCheck(pSetLanReq->ConfigData.IPAddr,LAN_PARAM_IP_ADDRESS))
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // pendStatus = GetPendStatus(PEND_OP_SET_IP);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // _fmemcpy (NWConfig.IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN);
- // SetPendStatus(PEND_OP_SET_IP,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IP,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN);
- // //nwWriteNWCfg (&NWConfig);
- // break;
- // case LAN_PARAM_IP_ADDRESS_SOURCE:
- // if ((pSetLanReq->ConfigData.IPAddrSrc > BMC_OTHER_SOURCE)
- // ||(pSetLanReq->ConfigData.IPAddrSrc == UNSPECIFIED_IP_SOURCE))
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // if ( pBMCInfo->LANCfs[EthIndex].IPAddrSrc == pSetLanReq->ConfigData.IPAddrSrc )
- // {
- // TCRIT("LAN or VLAN if current SRC is DHCP/Static and incoming SRC is DHCP/Static, do nothing\n");
- // break;
- // }
- // if(!((pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE )))
- // pBMCInfo->LANCfs[EthIndex].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
- // if ( (pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE ) )
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // pBMCInfo->LANCfs[EthIndex].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
- // NWConfig.CfgMethod = pSetLanReq->ConfigData.IPAddrSrc;
- // SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_SOURCE,(INT8U*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // }
- // else if(pSetLanReq->ConfigData.IPAddrSrc == BIOS_IP_SOURCE)
- // {
- // /*Perform OEM action*/
- // if(g_PDKHandle[PDK_BIOSIPSOURCE] != NULL)
- // {
- // retValue = ((int(*)(INT8U))g_PDKHandle[PDK_BIOSIPSOURCE]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
- // if(retValue == 1)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // }
- // else
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // NWConfig.CfgMethod = STATIC_IP_SOURCE;
- // SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_SOURCE, (INT8U*) &NWConfig,sizeof(NWConfig), (pSetLanReq->ChannelNum & CHANNEL_ID_MASK), BMCInst );
- // }
- // }
- // else if(pSetLanReq->ConfigData.IPAddrSrc == BMC_OTHER_SOURCE)
- // {
- // /*Perform OEM action*/
- // if(g_PDKHandle[PDK_BMCOTHERSOURCEIP] != NULL)
- // {
- // retValue = ((int(*)(INT8U))g_PDKHandle[PDK_BMCOTHERSOURCEIP]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
- // if(retValue == 1)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // }
- // else
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // }
- // break;
- // case LAN_PARAM_MAC_ADDRESS:
- // #if 0
- // nwReadNWCfg (&NWConfig);
- // printf ( "The MAC is %x %x %x %x %x %x \n", NWConfig.MAC [0],NWConfig.MAC [1],NWConfig.MAC [2],NWConfig.MAC [3],NWConfig.MAC [4],NWConfig.MAC [5] );
- // _fmemcpy (NWConfig.MAC, pSetLanReq->ConfigData.MACAddr, MAC_ADDR_LEN);
- // printf ( "The MAC is %x %x %x %x %x %x \n", NWConfig.MAC [0],NWConfig.MAC [1],NWConfig.MAC [2],NWConfig.MAC [3],NWConfig.MAC [4],NWConfig.MAC [5] );
- // nwWriteNWCfg (&NWConfig);
- // #else
- // /* According to IPMI 2.0 Specification Revision 3, the MAC address can be read only parameter*/
- // //*pRes = CC_ATTEMPT_TO_SET_RO_PARAM;
- // //return sizeof (*pRes);
- // if (!enableSetMACAddr)
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // else
- // {
- // EnableSetMACAddress_T macAddrEnabled;
- // INT8U InvalidMac[MAC_ADDR_LEN] = {0};
- // if((pSetLanReq->ConfigData.MACAddr[0]& BIT0)|| (memcmp(&InvalidMac,&pSetLanReq->ConfigData.MACAddr,MAC_ADDR_LEN) == 0))
- // {
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
-
- // memset(&macAddrEnabled, 0, sizeof(EnableSetMACAddress_T));
- // macAddrEnabled.EthIndex = macEthIndex;
- // memcpy(&macAddrEnabled.MACAddress, &pSetLanReq->ConfigData.MACAddr, MAC_ADDR_LEN);
-
- // pendStatus = GetPendStatus(PEND_OP_SET_MAC_ADDRESS);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // SetPendStatus(PEND_OP_SET_MAC_ADDRESS, PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_MAC_ADDRESS, (INT8U*)&macAddrEnabled, sizeof(EnableSetMACAddress_T), (pSetLanReq->ChannelNum & 0x0F), BMCInst);
-
- // enableSetMACAddr = FALSE;
- // macEthIndex = 0xFF;
-
- // pSetLanRes->CompletionCode = CC_NORMAL;
- // }
-
- // return sizeof(*pSetLanRes);
- // #endif
- // case LAN_PARAM_SUBNET_MASK:
- // pendStatus = GetPendStatus(PEND_OP_SET_SUBNET);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /*Returning valid completion code in case of attempt to set netmask in DHCP mode */
- // if(pBMCInfo->LANCfs[EthIndex].IPAddrSrc == DHCP_IP_SOURCE)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // if(memcmp ( NWConfig.Mask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN ) == 0)
- // {
- // TCRIT("Same Mask, do nothing\n");
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].SubNetMask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN);
- // break;
- // }
- // if(IPAddrCheck(pSetLanReq->ConfigData.SubNetMask,LAN_PARAM_SUBNET_MASK))
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // _fmemcpy (NWConfig.Mask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN);
- // SetPendStatus(PEND_OP_SET_SUBNET,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_SUBNET,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F) , BMCInst);
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].SubNetMask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN);
- // break;
- // case LAN_PARAM_IPv4_HEADER:
- // pendStatus = GetPendStatus(PEND_OP_SET_IPV4_HEADERS);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // if(!pSetLanReq->ConfigData.Ipv4HdrParam.TimeToLive > 0)
- // {
- // IPMI_DBG_PRINT("The requested IPv4 header(TTL) to set is invalid.\n");
- // *pRes = CC_PARAM_OUT_OF_RANGE;
- // return sizeof(*pRes);
- // }
- // if(pSetLanReq->ConfigData.Ipv4HdrParam.IpHeaderFlags == 0x60) // Flags can be either of the values: DF(0x40) or MF(0x20)
- // {
- // IPMI_DBG_PRINT("The requested IPv4 header(Flags) to set is invalid.\n");
- // *pRes = CC_PARAM_OUT_OF_RANGE;
- // return sizeof(*pRes);
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam,
- // &pSetLanReq->ConfigData.Ipv4HdrParam, sizeof(IPv4HdrParams_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // SetPendStatus(PEND_OP_SET_IPV4_HEADERS,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IPV4_HEADERS, (INT8U*)&(pSetLanReq->ConfigData.Ipv4HdrParam),
- // sizeof(pSetLanReq->ConfigData.Ipv4HdrParam),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
- // break;
- // case LAN_PARAM_PRI_RMCP_PORT:
- // pendStatus = GetPendStatus(PEND_RMCP_PORT_CHANGE);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // pBMCInfo->LANCfs[EthIndex].PrimaryRMCPPort = ipmitoh_u16 (pSetLanReq->ConfigData.PrimaryRMCPPort);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // SetPendStatus(PEND_RMCP_PORT_CHANGE,PEND_STATUS_PENDING);
- // PostPendTask(PEND_RMCP_PORT_CHANGE,(INT8U*)&(pSetLanReq->ConfigData.PrimaryRMCPPort),
- // sizeof(pSetLanReq->ConfigData.PrimaryRMCPPort),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
- // break;
- // case LAN_PARAM_SEC_RMCP_PORT:
- // /* Returning Invalid error message */
- // *pRes = CC_PARAM_NOT_SUPPORTED;
- // return sizeof (INT8U);
- // /*pPMConfig->LANConfig[EthIndex].SecondaryPort = ipmitoh_u16 (pSetLanReq->ConfigData.SecondaryPort);*/
- // break;
- // case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
- // currBmcGenArpCtrl = pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl;
-
- // if(currBmcGenArpCtrl != pSetLanReq->ConfigData.BMCGeneratedARPControl)
- // pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl = pSetLanReq->ConfigData.BMCGeneratedARPControl;
- // if((ENABLE_ARP_RESPONSES & currBmcGenArpCtrl) !=
- // (ENABLE_ARP_RESPONSES & pSetLanReq->ConfigData.BMCGeneratedARPControl))
- // {
- // UpdateArpStatus(EthIndex, BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning, BMCInst);
- // }
- // if(!(GRATIUTOUS_ENABLE_MASK & currBmcGenArpCtrl) &&
- // (GRATIUTOUS_ENABLE_MASK & pSetLanReq->ConfigData.BMCGeneratedARPControl))
- // {
- // /* Create a thread to Send Gratuitous ARP Packet */
- // pLANArg = malloc(sizeof(BMCArg));
- // pLANArg->BMCInst = BMCInst;
- // pLANArg->Len = strlen((char *)&EthIndex);
- // pLANArg->Argument = malloc(pLANArg->Len);
- // memcpy(pLANArg->Argument,(char *)&EthIndex,pLANArg->Len);
-
- // OS_CREATE_THREAD ((void *)GratuitousARPTask,(void *)pLANArg, NULL);
- // }
- // break;
- // case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
- // pBMCInfo->LANCfs[EthIndex].GratitousARPInterval =
- // pSetLanReq->ConfigData.GratitousARPInterval;
- // break;
- // case LAN_PARAM_DEFAULT_GATEWAY_IP:
- // pendStatus = GetPendStatus(PEND_OP_SET_GATEWAY);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // /*Returning valid completion code in case of attempt to set default gateway ip in DHCP mode */
- // if(pBMCInfo->LANCfs[EthIndex].IPAddrSrc == DHCP_IP_SOURCE)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // if(memcmp ( NWConfig.Gateway, pSetLanReq->ConfigData.DefaultGatewayIPAddr, IP_ADDR_LEN ) == 0)
- // {
- // TCRIT("Same Gateway, do nothing\n");
- // _fmemcpy(pBMCInfo->LANCfs[EthIndex].DefaultGatewayIPAddr, pSetLanReq->ConfigData.DefaultGatewayIPAddr,IP_ADDR_LEN);
- // break;
- // }
- // if(IPAddrCheck(pSetLanReq->ConfigData.DefaultGatewayIPAddr,LAN_PARAM_DEFAULT_GATEWAY_IP))
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // _fmemcpy ((INT8U*)&GWIp,pSetLanReq->ConfigData.DefaultGatewayIPAddr, IP_ADDR_LEN);
- // _fmemcpy ((INT8U*)&Subnetmask,&NWConfig.Mask[0],IP_ADDR_LEN);
- // _fmemcpy ((INT8U*)&IPAddr,&NWConfig.IPAddr[0], IP_ADDR_LEN);
- // /* Allowing When the Default Gateway is Zero without validation to clear the Default Gateway */
- // if(GWIp != 0)
- // {
- // _fmemcpy ((INT8U*)&Subnetmask,pBMCInfo->LANCfs[EthIndex].SubNetMask,IP_ADDR_LEN);
- // _fmemcpy ((INT8U*)&IPAddr,pBMCInfo->LANCfs[EthIndex].IPAddr, IP_ADDR_LEN);
- // if((IPAddr & Subnetmask ) != (GWIp & Subnetmask))
- // {
- // IPMI_DBG_PRINT("\n Default GatewayIP to set is not valid \n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // }
- // _fmemcpy (NWConfig.Gateway,pSetLanReq->ConfigData.DefaultGatewayIPAddr, IP_ADDR_LEN);
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy(pBMCInfo->LANCfs[EthIndex].DefaultGatewayIPAddr,
- // pSetLanReq->ConfigData.DefaultGatewayIPAddr,IP_ADDR_LEN);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // SetPendStatus(PEND_OP_SET_GATEWAY,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_GATEWAY,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // break;
- // case LAN_PARAM_DEFAULT_GATEWAY_MAC:
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // return sizeof(*pRes);
- // break;
- // case LAN_PARAM_BACKUP_GATEWAY_IP:
- // nwReadNWCfg_v4_v6( &NWConfig,&NWConfig6, netindex,g_corefeatures.global_ipv6);
- // _fmemcpy ((INT8U*)&GWIp,pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
- // _fmemcpy ((INT8U*)&Subnetmask,&NWConfig.Mask[0],IP_ADDR_LEN);
- // _fmemcpy ((INT8U*)&IPAddr,&NWConfig.IPAddr[0], IP_ADDR_LEN);
- // if(GWIp != 0)
- // {
- // if((IPAddr & Subnetmask ) != (GWIp & Subnetmask))
- // {
- // IPMI_DBG_PRINT("\n Backup GatewayIP to set is not valid \n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,
- // pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
- // nwSetBkupGWyAddr(pSetLanReq->ConfigData.BackupGatewayIPAddr,netindex);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_BACKUP_GATEWAY_MAC:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayMACAddr,
- // pSetLanReq->ConfigData.BackupGatewayMACAddr, MAC_ADDR_LEN);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_COMMUNITY_STRING:
- // if (g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME] != NULL )
- // {
- // if(((int(*)(INT8U *, INT8U,int))(g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME]))(pSetLanReq->ConfigData.CommunityStr,MAX_COMM_STRING_SIZE, BMCInst)==0)
- // break;
- // }
- // OS_THREAD_MUTEX_ACQUIRE(&pBMCInfo->PefConfig.PEFSharedMemMutex, WAIT_INFINITE);
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CommunityStr,
- // pSetLanReq->ConfigData.CommunityStr, MAX_COMM_STRING_SIZE);
- // OS_THREAD_MUTEX_RELEASE(&pBMCInfo->PefConfig.PEFSharedMemMutex);
- // break;
- // case LAN_PARAM_DEST_NUM:
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // return sizeof(INT8U);
- // case LAN_PARAM_SELECT_DEST_TYPE:
- // // if (pSetLanReq->ConfigData.DestType.SetSelect > NUM_LAN_DESTINATION)
- // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
- // {
- // *pRes = CC_PARAM_OUT_OF_RANGE;
- // return sizeof (*pRes);
- // }
- // if (0 == pSetLanReq->ConfigData.DestType.SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pSharedMem->VolLANDestType[EthIndex],
- // &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestType [pSetLanReq->ConfigData.DestType.SetSelect - 1],
- // &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // break;
- // case LAN_PARAM_SELECT_DEST_ADDR:
- // pendStatus = GetPendStatus(PEND_OP_SET_GATEWAY);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // // if (pSetLanReq->ConfigData.DestAddr.SetSelect > NUM_LAN_DESTINATION)
- // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
- // {
- // *pRes = CC_PARAM_OUT_OF_RANGE ;
- // return sizeof (*pRes);
- // }
- // if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pSharedMem->VolLANDest[EthIndex],
- // &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
- // memset(pSharedMem->VolLANv6Dest,0,sizeof(LANDestv6Addr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestAddr [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
- // &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
- // memset( &pBMCInfo->LANCfs[EthIndex].Destv6Addr [pSetLanReq->ConfigData.Destv6Addr.SetSelect -1], 0 ,
- // sizeof(LANDestv6Addr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // /* Setting BackupGw to DefaultGw as per request to send trap */
- // if(pSetLanReq->ConfigData.DestAddr.GateWayUse == 1)
- // {
- // IPMI_DBG_PRINT("Setting Backupgw to Defaultgwip as per Request \n");
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy(NWConfig.Gateway,pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,IP_ADDR_LEN);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // SetPendStatus(PEND_OP_SET_GATEWAY,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_GATEWAY,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
- // }
- // break;
- // case LAN_PARAM_VLAN_ID:
- // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // if((pSetLanReq->ConfigData.VLANID & VLAN_MASK_BIT) == VLAN_MASK_BIT) /* checks for VLAN enable bit*/
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // vlanID = (pSetLanReq->ConfigData.VLANID & 0xfff); /* get the vlan d from the data */
- // for(i=0;i<sizeof(InvalidVlanID)/sizeof(INT16U);i++)
- // {
- // if(InvalidVlanID[i] != vlanID)
- // {
- // continue;
- // }
- // else /*invalid vlan id */
- // {
- // *pRes = CC_INV_DATA_FIELD ;
- // return sizeof (*pRes);
- // }
- // }
- // if ( NWConfig.VLANID != 0) /* checks if vlan id already present */
- // {
- // if(NWConfig.VLANID == vlanID)
- // {
- // TCRIT("Currently configured vlan id and incoming set vlan id are same thus, do nothing\n");
- // break;
- // }
- // memset(IfcName,0,sizeof(IfcName));
- // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
- // {
- // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
- // *pRes = CC_INV_DATA_FIELD ;
- // return sizeof (*pRes);
- // }
- // sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
- // if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
- // }
- // }
- // NWConfig.VLANID=vlanID;
- // SetPendStatus(PEND_OP_SET_VLAN_ID,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_VLAN_ID,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
- // }
- // else /* Vlan Bit is Disabled */
- // {
- // if(NWConfig.VLANID==0) /* Vlan id is disabled */
- // {
- // if((pSetLanReq->ConfigData.VLANID & 0xfff)!=0)
- // {
- // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
- // }
- // if((pSetLanReq->ConfigData.VLANID & 0xfff)==0)
- // {
- // if((pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff)!=0)
- // {
- // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
- // }
- // }
- // }
- // else /* Vlan ID is enable. so deconfigure it */
- // {
- // memset(IfcName,0,sizeof(IfcName));
- // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
- // {
- // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
- // *pRes = CC_INV_DATA_FIELD ;
- // return sizeof (*pRes);
- // }
- // sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
- // if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
- // }
- // pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // //NWConfig.VLANID=0;
- // NWConfig.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPAddrSrc;
- // SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_SOURCE,(INT8U*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
- // }
- // }
- // }
- // else
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof(INT8U);
- // }
- // break;
- // case LAN_PARAM_VLAN_PRIORITY:
- // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
- // {
- // if((pBMCInfo->LANCfs[EthIndex].VLANID & VLAN_MASK_BIT) != VLAN_MASK_BIT) /* checks for VLAN enable bit*/
- // {
- // if(g_corefeatures.vlan_priorityset == ENABLED)
- // {
- // if(pSetLanReq->ConfigData.VLANPriority > 7 )
- // {
- // TCRIT(" VLAN Priority value should be 0-7 \n");
- // *pRes = CC_INV_DATA_FIELD ;
- // return sizeof (*pRes);
- // }
- // if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
- // {
- // return -1;
- // }
- // if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
- // {
- // return -1;
- // }
- // pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
- // }
- // else
- // {
- // TCRIT(" VLAN is not Configured \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (*pRes);
- // }
- // }
- // else
- // {
- // if(pSetLanReq->ConfigData.VLANPriority > 7 )
- // {
- // TCRIT(" VLAN Priority value should be 0-7 \n");
- // *pRes = CC_INV_DATA_FIELD ;
- // return sizeof (*pRes);
- // }
- // if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
- // {
- // return -1;
- // }
- // if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
- // {
- // return -1;
- // }
- // pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
- // vlanID = (pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff);
- // memset(IfcName,0,sizeof(IfcName));
- // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
- // {
- // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(*pRes);
- // }
- // /*vconfig set_egress_map <valninterface> <skb_buffer> <vlan-priority>*/
- // sprintf(cmdSetPriority,"vconfig set_egress_map %s.%d 0 %d",IfcName,vlanID,pSetLanReq->ConfigData.VLANPriority);
- // if(((retValue = safe_system(cmdSetPriority)) < 0))
- // {
- // TCRIT("ERROR %d: Set VLAN Priority failed\n",retValue);
- // }
-
- // /*
- // * Set priority of IPMI commands.
- // * The skb->priority value of IPMI command will be modified by TOS option.
- // * So, use the mapping table to get the current value.
- // */
- // memset(&cmdSetPriority,0,sizeof(cmdSetPriority));
- // TOS = pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam.TypeOfService;
- // SkbPriority = IP_TOS2PRIO[IPTOS_TOS(TOS)>>1];
- // sprintf(cmdSetPriority,"vconfig set_egress_map %s.%d %d %d",IfcName,vlanID,SkbPriority,pSetLanReq->ConfigData.VLANPriority);
- // if(((retValue = safe_system(cmdSetPriority)) < 0))
- // {
- // TCRIT("ERROR %d: Set VLAN IPMI Priority failed\n",retValue);
- // }
- // }
- // }
- // else
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof(INT8U);
- // }
- // break;
- // case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // return sizeof(INT8U);
- // case LAN_PARAM_CIPHER_SUITE_ENTRIES:
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // return sizeof(INT8U);
- // break;
- // case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CipherSuitePrivLevels,
- // pSetLanReq->ConfigData.CipherSuitePrivLevels, MAX_NUM_CIPHER_SUITE_PRIV_LEVELS);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_VLAN_TAGS:
- // if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy(&pSharedMem->VLANDestTag,
- // ((_NEAR_ INT8U*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // if (pSetLanReq->ConfigData.DestAddr.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_OUT_OF_RANGE;
- // return sizeof (INT8U);
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy(&pBMCInfo->LANCfs[EthIndex].VLANDestTags [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
- // ((_NEAR_ INT8U*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // break;
- // case LAN_PARAMS_BAD_PASSWORD_THRESHOLD:
- // ClearUserLockAttempts(LAN_CHANNEL_BADP,BMCInst);
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy(&pBMCInfo->LANCfs[EthIndex].BadPasswd,
- // &pSetLanReq->ConfigData.BadPasswd,sizeof(BadPassword_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
-
- // case LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR:
- // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
- // {
- // TCRIT("Invalid data for SetSelect");
- // *pRes = CC_INV_DATA_FIELD ;
- // return sizeof (*pRes);
- // }
- // /*Validate the IPv6 address*/
- // if(0 != IsValidGlobalIPv6Addr((struct in6_addr*)&pSetLanReq->ConfigData.Destv6Addr.IPAddr))
- // {
- // TCRIT("Invalid Global IPv6 Address\n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // if (0 == pSetLanReq->ConfigData.Destv6Addr.SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pSharedMem->VolLANv6Dest,
- // &pSetLanReq->ConfigData.Destv6Addr, sizeof(LANDestv6Addr_T));
- // memset(pSharedMem->VolLANDest,0,sizeof(LANDestAddr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].Destv6Addr[pSetLanReq->ConfigData.Destv6Addr.SetSelect - 1],
- // &pSetLanReq->ConfigData.Destv6Addr, sizeof(LANDestv6Addr_T));
- // memset(&pBMCInfo->LANCfs[EthIndex].DestAddr[pSetLanReq->ConfigData.DestAddr.SetSelect - 1],0,sizeof(LANDestAddr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // TDBG("\n SetLanconfig: Setting SNMPv6 configuration done..\n");
- // break;
- // case LAN_PARAMS_AMI_OEM_ENABLE_SET_MAC: //194
- // NIC_Count = g_coremacros.global_nic_count;
- // if (ReqLen != 1)
- // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
- // else if (pSetLanReq->ConfigData.EthIndex > ( NIC_Count- 1))
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // enableSetMACAddr = TRUE;
- // macEthIndex = pSetLanReq->ConfigData.EthIndex;
- // pSetLanRes->CompletionCode = CC_NORMAL;
- // }
- // return sizeof(*pSetLanRes);
- // case LAN_PARAMS_AMI_OEM_IPV6_ENABLE:
- // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_ENABLE);
- // if (pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_ENABLE \n");
- // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable == pSetLanReq->ConfigData.IPv6_Enable)
- // {
- // TCRIT("LAN or VLAN - the current state is the same \n");
- // break;
- // }
- // pBMCInfo->LANCfs[EthIndex].IPv6_Enable= pSetLanReq->ConfigData.IPv6_Enable;
-
- // NWConfig6.enable= pSetLanReq->ConfigData.IPv6_Enable;
- // SetPendStatus(PEND_OP_SET_IPV6_ENABLE,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IPV6_ENABLE,(INT8U*) &NWConfig6,sizeof(NWConfig6),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE:
- // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_IP_ADDR_SOURCE);
- // if (pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE \n");
- // /* check for IPv6 enable state */
- // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
- // {
- // TCRIT("IPv6 is not enabled yet... \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // if ((pSetLanReq->ConfigData.IPv6_IPAddrSrc > BMC_OTHER_SOURCE)
- // ||(pSetLanReq->ConfigData.IPv6_IPAddrSrc == UNSPECIFIED_IP_SOURCE))
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // else if((pSetLanReq->ConfigData.IPv6_IPAddrSrc == BIOS_IP_SOURCE)
- // || (pSetLanReq->ConfigData.IPv6_IPAddrSrc == BMC_OTHER_SOURCE))
- // {
- // /* we only support DHCP and Static IP source */
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
-
- // if (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == pSetLanReq->ConfigData.IPv6_IPAddrSrc )
- // {
- // TCRIT("LAN or VLAN if current SRC is DHCP/Static and incoming SRC is DHCP/Static, do nothing\n");
- // break;
- // }
-
- // pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc = pSetLanReq->ConfigData.IPv6_IPAddrSrc ;
- // if ( (pSetLanReq->ConfigData.IPv6_IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPv6_IPAddrSrc == DHCP_IP_SOURCE ) )
- // {
- // NWConfig6.CfgMethod = pSetLanReq->ConfigData.IPv6_IPAddrSrc;
- // SetPendStatus(PEND_OP_SET_IPV6_IP_ADDR_SOURCE,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IPV6_IP_ADDR_SOURCE,(INT8U*) &NWConfig6,sizeof(NWConfig6),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // }
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR:
- // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_IP_ADDR);
- // if (pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR \n");
- // /* check for IPv6 enable state */
- // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
- // {
- // TCRIT("IPv6 is not enabled yet... \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /* Do IP address source check */
- // if( pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
- // {
- // TCRIT("IPv6 Address source is currently in DHCP \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /*Validate the Index value*/
- // if(pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr & 0xF0)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // /*Validate the IPv6 address*/
- // if(0 != IsValidGlobalIPv6Addr((struct in6_addr*)&pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr))
- // {
- // TCRIT("Invalid Global IPv6 Address\n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // /*Validate the duplicate IPv6 Address*/
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // for(i=0;i<MAX_IPV6ADDRS;i++)
- // {
- // /*Use can set the same IPv6 address for same index. To satisfy the WebServer*/
- // if((memcmp(NWConfig6.GlobalIPAddr[i],pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr,IP6_ADDR_LEN) == 0) && pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr != i)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // }
- // _fmemcpy(pBMCInfo->LANCfs[EthIndex].IPv6_IPAddr[pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr], pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, IP6_ADDR_LEN );
-
- // SetPendStatus(PEND_OP_SET_IPV6_IP_ADDR,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IPV6_IP_ADDR, (INT8U*) &pSetLanReq->ConfigData.IPv6Addr,\
- // sizeof (IPv6Addr_T),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH:
- // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_PREFIX_LENGTH);
- // if (pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH \n");
- // /* check for IPv6 enable state */
- // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
- // {
- // TCRIT("IPv6 is not enabled yet... \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /* Do IP address source check */
- // if( pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
- // {
- // TCRIT("IPv6 Address source is currently in DHCP \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /*Validate the Index value*/
- // if(pSetLanReq->ConfigData.IPv6Prefix.IPv6_Prepos & 0xF0)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // pBMCInfo->LANCfs[EthIndex].IPv6_PrefixLen[pSetLanReq->ConfigData.IPv6Prefix.IPv6_Prepos] = pSetLanReq->ConfigData.IPv6Prefix.IPv6_PrefixLen;
-
- // SetPendStatus(PEND_OP_SET_IPV6_PREFIX_LENGTH,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IPV6_PREFIX_LENGTH,(INT8U*) &pSetLanReq->ConfigData.IPv6Prefix, sizeof(IPv6Prefix_T),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP:
- // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_GATEWAY);
- // if (pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
-
- // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP \n");
- // /* check for IPv6 enable state */
- // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
- // {
- // TCRIT("IPv6 is not enabled yet... \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /* Do IP address source check */
- // if( pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
- // {
- // TCRIT("IPv6 Address source is currently in DHCP \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /*Validate the IPv6 address*/
- // if(0 != IsValidGlobalIPv6Addr((struct in6_addr*)&pSetLanReq->ConfigData.IPv6_GatewayIPAddr))
- // {
- // TCRIT("Invalid Global IPv6 Address\n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
-
- // _fmemcpy( pBMCInfo->LANCfs[EthIndex].IPv6_GatewayIPAddr, pSetLanReq->ConfigData.IPv6_GatewayIPAddr, IP6_ADDR_LEN );
-
- // _fmemcpy( NWConfig6.Gateway, pSetLanReq->ConfigData.IPv6_GatewayIPAddr, IP6_ADDR_LEN );
- // SetPendStatus(PEND_OP_SET_IPV6_GATEWAY,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IPV6_GATEWAY,(INT8U*) &NWConfig6,sizeof(NWConfig6),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64:
- // /* The first byte is the index and it should contain atleast one byte of IPv6 address and it cannot exceed 8 bytes incase of EUI-64 algo */
- // if((ReqLen < 2) || (ReqLen > 9))
- // {
- // *pRes = CC_REQ_INV_LEN;
- // return sizeof(INT8U);
- // }
- // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_IP_ADDR);
- // if (pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64 \n");
- // /* Check for IPv6 enabled state */
- // if(pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
- // {
- // TCRIT("IPv6 is not enabled yet... \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof(INT8U);
- // }
- // /* Do IP address source check */
- // if(pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
- // {
- // TCRIT("IPv6 Address source is currently in DHCP \n");
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // /*Validate the Index value*/
- // if(pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr & 0xF0)
- // {
- // TCRIT("Index of the given IPv6 Address is invalid. \n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // /* The request may be of variable length, so fill the network prefix by appending zeros. This is to avoid garbage values */
- // for(i = ReqLen-1; i<8; i++)
- // {
- // pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr[i] = 0;
- // }
- // /* Generate the IPv6 address using EUI-64 algo */
- // if(nwFormIPv6Addr_EUI64((INT8U*) &pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, netindex, g_corefeatures.global_ipv6) != 0)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // /* Get the current network configuration settings */
- // nwReadNWCfg_v4_v6(&NWConfig, &NWConfig6, netindex, g_corefeatures.global_ipv6);
- // /*Validate the duplicate IPv6 Address*/
- // for(i=0; i<MAX_IPV6ADDRS; i++)
- // {
- // /* User can set the same IPv6 address for same index to satisfy the WebServer */
- // if((memcmp(NWConfig6.GlobalIPAddr[i], pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, IP6_ADDR_LEN) == 0) && pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr != i)
- // {
- // TCRIT("\n Error in setting the IPv6 address - Duplicate :( \n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // }
- // _fmemcpy(pBMCInfo->LANCfs[EthIndex].IPv6_IPAddr[pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr], pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, IP6_ADDR_LEN);
- // SetPendStatus(PEND_OP_SET_IPV6_IP_ADDR,PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_IPV6_IP_ADDR, (INT8U*) &pSetLanReq->ConfigData.IPv6Addr, sizeof(IPv6Addr_T), (pSetLanReq->ChannelNum & 0x0F), BMCInst);
- // break;
- // case LAN_PARAMS_AMI_OEM_PHY_SETTINGS:
- // if(ReqLen != 4)
- // {
- // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
- // return sizeof(*pSetLanRes);
- // }
- // memset(IfcName, 0, sizeof(IfcName));
- // if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
- // {
- // TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(*pSetLanRes);
- // }
- // if(nwGetEthInformation(&PHYCfg, IfcName) == 0)
- // {
- // if(((PHYCfg.autoneg == pSetLanReq->ConfigData.PHYConfig.AutoNegotiationEnable) && (PHYCfg.speed == pSetLanReq->ConfigData.PHYConfig.Speed)
- // && (PHYCfg.duplex == pSetLanReq->ConfigData.PHYConfig.Duplex)))
- // {
- // TDBG("There is no change in the link mode, ignoring the request for setting the speed/duplex.\n");
- // break;
- // }
- // }
- // else
- // {
- // pSetLanRes->CompletionCode = CC_UNSPECIFIED_ERR;
- // return sizeof(*pSetLanRes);
- // }
-
- // if(pSetLanReq->ConfigData.PHYConfig.Speed != 0xFFFF && pSetLanReq->ConfigData.PHYConfig.Duplex != 0xFF)
- // {
- // if(IsLinkModeSupported(&PHYCfg,pSetLanReq->ConfigData.PHYConfig.Speed,pSetLanReq->ConfigData.PHYConfig.Duplex) <= 0)
- // {
- // TCRIT("Unsupported link mode \n");
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(*pSetLanRes);
- // }
- // }
-
- // SetPendStatus(PEND_OP_SET_SPEED, PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_SPEED, (INT8U*) &(pSetLanReq->ConfigData.PHYConfig), sizeof(PHYConfig_T),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
- // break;
-
- // case LAN_PARAMS_AMI_OEM_MTU_SETTINGS:
- // if(ReqLen != 2)
- // {
- // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
- // return sizeof(*pSetLanRes);
- // }
- // /* Setting MTU values less than 1280 disables IPv6,
- // RFC 1280 recommends MTU value should be greater than 1200 for IPV6.
- // so restricting MTU value b/w 1280 to 1500.*/
-
- // if( (pSetLanReq->ConfigData.MTU_size < 1280) || (pSetLanReq->ConfigData.MTU_size > 1500) )
- // {
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(*pSetLanRes);
- // }
- // SetPendStatus(PEND_OP_SET_MTU_SIZE, PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_MTU_SIZE, (INT8U*) &(pSetLanReq->ConfigData.MTU_size), sizeof(INT16U),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-
- // break;
- // case LAN_PARAMS_SSI_OEM_2ND_PRI_ETH_MAC_ADDR:
- // if(g_corefeatures.ssi_support == ENABLED)
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_MAC_ADDRESS);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
- // return sizeof (INT8U);
- // }
- // if (!enableSetMACAddr)
- // {
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // return sizeof(INT8U);
- // }
- // else
- // {
- // EnableSetMACAddress_T macAddrEnabled;
- // memset(&macAddrEnabled, 0, sizeof(EnableSetMACAddress_T));
- // macAddrEnabled.EthIndex = 0x1; /* Specify the 2nd interface */
- // memcpy(&macAddrEnabled.MACAddress, pSetLanReq->ConfigData.SSI2ndPriEthMACAddr, MAC_ADDR_LEN);
- // SetPendStatus(PEND_OP_SET_MAC_ADDRESS, PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_MAC_ADDRESS, (INT8U*)&macAddrEnabled, sizeof(EnableSetMACAddress_T), 0x1, BMCInst);
- // }
- // break;
- // }
- // else
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // case LAN_PARAMS_SSI_OEM_LINK_CTRL:
- // if(g_corefeatures.ssi_support == ENABLED)
- // {
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM; /* Read Only */
- // }
- // else
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // }
- // return sizeof(INT8U);
- // case LAN_PARAMS_SSI_OEM_CMM_IP_ADDR:
- // if(g_corefeatures.ssi_support == ENABLED)
- // {
- // _fmemcpy(pBMCInfo->SSIConfig.CMMIPAddr, pSetLanReq->ConfigData.CMMIPAddr, IP_ADDR_LEN);
- // FlushIPMI((INT8U*)&pBMCInfo->SSIConfig, (INT8U*)&pBMCInfo->SSIConfig, pBMCInfo->IPMIConfLoc.SSIConfigAddr,
- // sizeof(SSIConfig_T), BMCInst);
- // break;
- // }
- // else
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // default:
- // if(g_corefeatures.ncsi_cmd_support == ENABLED)
- // {
- // switch (pSetLanReq->ParameterSelect)
- // {
- // case LAN_PARAMS_AMI_OEM_NCSI_CONFIG_NUM:
- // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
- // return sizeof(*pSetLanRes);
- // case LAN_PARAMS_AMI_OEM_NCSI_SETTINGS:
- // NIC_Count=g_coremacros.global_nic_count;
- // if (ReqLen != 3)
- // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
- // else if (pSetLanReq->ConfigData.NCSIPortConfig.Interface >= NIC_Count)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_NCSI_CHANNEL_ID);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_NODE_BUSY;
- // return sizeof (INT8U);
- // }
-
- // NCSIConfig_T configData;
- // char interfaceName[8];
- // memset(&configData, 0, sizeof(NCSIConfig_T));
- // memset(interfaceName, 0, sizeof(interfaceName));
- // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pSetLanReq->ConfigData.NCSIPortConfig.Interface);
- // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // configData.PackageId = pSetLanReq->ConfigData.NCSIPortConfig.PackageId;
- // configData.ChannelId = pSetLanReq->ConfigData.NCSIPortConfig.ChannelId;
- // if (NCSISetPortConfigByName(interfaceName, configData) != 0)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // SetPendStatus(PEND_OP_SET_NCSI_CHANNEL_ID, PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_NCSI_CHANNEL_ID, NULL, 0, 0, BMCInst);
- // pSetLanRes->CompletionCode = CC_NORMAL;
- // }
- // }
- // }
- // return sizeof(*pSetLanRes);
- // case LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE:
- // NIC_Count=g_coremacros.global_nic_count;
- // if (ReqLen != 2)
- // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
- // else if (pSetLanReq->ConfigData.NCSIModeConfig.Interface >= NIC_Count)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_NCSI_MODE_CHANGE);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_NODE_BUSY;
- // return sizeof (INT8U);
- // }
-
- // NCSIConfig_T configData;
- // char interfaceName[8];
- // memset(&configData, 0, sizeof(NCSIConfig_T));
- // memset(interfaceName, 0, sizeof(interfaceName));
- // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pSetLanReq->ConfigData.NCSIModeConfig.Interface);
-
- // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // configData.AutoSelect = pSetLanReq->ConfigData.NCSIModeConfig.NCSIMode;
- // if (NCSISetPortConfigByName(interfaceName, configData) != 0)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // SetPendStatus(PEND_OP_SET_NCSI_MODE_CHANGE, PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_NCSI_MODE_CHANGE, NULL, 0, 0, BMCInst);
- // pSetLanRes->CompletionCode = CC_NORMAL;
- // }
- // }
- // }
- // return sizeof(*pSetLanRes);
- // case LAN_PARAMS_AMI_OEM_NCSI_EXTENSION:
- // if ((0x20 == pSetLanReq->ConfigData.NCSIPHYConfigSet.Command) &&
- // (g_corefeatures.ncsi_keep_phy_linkup_support == ENABLED))
- // {
- // NIC_Count=g_coremacros.global_nic_count;
- // if (ReqLen != 3)
- // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
- // else if (pSetLanReq->ConfigData.NCSIPHYConfigSet.Interface >= NIC_Count)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // pendStatus = GetPendStatus(PEND_OP_SET_NCSI_VETOBIT);
- // if(pendStatus == PEND_STATUS_PENDING)
- // {
- // *pRes = CC_NODE_BUSY;
- // return sizeof (INT8U);
- // }
- // NCSIConfig_T configData;
- // char interfaceName[8];
- // memset(&configData, 0, sizeof(NCSIConfig_T));
- // memset(interfaceName, 0, sizeof(interfaceName));
- // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pSetLanReq->ConfigData.NCSIPHYConfigSet.Interface);
- // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // configData.VetoBit= pSetLanReq->ConfigData.NCSIPHYConfigSet.VetoBit;
- // if (NCSISetPortConfigByName(interfaceName, configData) != 0)
- // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
- // else
- // {
- // SetPendStatus(PEND_OP_SET_NCSI_VETOBIT, PEND_STATUS_PENDING);
- // PostPendTask(PEND_OP_SET_NCSI_VETOBIT, NULL, 0, 0, BMCInst);
- // pSetLanRes->CompletionCode = CC_NORMAL;
- // }
- // }
- // }
- // }
- // else
- // {
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // }
- // return sizeof(*pSetLanRes);
- // default:
- // TDBG("In Valid Option\n");
- // }
- // }
- // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
-
- // pSetLanRes->CompletionCode = CC_NORMAL;
-
- // if(g_PDKHandle[PDK_POSTSETLANPARAM] != NULL)
- // {
- // ((int(*)(INT8U*, INT8U, int))(g_PDKHandle[PDK_POSTSETLANPARAM]))(pReq, ReqLen, BMCInst);
- // }
-
- // FlushIPMI((INT8U*)&pBMCInfo->LANCfs[0],(INT8U*)&pBMCInfo->LANCfs[EthIndex],pBMCInfo->IPMIConfLoc.LANCfsAddr,
- // sizeof(LANConfig_T),BMCInst);
- // return sizeof(*pSetLanRes);
- // }
- // /*
- // *@fn IPAddrCheck function
- // *@brief It will validate the IP Address and net Mask
- // *@param Addr - IP Address or net Mask
- // *@param params - parameter data to validate
- // */
- // int IPAddrCheck(INT8U *Addr,int params)
- // {
- // int i,maskcount=0,bitmask =0,j,bitcheck=0;
- // for(i=0;i< IP_ADDR_LEN;i++)
- // {
- // if(Addr[i] == BRD_CAST_BIT_MASK)
- // {
- // maskcount++;
- // }
- // }
- // if(maskcount == IP_ADDR_LEN)
- // {
- // return 1;
- // }
- // if(params == LAN_PARAM_SUBNET_MASK)
- // {
- // if(Addr[0] == BRD_CAST_BIT_MASK)
- // {
- // for(i=1;i< IP_ADDR_LEN;i++)
- // {
- // if(Addr[i-1] == 0)
- // {
- // bitmask = 1;
- // }
- // if(Addr[i] != 0)
- // {
- // for(j=0;j<8;j++)
- // {
- // if((Addr[i]<<j) & SUBNET_MASK_BIT_CHECK)
- // {
- // if(bitcheck == 1)
- // {
- // return 1;
- // }
- // continue;
- // }
- // bitcheck=1;
- // }
- // if((bitcheck == 1 && Addr[i-1] != BRD_CAST_BIT_MASK) || (Addr[i] > 0 && bitmask == 1))
- // {
- // return 1;
- // }
- // }
- // }
- // return 0;
- // }
- // return 1;
- // }
- // if(Addr[0] == LOOP_BACK_BIT_MASK || Addr[0] == BRD_CAST_BIT_MASK)
- // {
- // return 1;
- // }
- // return 0;
- // }
- // /*----------------------------------------------
- // * GratuitousARPTask
- // *----------------------------------------------*/
- // void* GratuitousARPTask (INT8U *Addr)
- // {
- // INT8U IntervalInSec;
- // INT8U Status;
- // int nRet;
- // NWCFG_STRUCT NWConfig;
- // NWCFG6_STRUCT NWConfig6;
- // INT8U EthIndex,netindex= 0xFF;
- // int BMCInst,i;
- // char IfcName[16];
- // BMCArg *GratArpArgs = (BMCArg *)Addr;
- // BMCInst = GratArpArgs->BMCInst;
- // BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
- // prctl(PR_SET_NAME,__FUNCTION__,0,0,0);
- // memcpy(&EthIndex,GratArpArgs->Argument,GratArpArgs->Len);
- // memset(IfcName,0,sizeof(IfcName));
- // /*Get the EthIndex*/
- // if(GetIfcName(EthIndex,IfcName, BMCInst) == -1)
- // {
- // TCRIT("Error in Getting Ifcname\n");
- // return 0;
- // }
- // for(i=0;i<sizeof(Ifcnametable)/sizeof(IfcName_T);i++)
- // {
- // if(strcmp(Ifcnametable[i].Ifcname,IfcName) == 0)
- // {
- // netindex= Ifcnametable[i].Index;
- // break;
- // }
- // }
- // if(netindex == 0xFF)
- // {
- // TCRIT("Error in gettting netindex\n");
- // return 0;
- // }
- // if(Addr != NULL)
- // {
- // free(GratArpArgs->Argument);
- // free(Addr);
- // }
- // TDBG ("Gratuitous ARP thread starts for ethindex : %x\n",EthIndex);
- // while (1)
- // {
- // /*Is Gratiutous Arp Enabled */
- // if (0 == (pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl & GRATIUTOUS_ENABLE_MASK))
- // {
- // TDBG("Gratuitous ARP thread exits : Disable BMC-generated Gratuitous ARPs invoked\n");
- // break;
- // }
- // /*Is Gratiutous Arp Suspended */
- // Status = BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex];
- // if ((0 != (Status & GRATIUTOUS_ENABLE_MASK)) &&
- // (BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning == TRUE))
- // {
- // // Gratuitous ARP Suspended.
- // // sleep requested to access Shared memory for two different threads.
- // usleep (20);
- // continue;
- // }
- // nwReadNWCfg_v4_v6( &NWConfig,&NWConfig6, netindex,g_corefeatures.global_ipv6);
- // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
- // {
- // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
-
- // }
- // if (NWConfig.IFName[0] == 0)
- // sprintf((char *)&NWConfig.IFName, "%s",IfcName);
- // TDBG ( "MAC is %2x:%2x:%2x:%2x:%2x:%2x \n", NWConfig.MAC [0], NWConfig.MAC [1],
- // NWConfig.MAC [2], NWConfig.MAC [3], NWConfig.MAC [4], NWConfig.MAC [5] );
- // TDBG ( "IP is %d.%d.%d.%d\n", NWConfig.IPAddr[0], NWConfig.IPAddr[1],
- // NWConfig.IPAddr[2], NWConfig.IPAddr[3]);
- // TDBG ( "Device Name : %s\n", (char *)&NWConfig.IFName);
- // nRet = SendGratuitousARPPacket((char *)&NWConfig.IFName, NWConfig.IPAddr, NWConfig.MAC);
- // if (0 != nRet)
- // {
- // TCRIT("Gratuitous ARP thread exits : Unable to Send Gratuitous ARP packet\n");
- // break;
- // }
- // TDBG ("Send Gratuitous Packet\n");
- // if (0 == pBMCInfo->LANCfs[EthIndex].GratitousARPInterval)
- // {
- // IntervalInSec = 2; //Default 2 secs
- // } else {
- // // Gratuitous ARP interval in 500 millisecond increments.
- // IntervalInSec = (pBMCInfo->LANCfs[EthIndex].GratitousARPInterval * 500)/1000;
- // }
- // usleep( IntervalInSec * 1000 * 1000 );
- // }
- // return 0;
- // }
- // /*---------------------------------------------------
- // * GetLanConfigParam
- // *---------------------------------------------------*/
- // int
- // GetLanConfigParam (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
- // {
- // _NEAR_ GetLanConfigReq_T* pGetLanReq = (_NEAR_ GetLanConfigReq_T*) pReq;
- // _NEAR_ GetLanConfigRes_T* pGetLanRes = (_NEAR_ GetLanConfigRes_T*) pRes;
- // _FAR_ BMCSharedMem_T* pSharedMem = BMC_GET_SHARED_MEM (BMCInst);
- // INT8U IsOemDefined = FALSE;
- // NWCFG_STRUCT NWConfig;
- // NWCFG6_STRUCT NWConfig6;
- // // V6DNS_CONFIG v6dnsconfig;
- // INT8U EthIndex,netindex= 0xFF,i;
- // _FAR_ BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // int ncsiPortConfigNum = 0;
- // ETHCFG_STRUCT PHYCfg;
- // ChannelInfo_T* pChannelInfo = NULL;
- // char IfcName[16]; /* Eth interface name */
- // INT8U ComStrLen=MAX_COMM_STRING_SIZE;
- // int retValue = 0,NIC_Count = 0;
- // pGetLanRes->CCParamRev.CompletionCode = CC_NORMAL;
- // pGetLanRes->CCParamRev.ParamRevision = PARAMETER_REVISION_FORMAT;
- // // printf("---> channel: %d, parameter: %#x, setslect: %#x, blockselect: %#x\n", pGetLanReq->ChannelNum, pGetLanReq->ParameterSelect, pGetLanReq->SetSelect, pGetLanReq->BlockSelect);
- // if(pGetLanReq->ChannelNum & RESERVED_VALUE_70)
- // {
- // /* Alarm !!! Somebody is trying to set Reseved Bits */
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // if((pGetLanReq->ParameterSelect >= MIN_LAN_OEM_CONF_PARAM) &&
- // (pGetLanReq->ParameterSelect <= MAX_LAN_OEM_CONF_PARAM) )
- // {
- // /* Converts OEM parameter value to equivalent AMI parameter value */
- // if (0 != GetLanAMIParamValue (&pGetLanReq->ParameterSelect, &IsOemDefined) )
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // /* Hook for OEM to handle this parameter */
- // if ( (IsOemDefined) && (g_PDKHandle[PDK_GETLANOEMPARAM] != NULL) )
- // {
- // return ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_GETLANOEMPARAM]))(pReq, ReqLen, pRes, BMCInst);
- // }
-
- // }
- // if (g_PDKHandle[PDK_BEFOREGETLANPARM] != NULL)
- // {
- // retValue = ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_BEFOREGETLANPARM]))(pReq, ReqLen, pRes, BMCInst);
- // if(retValue != 0)
- // {
- // return retValue;
- // }
- // }
- // //! Validate the SetSelector value.
- // if ( (0x00 != pGetLanReq->SetSelect) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAM_SELECT_DEST_TYPE) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAM_SELECT_DEST_ADDR) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAM_VLAN_TAGS) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH))
- // {
- // printf("GetLanConfigParam log1\n");
- // if( g_corefeatures.ncsi_cmd_support == ENABLED )
- // {
- // if ((pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_SETTINGS) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE) &&
- // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_EXTENSION))
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // }
- // else
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // }
- // //! Validate the BlockSelector value.
- // if (0x00 != pGetLanReq->BlockSelect)
- // {
- // printf("GetLanConfigParam log2\n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // EthIndex= GetEthIndex(pGetLanReq->ChannelNum & 0x0F, BMCInst);
- // if(0xff == EthIndex)
- // {
- // printf("GetLanConfigParam log3\n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // /*Get the EthIndex*/
- // if(GetIfcName(EthIndex,IfcName, BMCInst) != 0)
- // {
- // TCRIT("Error in Getting IfcName\n");
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
- // for(i=0;i<sizeof(Ifcnametable)/sizeof(IfcName_T);i++)
- // {
- // if(strcmp(Ifcnametable[i].Ifcname,IfcName) == 0)
- // {
- // netindex= Ifcnametable[i].Index;
- // break;
- // }
- // }
- // if(netindex == 0xFF)
- // {
- // TCRIT("Error in Getting netindex %d %s\n",netindex,IfcName);
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof (INT8U);
- // }
-
- // if ((pGetLanReq->ChannelNum & GET_PARAMETER_REVISION_MASK) != 0)
- // {
- // if((MAX_LAN_CONF_PARAM >= pGetLanReq->ParameterSelect) ||
- // ((MIN_LAN_OEM_CONF_PARAM <= pGetLanReq->ParameterSelect) && (MAX_LAN_OEM_CONF_PARAM >= pGetLanReq->ParameterSelect)) )
- // {
- // return sizeof(GetLanCCRev_T);
- // }
- // else
- // {
- // *pRes = CC_PARAM_NOT_SUPPORTED;
- // return sizeof (*pRes);
- // }
- // }
- // else
- // {
- // printf("GetLanConfigParam log4\n");
- // switch(pGetLanReq->ParameterSelect)
- // {
- // case LAN_PARAM_SET_IN_PROGRESS:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // pGetLanRes->ConfigData.SetInProgress = BMC_GET_SHARED_MEM(BMCInst)->m_Lan_SetInProgress;
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_AUTH_TYPE_SUPPORT:
- // pGetLanRes->ConfigData.AuthTypeSupport = pBMCInfo->LANCfs[EthIndex].AuthTypeSupport;
- // break;
- // case LAN_PARAM_AUTH_TYPE_ENABLES:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.AuthTypeEnables,
- // &(pBMCInfo->LANCfs[EthIndex].AuthTypeEnables), sizeof(AuthTypeEnables_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_IP_ADDRESS:
- // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
- // {
- // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
- // {
- // _fmemcpy (NWConfig.IPAddr,pBMCInfo->LANCfs[EthIndex].IPAddr, IP_ADDR_LEN);
- // }
- // else
- // {
- // memset(&NWConfig, 0, sizeof(NWConfig));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // _fmemcpy (pGetLanRes->ConfigData.IPAddr, NWConfig.IPAddr, IP_ADDR_LEN);
- // break;
- // case LAN_PARAM_IP_ADDRESS_SOURCE:
- // if(g_corefeatures.delayed_lan_restart_support)
- // {
- // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
- // {
- // NWConfig.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPAddrSrc;
- // }
- // else
- // {
- // memset(&NWConfig, 0, sizeof(NWConfig));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // pGetLanRes->ConfigData.IPAddrSrc = NWConfig.CfgMethod;
- // break;
- // case LAN_PARAM_MAC_ADDRESS:
- // nwGetNWInformations(&NWConfig,IfcName);
- // _fmemcpy (pGetLanRes->ConfigData.MACAddr, NWConfig.MAC, MAC_ADDR_LEN);
- // break;
- // case LAN_PARAM_SUBNET_MASK:
- // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
- // {
- // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
- // {
- // _fmemcpy (NWConfig.Mask,pBMCInfo->LANCfs[EthIndex].SubNetMask, IP_ADDR_LEN);
- // }
- // else
- // {
- // memset(&NWConfig, 0, sizeof(NWConfig));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // _fmemcpy (pGetLanRes->ConfigData.SubNetMask, NWConfig.Mask, IP_ADDR_LEN);
- // break;
- // case LAN_PARAM_IPv4_HEADER:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.Ipv4HdrParam,
- // &(pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam), sizeof(IPv4HdrParams_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_PRI_RMCP_PORT:
- // pGetLanRes->ConfigData.PrimaryRMCPPort = htoipmi_u16(pBMCInfo->LANCfs[EthIndex].PrimaryRMCPPort);
- // break;
- // case LAN_PARAM_SEC_RMCP_PORT:
- // /* Returning Invalid error message */
- // *pRes = CC_PARAM_NOT_SUPPORTED;
- // return sizeof (INT8U);
- // /*pGetLanRes->ConfigData.SecondaryPort = htoipmi_u16(pPMConfig->LANConfig[EthIndex].SecondaryPort);*/
- // break;
- // case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
- // pGetLanRes->ConfigData.BMCGeneratedARPControl = pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl;
- // break;
- // case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
- // pGetLanRes->ConfigData.GratitousARPInterval =
- // pBMCInfo->LANCfs[EthIndex].GratitousARPInterval;
- // break;
- // case LAN_PARAM_DEFAULT_GATEWAY_IP:
- // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
- // {
- // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
- // {
- // _fmemcpy (NWConfig.Gateway, pBMCInfo->LANCfs[EthIndex].DefaultGatewayIPAddr, IP_ADDR_LEN);
- // }
- // else
- // {
- // memset(&NWConfig, 0, sizeof(NWConfig));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // _fmemcpy (pGetLanRes->ConfigData.DefaultGatewayIPAddr, NWConfig.Gateway, IP_ADDR_LEN);
- // break;
- // case LAN_PARAM_DEFAULT_GATEWAY_MAC:
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // nwGetSrcMacAddr(&NWConfig.Gateway[0],netindex, &pGetLanRes->ConfigData.DefaultGatewayMACAddr[0]);
- // break;
- // case LAN_PARAM_BACKUP_GATEWAY_IP:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // nwGetBkupGWyAddr(pGetLanRes->ConfigData.BackupGatewayIPAddr,netindex);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_BACKUP_GATEWAY_MAC:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (pGetLanRes->ConfigData.BackupGatewayMACAddr,
- // pBMCInfo->LANCfs[EthIndex].BackupGatewayMACAddr, MAC_ADDR_LEN);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_COMMUNITY_STRING:
- // if (g_PDKHandle[PDK_GETSNMPCOMMUNITYNAME] != NULL )
- // {
- // if(((int(*)(INT8U *, INT8U *,int))(g_PDKHandle[PDK_GETSNMPCOMMUNITYNAME]))(pGetLanRes->ConfigData.CommunityStr,&ComStrLen, BMCInst)==0)
- // break;
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (pGetLanRes->ConfigData.CommunityStr,
- // pBMCInfo->LANCfs[EthIndex].CommunityStr, MAX_COMM_STRING_SIZE);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_DEST_NUM:
- // pGetLanRes->ConfigData.NumDest = pBMCInfo->LANCfs[EthIndex].NumDest;
- // break;
- // case LAN_PARAM_SELECT_DEST_TYPE:
- // //if (pGetLanReq->SetSelect > NUM_LAN_DESTINATION)
- // if ( pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
- // {
- // *pRes = CC_PARAM_OUT_OF_RANGE ;
- // return sizeof (*pRes);
- // }
- // if (0 == pGetLanReq->SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.DestType,
- // &pSharedMem->VolLANDestType[EthIndex], sizeof(LANDestType_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.DestType,
- // &(pBMCInfo->LANCfs[EthIndex].DestType[pGetLanReq->SetSelect - 1]),
- // sizeof(LANDestType_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // break;
- // case LAN_PARAM_SELECT_DEST_ADDR:
- // //if (pGetLanReq->SetSelect > NUM_LAN_DESTINATION)
- // if ( pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
- // {
- // *pRes = CC_PARAM_OUT_OF_RANGE ;
- // return sizeof (*pRes);
- // }
- // if (0 == pGetLanReq->SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.DestAddr,
- // &pSharedMem->VolLANDest[EthIndex], sizeof(LANDestAddr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.DestAddr,
- // &(pBMCInfo->LANCfs[EthIndex].DestAddr[pGetLanReq->SetSelect - 1]),
- // sizeof(LANDestAddr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // break;
- // case LAN_PARAM_VLAN_ID:
- // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
- // {
- // pGetLanRes->ConfigData.VLANID = pBMCInfo->LANCfs[EthIndex].VLANID;
- // }
- // break;
- // case LAN_PARAM_VLAN_PRIORITY:
- // pGetLanRes->ConfigData.VLANPriority = pBMCInfo->LANCfs[EthIndex].VLANPriority;
- // break;
- // case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
- // pGetLanRes->ConfigData.CipherSuiteSup = N0_OF_CIPHER_SUITE_SUPPORTED;
- // break;
- // case LAN_PARAM_CIPHER_SUITE_ENTRIES:
- // {
- // int i;
- // _fmemset (pGetLanRes->ConfigData.CipherSuiteEntries, 0,
- // sizeof (pGetLanRes->ConfigData.CipherSuiteEntries));
- // for (i = 0; i < (N0_OF_CIPHER_SUITE_SUPPORTED); i++)
- // {
- // pGetLanRes->ConfigData.CipherSuiteEntries[i+1] = g_CipherRec[1 + i * 5];
- // }
- // }
- // break;
- // case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (pGetLanRes->ConfigData.CipherSuitePrivLevels,
- // pBMCInfo->LANCfs[EthIndex].CipherSuitePrivLevels,
- // MAX_NUM_CIPHER_SUITE_PRIV_LEVELS);
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAM_VLAN_TAGS:
- // *((_NEAR_ INT8U*)&pGetLanRes->ConfigData) = pGetLanReq->SetSelect;
- // if (pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_OUT_OF_RANGE;
- // return sizeof (GetLanCCRev_T);
- // }
- // if (0 == pGetLanReq->SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (((_NEAR_ INT8U*) &pGetLanRes->ConfigData) + 1,&pSharedMem->VLANDestTag, sizeof(VLANDestTags_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // if (pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_OUT_OF_RANGE;
- // return sizeof(GetLanCCRev_T);
- // }
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (((_NEAR_ INT8U*)&pGetLanRes->ConfigData) + 1,
- // &pBMCInfo->LANCfs[EthIndex].VLANDestTags[pGetLanReq->SetSelect - 1],
- // sizeof(VLANDestTags_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // break;
- // case LAN_PARAMS_BAD_PASSWORD_THRESHOLD:
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy(&pGetLanRes->ConfigData.BadPasswd,
- // &pBMCInfo->LANCfs[EthIndex].BadPasswd,sizeof(BadPassword_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // break;
- // case LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR:
- // if ( pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
- // {
- // *pRes = CC_PARAM_OUT_OF_RANGE ;
- // return sizeof (*pRes);
- // }
- // if (0 == pGetLanReq->SetSelect)
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.Destv6Addr,
- // &pSharedMem->VolLANv6Dest[EthIndex], sizeof(LANDestv6Addr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // else
- // {
- // LOCK_BMC_SHARED_MEM(BMCInst);
- // _fmemcpy (&pGetLanRes->ConfigData.Destv6Addr,
- // &(pBMCInfo->LANCfs[EthIndex].Destv6Addr[pGetLanReq->SetSelect - 1]),
- // sizeof(LANDestv6Addr_T));
- // UNLOCK_BMC_SHARED_MEM(BMCInst);
- // }
- // TDBG("\n GetLanconfig: Getting SNMPv6 configuration done..\n");
- // return sizeof(GetLanConfigRes_T);
- // break;
- // case LAN_PARAMS_AMI_OEM_ENABLE_SET_MAC:
- // pGetLanRes->ConfigData.ChangeMACEnabled = enableSetMACAddr;
- // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
- // case LAN_PARAMS_AMI_OEM_IPV6_ENABLE:
- // if(g_corefeatures.delayed_lan_restart_support)
- // {
- // NWConfig6.enable = pBMCInfo->LANCfs[EthIndex].IPv6_Enable;
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // pGetLanRes->ConfigData.IPv6_Enable = NWConfig6.enable;
- // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
-
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE:
- // if(g_corefeatures.delayed_lan_restart_support)
- // {
- // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
- // {
- // NWConfig6.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc;
- // }
- // else
- // {
- // memset(&NWConfig6, 0, sizeof(NWConfig6));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // pGetLanRes->ConfigData.IPv6_IPAddrSrc = NWConfig6.CfgMethod;
- // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
-
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR:
- // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64:
- // if(pGetLanReq->SetSelect & 0xF0)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
-
- // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
- // {
- // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
- // {
- // _fmemcpy (NWConfig6.GlobalIPAddr,pBMCInfo->LANCfs[EthIndex].IPv6_IPAddr, IP6_ADDR_LEN*MAX_IPV6ADDRS);
- // }
- // else
- // {
- // memset(&NWConfig6, 0, sizeof(NWConfig6));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // _fmemcpy (pGetLanRes->ConfigData.IPv6_LinkAddr, NWConfig6.GlobalIPAddr[(pGetLanReq->SetSelect & 0x0F)], IP6_ADDR_LEN);
- // return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
-
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_LINK_ADDR:
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // _fmemcpy (pGetLanRes->ConfigData.IPv6_LinkAddr, NWConfig6.LinkIPAddr, IP6_ADDR_LEN);
- // return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
- // case LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH:
- // if(pGetLanReq->SetSelect & 0xF0)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(INT8U);
- // }
- // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
- // {
- // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
- // {
- // NWConfig6.GlobalPrefix[(pGetLanReq->SetSelect & 0x0F)] = pBMCInfo->LANCfs[EthIndex].IPv6_PrefixLen[(pGetLanReq->SetSelect & 0x0F)];
- // }
- // else
- // {
- // memset(&NWConfig6, 0, sizeof(NWConfig6));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // pGetLanRes->ConfigData.IPv6_LinkAddrPrefix = NWConfig6.GlobalPrefix[(pGetLanReq->SetSelect & 0x0F)];
- // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
-
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_LINK_ADDR_PREFIX:
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // pGetLanRes->ConfigData.IPv6_LinkAddrPrefix = NWConfig6.LinkPrefix;
- // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
-
- // break;
- // case LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP:
- // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
- // {
- // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
- // {
- // _fmemcpy (NWConfig6.Gateway,pBMCInfo->LANCfs[EthIndex].IPv6_GatewayIPAddr, IP6_ADDR_LEN);
- // }
- // else
- // {
- // memset(&NWConfig6, 0, sizeof(NWConfig6));
- // }
- // }
- // else
- // {
- // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // }
- // _fmemcpy (pGetLanRes->ConfigData.IPv6_GatewayIPAddr, NWConfig6.Gateway, IP6_ADDR_LEN);
- // return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
-
- // break;
- // case LAN_PARAMS_AMI_OEM_PHY_SETTINGS:
- // memset(IfcName, 0, sizeof(IfcName));
- // if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
- // {
- // TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
- // }
- // if(nwGetEthInformation(&PHYCfg, IfcName) !=0)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
- // return sizeof(GetLanCCRev_T);
- // }
- // pGetLanRes->ConfigData.PHYConfig.Interface = EthIndex;
- // pGetLanRes->ConfigData.PHYConfig.AutoNegotiationEnable = PHYCfg.autoneg;
- // pGetLanRes->ConfigData.PHYConfig.Speed = PHYCfg.speed;
- // pGetLanRes->ConfigData.PHYConfig.Duplex = PHYCfg.duplex;
- // pGetLanRes->ConfigData.PHYConfig.CapabilitiesSupported = PHYCfg.supported;
- // return sizeof(GetLanCCRev_T) + sizeof(PHYConfig_T);
- // case LAN_PARAMS_AMI_OEM_MTU_SETTINGS:
- // memset(IfcName,0,sizeof(IfcName));
- // if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
- // {
- // TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
- // pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
- // return sizeof(GetLanCCRev_T);
- // }
- // if(nwGetEthInformation(&PHYCfg, IfcName) !=0)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
- // return sizeof(GetLanCCRev_T);
- // }
-
- // pGetLanRes->ConfigData.MTU_size = PHYCfg.maxtxpkt;
- // return sizeof(GetLanCCRev_T) + sizeof(INT16U);
-
- // case LAN_PARAMS_SSI_OEM_2ND_PRI_ETH_MAC_ADDR:
- // if(g_corefeatures.ssi_support == ENABLED)
- // {
- // netindex = 0x1; /* Specify the 2nd interface */
- // nwReadNWCfg_v4_v6(&NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
- // _fmemcpy(pGetLanRes->ConfigData.SSI2ndPriEthMACAddr, NWConfig.MAC, MAC_ADDR_LEN);
- // return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.SSI2ndPriEthMACAddr);
- // }
- // else
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // break;
- // case LAN_PARAMS_SSI_OEM_LINK_CTRL:
- // if(g_corefeatures.ssi_support == ENABLED)
- // {
- // pGetLanRes->ConfigData.SSILinkControl = 0;
- // pChannelInfo = getChannelInfo(pBMCInfo->RMCPLAN1Ch, BMCInst);
- // if(NULL == pChannelInfo)
- // {
- // *pRes = CC_UNSPECIFIED_ERR;
- // return sizeof (*pRes);
- // }
- // if (pChannelInfo->AccessMode == 0x02) /* If 1st channal is available */
- // pGetLanRes->ConfigData.SSILinkControl |= BIT0;
- // NIC_Count = g_coremacros.global_nic_count;
- // if (NIC_Count == 2)
- // {
- // pChannelInfo = getChannelInfo(pBMCInfo->RMCPLAN2Ch, BMCInst);
- // if(NULL == pChannelInfo)
- // {
- // *pRes = CC_UNSPECIFIED_ERR;
- // return sizeof (*pRes);
- // }
- // if (pChannelInfo->AccessMode == 0x02) /* If 2nd channal is available */
- // pGetLanRes->ConfigData.SSILinkControl |= BIT1;
- // }
- // return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.SSILinkControl);
- // }
- // else
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // break;
- // case LAN_PARAMS_SSI_OEM_CMM_IP_ADDR:
- // if(g_corefeatures.ssi_support == ENABLED)
- // {
- // _fmemcpy (pGetLanRes->ConfigData.CMMIPAddr, pBMCInfo->SSIConfig.CMMIPAddr, IP_ADDR_LEN);
- // return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.CMMIPAddr);
- // }
- // else
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // break;
- // default:
- // if(g_corefeatures.ncsi_cmd_support == ENABLED)
- // {
- // switch(pGetLanReq->ParameterSelect)
- // {
- // case LAN_PARAMS_AMI_OEM_NCSI_CONFIG_NUM:
- // NCSIGetTotalPorts(&ncsiPortConfigNum);
-
- // if (ncsiPortConfigNum >= 0xFF)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
- // else
- // {
- // pGetLanRes->ConfigData.NumNCSIPortConfigs = ncsiPortConfigNum;
- // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
- // }
- // break;
-
- // case LAN_PARAMS_AMI_OEM_NCSI_SETTINGS:
- // {
- // NIC_Count=g_coremacros.global_nic_count;
- // if (pGetLanReq->SetSelect >= NIC_Count)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
- // NCSIConfig_T configData;
- // char interfaceName[8];
- // memset(&configData, 0, sizeof(NCSIConfig_T));
- // memset(interfaceName, 0, sizeof(interfaceName));
- // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pGetLanReq->SetSelect);
-
- // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
- // if (configData.PackageId >= 0xFF || configData.ChannelId >= 0xFF)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
- // pGetLanRes->ConfigData.NCSIPortConfig.Interface = pGetLanReq->SetSelect;
- // pGetLanRes->ConfigData.NCSIPortConfig.PackageId = configData.PackageId;
- // pGetLanRes->ConfigData.NCSIPortConfig.ChannelId = configData.ChannelId;
- // return sizeof(GetLanCCRev_T) + sizeof(NCSIPortConfig_T);
- // }
- // break;
- // case LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE:
- // {
- // NIC_Count=g_coremacros.global_nic_count;
- // if (pGetLanReq->SetSelect >= NIC_Count)
- // {
- // printf("---> log5, SetSelect = %d, NIC_Count = %d\n",pGetLanReq->SetSelect, NIC_Count);
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
-
- // NCSIConfig_T configData;
- // char interfaceName[8];
- // memset(&configData, 0, sizeof(NCSIConfig_T));
- // memset(interfaceName, 0, sizeof(interfaceName));
-
- // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pGetLanReq->SetSelect);
-
- // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
-
- // if (configData.AutoSelect>= 0xFF)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
- // pGetLanRes->ConfigData.NCSIModeConfig.Interface = pGetLanReq->SetSelect;
- // pGetLanRes->ConfigData.NCSIModeConfig.NCSIMode = configData.AutoSelect;
- // return sizeof(GetLanCCRev_T) + sizeof(NCSIModeConfig_T);
- // }
- // break;
- // case LAN_PARAMS_AMI_OEM_NCSI_EXTENSION:
- // {
- // char ncsi_default_ifc[IFNAMSIZ + 1] = "eth1";
-
- // if ((pGetLanReq->SetSelect == 0x20) &&
- // (g_corefeatures.ncsi_keep_phy_linkup_support == ENABLED))
- // {
- // NIC_Count=g_coremacros.global_nic_count;
- // NCSIConfig_T configData;
- // char interfaceName[8];
- // memset(&configData, 0, sizeof(NCSIConfig_T));
- // memset(interfaceName, 0, sizeof(interfaceName));
- // GetMacrodefine_string("CONFIG_SPX_FEATURE_NCSI_DEFAULT_INTERFACE", ncsi_default_ifc);
- // snprintf(interfaceName, sizeof(interfaceName), "%s", ncsi_default_ifc);
- // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof(GetLanCCRev_T);
- // }
- // char Interface[2];
- // snprintf(Interface, sizeof(Interface), "%c", interfaceName[3]);
- // pGetLanRes->ConfigData.NCSIPHYConfigGet.Interface = atoi(Interface);
- // pGetLanRes->ConfigData.NCSIPHYConfigGet.VetoBit = configData.VetoBit;
- // return sizeof(GetLanCCRev_T) + sizeof(NCSIPHYConfigGet_T);
- // }
- // else
- // {
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(GetLanCCRev_T);
- // }
- // }
- // break;
-
- // default:
- // TDBG("In Valid Option\n");
-
- // }
- // }
- // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
- // return sizeof(INT8U);
- // }
- // }
-
- // return sizeof(GetLanCCRev_T) + LanconfigParameterLength[pGetLanReq->ParameterSelect];
- // }
- // /*---------------------------------------------------
- // * SuspendBMCArps
- // *---------------------------------------------------*/
- // int
- // SuspendBMCArps (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
- // {
- // _NEAR_ SuspendBMCArpsReq_T* pArpReq = (_NEAR_ SuspendBMCArpsReq_T*) pReq;
- // _NEAR_ SuspendBMCArpsRes_T* pArpRes = (_NEAR_ SuspendBMCArpsRes_T*) pRes;
- // INT8U EthIndex;
- // /* Verify Channel ID */
- // pArpRes->CompletionCode = CC_INV_DATA_FIELD;
- // if(pArpReq->ChannelNo & RESERVED_BITS_SUSPENDBMCARPS) return sizeof(*pRes);
- // if (!IsLANChannel(pArpReq->ChannelNo & CHANNEL_ID_MASK, BMCInst) )
- // {
- // return sizeof (*pRes);
- // }
- // EthIndex= GetEthIndex(pArpReq->ChannelNo & 0x0F,BMCInst);
- // if(0xff == EthIndex)
- // {
- // return sizeof (*pRes);
- // }
- // /* Reserved Bits Validation */
- // if (0 != (SUSPEND_ARP_RSVD_BIT_MASK & pArpReq->ArpSuspend))
- // {
- // return sizeof (*pRes);
- // }
- // if (BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning == TRUE)
- // BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex] = pArpReq->ArpSuspend;
- // /* Update Response */
- // pArpRes->CompletionCode = CC_NORMAL;
- // pArpRes->ArpSuspendStatus = UpdateArpStatus(EthIndex, BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning, BMCInst);
- // return sizeof (SuspendBMCArpsRes_T);
- // }
- // /*---------------------------------------------------
- // * GetIPUDPRMCPStats
- // *---------------------------------------------------*/
- // int
- // GetIPUDPRMCPStats (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
- // {
- // _NEAR_ GetIPUDPRMCPStatsReq_T* pGetIPUDPRMCPStatsReq = (_NEAR_ GetIPUDPRMCPStatsReq_T*) pReq;
- // _NEAR_ GetIPUDPRMCPStatsRes_T* pGetIPUDPRMCPStatsRes = (_NEAR_ GetIPUDPRMCPStatsRes_T*) pRes;
- // _FAR_ BMCSharedMem_T* pSharedMem = BMC_GET_SHARED_MEM (BMCInst);
- // FILE *fptr;
- // char FDRead[512], FSRead[512];
- // char *result = NULL;
- // char **StrArray;
- // int count = 0;
- // int cStrings =0;
- // if(pGetIPUDPRMCPStatsReq->ChannelNo & RESERVED_BITS_GETIPUDPRMCPSTATS_CH)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(*pRes);
- // }
- // if(pGetIPUDPRMCPStatsReq->ClearStatus & RESERVED_BITS_GETIPUDPRMCPSTATS_CLRSTATE)
- // {
- // *pRes = CC_INV_DATA_FIELD;
- // return sizeof(*pRes);
- // }
- // //Channel number [3:0] is valid.
- // if ( !IsLANChannel(pGetIPUDPRMCPStatsReq->ChannelNo & CHANNEL_ID_MASK, BMCInst) )
- // {
- // pGetIPUDPRMCPStatsRes->CompletionCode = CC_INV_DATA_FIELD;
- // return sizeof (*pRes);
- // }
- // //Clear the statistics if 1 is given in request.
- // if ( pGetIPUDPRMCPStatsReq->ClearStatus & 0x01 )
- // {
- // /* <TBD BalaT>
- // * Have to clear the already stored statistics when clear req is 1.
- // */
- // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
- // return sizeof (INT8U);
- // }
- // //All Statistics values are initialised to 0.
- // memset (pGetIPUDPRMCPStatsRes, 0, sizeof(GetIPUDPRMCPStatsRes_T) );
- // //All the datas are taken from /proc/net/snmp file
- // fptr = fopen ("/proc/net/snmp","r+");
- // if (fptr == NULL)
- // {
- // pGetIPUDPRMCPStatsRes->CompletionCode = CC_COULD_NOT_PROVIDE_RESP;
- // return sizeof (INT8U);
- // }
- // while( NULL != fgets(FDRead,512,fptr) )
- // {
- // if ( NULL != strstr (FDRead, "Ip: ") )
- // {
- // count++;
- // if (count == 2)
- // {
- // //To find the no. of valid strings in a line.
- // strcpy (FSRead, FDRead);
- // result = strtok( FSRead, " " );
- // while( result != NULL )
- // {
- // cStrings++;
- // result = strtok( NULL, " " );
- // }
- // //Condition to check so that explode doesnt try to read the strings from unknown location.
- // if ( cStrings == 20)
- // {
- // StrArray = explode (' ', FDRead);
- // }
- // else
- // {
- // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
- // return sizeof (INT8U);
- // }
- // //All Statistics stops acumulating at FFFFh unless otherwise noted.
- // //IP packets received.
- // if ( atol((char *)StrArray[3]) > 0xffff)
- // pGetIPUDPRMCPStatsRes->IPPacketsRecv = ( ( atol((char *)StrArray[3]) ) % 65535);
- // else
- // pGetIPUDPRMCPStatsRes->IPPacketsRecv = atoi((char *)StrArray[3]);
- // //IP Header Error.
- // pGetIPUDPRMCPStatsRes->IPHeaderErr = atoi((char *)StrArray[4]);
- // //IP Address Error.
- // if ( atol((char *)StrArray[5]) > 0xffff)
- // pGetIPUDPRMCPStatsRes->IPAddrErr = ( ( atol((char *)StrArray[5]) ) % 65535);
- // else
- // pGetIPUDPRMCPStatsRes->IPAddrErr = atoi((char *)StrArray[5]);
- // //Fragmented IP Packets received.
- // if ( atol((char *)StrArray[17]) > 0xffff)
- // pGetIPUDPRMCPStatsRes->FragIPPacketsRecv = ( ( atol((char *)StrArray[17]) ) % 65535);
- // else
- // pGetIPUDPRMCPStatsRes->FragIPPacketsRecv = atoi((char *)StrArray[17]);
- // //IP packets Transmitted.
- // if ( atol((char *)StrArray[10]) > 0xffff)
- // pGetIPUDPRMCPStatsRes->IPPacketsTrans = ( ( atol((char *)StrArray[10]) ) % 65535);
- // else
- // pGetIPUDPRMCPStatsRes->IPPacketsTrans = atoi((char *)StrArray[10]);
- // count = 0;
- // }
- // }
-
- // if ( NULL != strstr (FDRead, "Udp: ") )
- // {
- // count++;
- // if (count == 2)
- // {
- // //To find the no. of valid strings in a line.
- // cStrings = 0;
- // strcpy (FSRead, FDRead);
- // result = strtok( FSRead, " " );
- // while( result != NULL )
- // {
- // cStrings++;
- // result = strtok( NULL, " " );
- // }
- // //Condition to check so that explode doesnt try to read the strings beyond the valid location.
- // if ( cStrings == 5)
- // {
- // StrArray = explode (' ', FDRead);
- // }
- // else
- // {
- // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
- // return sizeof (INT8U);
- // }
- // //UDP packets received.
- // if ( atol((char *)StrArray[1]) > 0xffff)
- // pGetIPUDPRMCPStatsRes->UDPPacketsRecv = ( ( atol((char *)StrArray[1]) ) % 65535);
- // else
- // pGetIPUDPRMCPStatsRes->UDPPacketsRecv = atoi((char *)StrArray[1]);
- // count = 0;
- // }
- // }
- // }
- // fclose(fptr);
- // //Valid RMCP packets received.
- // pGetIPUDPRMCPStatsRes->ValidRMCPPackets = pSharedMem->gIPUDPRMCPStats;
- // //<TBD BalaT>To store the statistics across the system reset and power cycles
- // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
- // return sizeof (GetIPUDPRMCPStatsRes_T);
- // }
- // /*-----------------------------------------------------
- // * explode
- // * Funntion to split the strings and store in an array
- // *-----------------------------------------------------*/
- // char **explode(char separator, char *string)
- // {
- // int start = 0, i, k = 1, count = 2;
- // char **strarr;
- // for (i = 0; string[i] != '\0'; i++)
- // /* how many rows do we need for our array? */
- // if (string[i] == separator)
- // count++;
- // /* count is at least 2 to make room for the entire string
- // * * and the ending NULL */
- // strarr = malloc(count * sizeof(char*));
- // i = 0;
- // while (*string++ != '\0')
- // {
- // if (*string == separator)
- // {
- // strarr[i] = malloc(k - start + 2);
- // strncpy(strarr[i], string - k + start, k - start + 1);
- // strarr[i][k - start + 1] = '\0'; /* guarantee null termination */
- // start = k;
- // i++;
- // }
- // k++;
- // }
- // /* copy the last part of the string after the last separator */
- // strarr[i] = malloc(k - start);
- // strncpy(strarr[i], string - k + start, k - start - 1);
- // strarr[i][k - start - 1] = '\0'; /* guarantee null termination */
- // strarr[++i] = NULL;
- // return strarr;
- // }
- // /*----------------------------------------------
- // * UpdateArpStatus
- // *----------------------------------------------*/
- // INT8U
- // UpdateArpStatus (INT8U EthIndex,BOOL IsTimerRunning, int BMCInst)
- // {
- // INT8U GratArpSuspend;
- // INT8U ArpSuspend;
- // INT8U Status;
- // BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
- // char Cmds[50]={0}; // command string to perform BMC-generated ARP
- // char IfcName[16];
- // IPMI_DBG_PRINT_1 ("Timer - %x", IsTimerRunning);
- // GratArpSuspend = ArpSuspend = 1;
- // // Check Gratuitous ARP is Enabled
- // if (0 == (pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl & GRATIUTOUS_ENABLE_MASK))
- // {
- // GratArpSuspend = 0;
- // }
- // // Check ARP Response is Enabled
- // if (0 == (pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl & ENABLE_ARP_RESPONSES))
- // {
- // ArpSuspend = 0;
- // }
- // /*Disable ARP */
- // if (TRUE == IsTimerRunning)
- // {
- // /* WDT is running, check and suspend ARP if necessary */
- // if( (0 != (BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex] & SUSPEND_GRAT_ARP)) &&
- // (0 < GratArpSuspend) )
- // {
- // GratArpSuspend--;
- // }
- // if( (0 != (BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex] & SUSPEND_ARP)) &&
- // (0 < ArpSuspend) )
- // {
- // ArpSuspend--;
- // }
- // }
-
- // memset(IfcName,0,sizeof(IfcName));
- // if(GetIfcName(EthIndex, IfcName, BMCInst) != 0)
- // {
- // TCRIT("Error in getting Interface Name for the Lan Index :%d\n", EthIndex);
- // }
- // else
- // {
- // /* Perform commands for BMC-generated Arp */
- // memset(Cmds, 0, sizeof(Cmds));
- // sprintf(Cmds, "/usr/local/bin/ArpSwitch.sh %s %d", IfcName, (!ArpSuspend) ? ARP_IGNORE_ON : ARP_IGNORE_OFF);
- // safe_system (Cmds);
- // /* Perform commands for BMC-generated Arp ends */
- // }
-
- // /* Update Status */
- // Status = ArpSuspend << 1;
- // Status = Status | GratArpSuspend;
- // return Status;
- // }
- // /**
- // *@fn NwInterfacePresenceCheck
- // *@brief This function is invoked to check network interface presence
- // *@param Interface - Char Pointer to Interface for which interface to check
- // *@return Returns 0 on success
- // */
- // static int
- // NwInterfacePresenceCheck (char * Interface)
- // {
- // int r;
- // int sockdes;
- // struct ifreq Ifreq;
- // unsigned char MAC[MAC_ADDR_LEN];
- // IPMI_DBG_PRINT_1 ("Checking the presence of %s\n", Interface);
- // sockdes = socket(PF_INET, SOCK_DGRAM, 0 );
- // if ( sockdes < 0 )
- // {
- // IPMI_ERROR("can't open socket: %s\n",strerror(errno));
- // return -1;
- // }
- // /* Get MAC address */
- // memset(&Ifreq,0,sizeof(struct ifreq));
- // memset(MAC, 0, MAC_ADDR_LEN);
- // strcpy(Ifreq.ifr_name, Interface);
- // Ifreq.ifr_hwaddr.sa_family = AF_INET;
- // r = ioctl(sockdes, SIOCGIFHWADDR, &Ifreq);
- // close (sockdes);
- // if ( r < 0 )
- // {
- // //IPMI_ERROR("IOCTL to get MAC failed: %d\n",r);
- // return -1;
- // }
- // IPMI_DBG_PRINT_1 (" %s Interface is present\n", Interface);
- // return 0;
- // }
|