LANConfig.c 133 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166
  1. // /*****************************************************************
  2. // *****************************************************************
  3. // *** **
  4. // *** (C)Copyright 2005-2006, American Megatrends Inc. **
  5. // *** **
  6. // *** All Rights Reserved. **
  7. // *** **
  8. // *** 6145-F, Northbelt Parkway, Norcross, **
  9. // *** **
  10. // *** Georgia - 30071, USA. Phone-(770)-246-8600. **
  11. // *** **
  12. // *****************************************************************
  13. // ******************************************************************
  14. // *
  15. // * lanconfig.c
  16. // * Lan Configuration functions.
  17. // *
  18. // * Author: Bakka Ravinder Reddy <bakkar@ami.com>
  19. // *
  20. // ******************************************************************/
  21. // #define ENABLE_DEBUG_MACROS 0
  22. // #include "IPMIConf.h"
  23. // #include "LANConfig.h"
  24. // #include "MsgHndlr.h"
  25. // #include "Debug.h"
  26. // #include "Support.h"
  27. // #include "IPMI_LANConfig.h"
  28. // #include "PMConfig.h"
  29. // #include "SharedMem.h"
  30. // #include "IPMIDefs.h"
  31. // #include "NVRAccess.h"
  32. // #include "Util.h"
  33. // #include "Session.h"
  34. // #include "WDT.h"
  35. // #include "LANIfc.h"
  36. // #include "AppDevice.h"
  37. // #include "RMCP+.h"
  38. // #include "IPMI_Main.h"
  39. // #include "IPMI_LANConfig.h"
  40. // #include "nwcfg.h"
  41. // #include "PendTask.h"
  42. // #include "Ciphertable.h"
  43. // #include "Ethaddr.h"
  44. // #include "sendarp.h"
  45. // #include "PDKAccess.h"
  46. // #include "Message.h"
  47. // #include <linux/if.h>
  48. // #include "Badpasswd.h"
  49. // #include "libncsiconf.h"
  50. // #include <linux/ip.h>
  51. // #include <dlfcn.h>
  52. // #include <sys/prctl.h>
  53. // #include "featuredef.h"
  54. // #include <flashlib.h>
  55. // #include <libphyconf.h>
  56. // #include "safesystem.h"
  57. // /* Reserved bit macro definitions */
  58. // #define RESERVED_BITS_SUSPENDBMCARPS 0xF0 //(BIT7 | BIT6 | BIT5 | BIT4)
  59. // #define RESERVED_BITS_GETIPUDPRMCPSTATS_CH 0xF0 //(BIT7 | BIT6 | BIT5 | BIT4)
  60. // #define RESERVED_BITS_GETIPUDPRMCPSTATS_CLRSTATE 0xFE //(BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1)
  61. // /*** Local definitions ***/
  62. // #define CHANNEL_ID_MASK 0x0f
  63. // #define SET_IN_PROGRESS_MASK 0x03
  64. // #define PARAMETER_REVISION_MASK 0x0f
  65. // #define DEST_ADDR_DATA2_ADDR_FORMAT_MASK 0xf0
  66. // #define PARAMETER_REVISION_FORMAT 0x11
  67. // #define GET_PARAMETER_REVISION_MASK 0x80
  68. // #define LAN_CALLBACK_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
  69. // #define LAN_USER_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
  70. // #define LAN_OPERATOR_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
  71. // #define LAN_ADMIN_AUTH_SUPPORT 0x17 /* MD2 & MD5 supported */
  72. // #define BRD_CAST_BIT_MASK 0xFF
  73. // #define LOOP_BACK_BIT_MASK 0x7F
  74. // #define SUBNET_MASK_BIT_CHECK 0x80
  75. // #define LAN_CONFIGURATION_SET_IN_PROGRESS 0x01
  76. // #define LAN_CONFIGURATION_SET_COMPLETE 0x00
  77. // #define GRATIUTOUS_ENABLE_MASK 1
  78. // #define ENABLE_ARP_RESPONSES 2
  79. // #define SUSPEND_ARP_RSVD_BIT_MASK 0xFC
  80. // #define ENABLE_ARPS 0x03
  81. // #define SUSPEND_GRAT_ARP 0x01
  82. // #define SUSPEND_ARP 0x02
  83. // #define ARP_IGNORE_ON 8
  84. // #define ARP_IGNORE_OFF 0
  85. // /* Reserved Bits */
  86. // #define RESERVED_VALUE_70 0x70
  87. // #define RESERVED_VALUE_F0 0xF0
  88. // /**
  89. // *@fn NwInterfacePresenceCheck
  90. // *@brief This function is invoked to check network interface presence
  91. // *@param Interface - Char Pointer to buffer for which interface to check
  92. // */
  93. // static int NwInterfacePresenceCheck (char * Interface);
  94. // /*** Module Variables ***/
  95. // //_FAR_ INT8U m_ArpSuspendReq;
  96. // char **explode(char separator, char *string);
  97. // int IPAddrCheck(INT8U *Addr,int params);
  98. // extern int GetLanAMIParamValue (INT8U* ParamSelect, INT8U* ImpType);
  99. // extern IfcName_T Ifcnametable[MAX_LAN_CHANNELS];
  100. // #define MAX_LAN_PARAMS_DATA 20
  101. // typedef struct
  102. // {
  103. // INT8U Params;
  104. // INT8U ReservedBits [MAX_LAN_PARAMS_DATA];
  105. // INT8U DataLen;
  106. // } LANCfgRsvdBits_T;
  107. // static LANCfgRsvdBits_T m_RsvdBitsCheck [] = {
  108. // /* Param Reserved Bits Data Size */
  109. // { 0, { 0xFC }, 0x1 }, /* Set In progress */
  110. // { 1, { 0xC8 }, 0x1 }, /* Authenication type */
  111. // { 2, { 0xC8,0xC8,0xC8,0xC8,0xC8 }, 0x5}, /* Authenication Support Enable */
  112. // { 4, { 0xF0 }, 0x1 }, /* l */
  113. // { 7, { 0x0,0x1F,0x01 }, 0x3 }, /* l */
  114. // { 0xA, { 0xFC }, 0x1 }, /* l */
  115. // { 0x11, { 0xF0 }, 0x1 }, /* l */
  116. // { 0x12, { 0xF0,0x78,0x0,0xF8 }, 0x4 },
  117. // { 0x13, { 0xF0,0x0F, 0xFE }, 0x3 },
  118. // { 0x14, { 0x0,0x70}, 0x2 },
  119. // { 0x15, { 0xF8 }, 0x1 },
  120. // { 0x16, { 0xE0 }, 0x1 },
  121. // { 0x17, { 0xFF }, 0x1 },
  122. // { 0x18, { 0xFF }, 0x1 },
  123. // { 0x19, { 0xF0,0x0F }, 0x2 },
  124. // { 0x1A, { 0xFE }, 0x1 }
  125. // };
  126. // typedef struct
  127. // {
  128. // INT8U OEMParam;
  129. // INT8U Length;
  130. // }OEMParameterLength_T;
  131. // static OEMParameterLength_T m_OEMParamLen [] = {
  132. // {LAN_PARAMS_AMI_OEM_IPV6_ENABLE, 1 },
  133. // {LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE, 1 },
  134. // {LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR, 17 },
  135. // {LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH, 2},
  136. // {LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP, 16}
  137. // };
  138. // /**
  139. // * @brief LAN configuration request parameter lengths
  140. // **/
  141. // static const INT8U LanconfigParameterLength [] = {
  142. // 1, /* Set in progress */
  143. // 1, /* Authentication type support */
  144. // 5, /* Authentication type enables */
  145. // 4, /* IP address */
  146. // 1, /* IP address source */
  147. // 6, /* MAC address */
  148. // 4, /* Subnet mask */
  149. // 3, /* IPv4 header parameters */
  150. // 2, /* Primary RMCP port number */
  151. // 2, /* Secondary RMCP port number */
  152. // 1, /* BMC generated ARP control */
  153. // 1, /* Gratuitous ARP */
  154. // 4, /* Default Gateway address */
  155. // 6, /* Default Gateway MAC address */
  156. // 4, /* Backup Gateway address */
  157. // 6, /* Backup Gateway MAC address */
  158. // 18, /* Community string */
  159. // 1, /* Number of destinations */
  160. // 4, /* Destination type */
  161. // 13, /* Destination address */
  162. // 2, /* VLAN ID */
  163. // 1, /* VLAN Priority */
  164. // 1, /* Cipher suite entry support */
  165. // 17, /* Cipher suite entries */
  166. // 9, /* Cipher suite Privilege levels */
  167. // 4, /* VLAN tags destination address */
  168. // 6, /* Bad Password Threshold */
  169. // (9+16) /* IPv6 Destination address */
  170. // };
  171. // /* A copy of ip_tos2prio with numeric format in "linux/net/ipv4/route.c" */
  172. // static const INT8U IP_TOS2PRIO[16] = {
  173. // 0, /* TC_PRIO_BESTEFFORT, */
  174. // 1, /* ECN_OR_COST(FILLER), */
  175. // 0, /* TC_PRIO_BESTEFFORT, */
  176. // 0, /* ECN_OR_COST(BESTEFFORT), */
  177. // 2, /* TC_PRIO_BULK, */
  178. // 2, /* ECN_OR_COST(BULK), */
  179. // 2, /* TC_PRIO_BULK, */
  180. // 2, /* ECN_OR_COST(BULK), */
  181. // 6, /* TC_PRIO_INTERACTIVE, */
  182. // 6, /* ECN_OR_COST(INTERACTIVE), */
  183. // 6, /* TC_PRIO_INTERACTIVE, */
  184. // 6, /* ECN_OR_COST(INTERACTIVE), */
  185. // 4, /* TC_PRIO_INTERACTIVE_BULK, */
  186. // 4, /* ECN_OR_COST(INTERACTIVE_BULK),*/
  187. // 4, /* TC_PRIO_INTERACTIVE_BULK, */
  188. // 4 /* ECN_OR_COST(INTERACTIVE_BULK) */
  189. // };
  190. // static BOOL enableSetMACAddr = FALSE; //jimbo notice
  191. // /*-------------------------------------------------------
  192. // * SetLanConfigParam
  193. // *-------------------------------------------------------*/
  194. // int
  195. // SetLanConfigParam (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
  196. // {
  197. // _NEAR_ SetLanConfigReq_T* pSetLanReq = (_NEAR_ SetLanConfigReq_T*) pReq;
  198. // _NEAR_ SetLanConfigRes_T* pSetLanRes = (_NEAR_ SetLanConfigRes_T*) pRes;
  199. // _FAR_ BMCSharedMem_T* pSharedMem = BMC_GET_SHARED_MEM (BMCInst);
  200. // _FAR_ ChannelInfo_T* ptrChannelInfo;
  201. // _FAR_ BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
  202. // NWCFG_STRUCT NWConfig;
  203. // NWCFG6_STRUCT NWConfig6;
  204. // INT32U GWIp,IPAddr;
  205. // INT32U Subnetmask;
  206. // int i,j=0;
  207. // INT8U IsOemDefined = FALSE;
  208. // INT8U EthIndex,netindex= 0xFF, currBmcGenArpCtrl;
  209. // BMCArg *pLANArg=NULL;
  210. // char VLANInterfaceName [32];
  211. // INT16U vlanID=0;
  212. // INT16U InvalidVlanID[3]={0,1,4095};
  213. // char cmdSetPriority[32];
  214. // int retValue=0,NIC_Count = 0;
  215. // INT16U PriorityLevel[MAX_LAN_CHANNELS]= {0};
  216. // INT8U m_Lan_SetInProgress; /**< Contains setting LAN configuration status */
  217. // ETHCFG_STRUCT PHYCfg;
  218. // static INT8U macEthIndex = 0xFF;
  219. // INT8U TOS = 0, SkbPriority = 0; /* For VLAN priority parameter */
  220. // int pendStatus = PEND_STATUS_COMPLETED;
  221. // char IfcName[16]; /* Eth interface name */
  222. // if ( ReqLen >= 2 )
  223. // {
  224. // ReqLen -= 2;
  225. // }
  226. // else
  227. // {
  228. // *pRes = CC_REQ_INV_LEN;
  229. // return sizeof (INT8U);
  230. // }
  231. // if(g_corefeatures.dual_image_support == ENABLED)
  232. // {
  233. // if(IsCardInFlashMode())
  234. // {
  235. // IPMI_WARNING("Card in Active flash mode, Not safe to set any of LAN configurations...\n");
  236. // *pRes = CC_DEV_IN_FIRMWARE_UPDATE_MODE;
  237. // return sizeof (*pRes);
  238. // }
  239. // }
  240. // EthIndex= GetEthIndex(pSetLanReq->ChannelNum & 0x0F, BMCInst);
  241. // if(0xff == EthIndex)
  242. // {
  243. // *pRes = CC_INV_DATA_FIELD;
  244. // return sizeof (INT8U);
  245. // }
  246. // memset(IfcName,0,sizeof(IfcName));
  247. // /*Get the EthIndex*/
  248. // if(GetIfcName(EthIndex,IfcName, BMCInst) == -1)
  249. // {
  250. // TCRIT("Error in Getting Ifc name\n");
  251. // *pRes = CC_INV_DATA_FIELD;
  252. // return sizeof (INT8U);
  253. // }
  254. // for(i=0;i<sizeof(Ifcnametable)/sizeof(IfcName_T);i++)
  255. // {
  256. // if(strcmp(Ifcnametable[i].Ifcname,IfcName) == 0)
  257. // {
  258. // netindex= Ifcnametable[i].Index;
  259. // break;
  260. // }
  261. // }
  262. // if(netindex == 0xFF)
  263. // {
  264. // *pRes = CC_INV_DATA_FIELD;
  265. // return sizeof (INT8U);
  266. // }
  267. // if((pSetLanReq->ParameterSelect >= MIN_LAN_OEM_CONF_PARAM) &&
  268. // (pSetLanReq->ParameterSelect <= MAX_LAN_OEM_CONF_PARAM) )
  269. // {
  270. // /* Converts OEM parameter value to equivalent AMI parameter value */
  271. // if (0 != GetLanAMIParamValue (&pSetLanReq->ParameterSelect, &IsOemDefined) )
  272. // {
  273. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  274. // return sizeof(INT8U);
  275. // }
  276. // /* Hook for OEM to handle this parameter */
  277. // if ( (IsOemDefined) && (g_PDKHandle[PDK_SETLANOEMPARAM] != NULL) )
  278. // {
  279. // return ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_SETLANOEMPARAM]))(pReq, ReqLen, pRes, BMCInst);
  280. // }
  281. // }
  282. // if(0x1b >pSetLanReq->ParameterSelect ) //Max known Lan paramter
  283. // {
  284. // if (ReqLen != LanconfigParameterLength [pSetLanReq->ParameterSelect ])
  285. // {
  286. // *pRes = CC_REQ_INV_LEN;
  287. // return sizeof (INT8U);
  288. // }
  289. // }
  290. // /*Check the Request length for OEM parameter*/
  291. // for(i=0;i<sizeof(m_OEMParamLen)/sizeof(OEMParameterLength_T);i++)
  292. // {
  293. // if(m_OEMParamLen[i].OEMParam == pSetLanReq->ParameterSelect)
  294. // {
  295. // if(ReqLen != m_OEMParamLen[i].Length)
  296. // {
  297. // *pRes = CC_REQ_INV_LEN;
  298. // return sizeof(INT8U);
  299. // }
  300. // }
  301. // }
  302. // if(pSetLanReq->ChannelNum & RESERVED_VALUE_F0)
  303. // {
  304. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  305. // *pRes = CC_INV_DATA_FIELD;
  306. // return sizeof (*pRes);
  307. // }
  308. // /* Check for Reserved Bits */
  309. // for (i = 0; i < sizeof (m_RsvdBitsCheck)/ sizeof (m_RsvdBitsCheck[0]); i++)
  310. // {
  311. // /* Check if this Parameter Selector needs Reserved bit checking !! */
  312. // if (m_RsvdBitsCheck[i].Params == pSetLanReq->ParameterSelect)
  313. // {
  314. // //IPMI_DBG_PRINT_2 ("Param - %x, DataLen - %x\n", pSetLanReq->ParameterSelect, m_RsvdBitsCheck[i].DataLen);
  315. // for (j = 0; j < m_RsvdBitsCheck[i].DataLen; j++)
  316. // {
  317. // // IPMI_DBG_PRINT_2 ("Cmp %x, %x\n", pReq[2+j], m_RsvdBitsCheck[i].ReservedBits[j]);
  318. // if ( 0 != (pReq[2+j] & m_RsvdBitsCheck[i].ReservedBits[j]))
  319. // {
  320. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  321. // *pRes = CC_INV_DATA_FIELD;
  322. // return sizeof (*pRes);
  323. // }
  324. // }
  325. // }
  326. // }
  327. // ptrChannelInfo = getChannelInfo (pSetLanReq->ChannelNum & 0x0F, BMCInst);
  328. // if(NULL == ptrChannelInfo)
  329. // {
  330. // *pRes = CC_INV_DATA_FIELD;
  331. // return sizeof(*pRes);
  332. // }
  333. // IPMI_DBG_PRINT_1 ("Parameter = %X\n", pSetLanReq->ParameterSelect);
  334. // if (g_PDKHandle[PDK_BEFORESETLANPARM] != NULL )
  335. // {
  336. // retValue = ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_BEFORESETLANPARM]))(pReq, ReqLen, pRes, BMCInst);
  337. // if(retValue != 0)
  338. // {
  339. // return retValue;
  340. // }
  341. // }
  342. // if((pSetLanReq->ParameterSelect == LAN_PARAM_SELECT_DEST_ADDR) ||
  343. // (pSetLanReq->ParameterSelect == LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR))
  344. // {
  345. // /*Destination Address is allowed to configure only if DestType is LAN_PET_TRAP(SNMP alerts types)*/
  346. // if(pBMCInfo->LANCfs[EthIndex].DestType [pSetLanReq->ConfigData.DestAddr.SetSelect - 1].DestType == LAN_OEM1_ALERT)
  347. // {
  348. // *pRes = CC_INV_DATA_FIELD;
  349. // return sizeof (INT8U);
  350. // }
  351. // }
  352. // switch (pSetLanReq->ParameterSelect)
  353. // {
  354. // case LAN_PARAM_SET_IN_PROGRESS:
  355. // LOCK_BMC_SHARED_MEM(BMCInst);
  356. // m_Lan_SetInProgress = BMC_GET_SHARED_MEM(BMCInst)->m_Lan_SetInProgress;
  357. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  358. // /* Commit Write is optional and supported
  359. // * only if rollback is supported */
  360. // if ( (GetBits(pSetLanReq->ConfigData.SetInProgress, SET_IN_PROGRESS_MASK) !=
  361. // LAN_CONFIGURATION_SET_COMPLETE) &&
  362. // (GetBits(pSetLanReq->ConfigData.SetInProgress, SET_IN_PROGRESS_MASK) !=
  363. // LAN_CONFIGURATION_SET_IN_PROGRESS) )
  364. // {
  365. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  366. // return sizeof(*pSetLanRes);
  367. // }
  368. // else if ((GetBits(m_Lan_SetInProgress, SET_IN_PROGRESS_MASK) ==
  369. // LAN_CONFIGURATION_SET_IN_PROGRESS) &&
  370. // (GetBits(pSetLanReq->ConfigData.SetInProgress, SET_IN_PROGRESS_MASK) ==
  371. // LAN_CONFIGURATION_SET_IN_PROGRESS))
  372. // {
  373. // pSetLanRes->CompletionCode = CC_SET_IN_PROGRESS;
  374. // return sizeof(*pSetLanRes);
  375. // }
  376. // LOCK_BMC_SHARED_MEM(BMCInst);
  377. // BMC_GET_SHARED_MEM(BMCInst)->m_Lan_SetInProgress = pSetLanReq->ConfigData.SetInProgress;
  378. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  379. // break;
  380. // case LAN_PARAM_AUTH_TYPE_SUPPORT:
  381. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  382. // return sizeof(*pRes);
  383. // case LAN_PARAM_AUTH_TYPE_ENABLES:
  384. // for(i=0;i<5;i++)
  385. // {
  386. // /* Check for Unsupported AuthType */
  387. // if (pBMCInfo->LANCfs[EthIndex].AuthTypeSupport != (pBMCInfo->LANCfs[EthIndex].AuthTypeSupport |pReq[2+i]))
  388. // {
  389. // IPMI_DBG_PRINT_2("\n Alarm !!! Somebody is trying to Unsupported Bit :%d \t%d\n",pReq[2+i],i);
  390. // *pRes = CC_INV_DATA_FIELD;
  391. // return sizeof (*pRes);
  392. // }
  393. // }
  394. // LOCK_BMC_SHARED_MEM(BMCInst);
  395. // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].AuthTypeEnables,
  396. // &(pSetLanReq->ConfigData.AuthTypeEnables), sizeof(AuthTypeEnables_T));
  397. // _fmemcpy (ptrChannelInfo->AuthType,
  398. // &(pSetLanReq->ConfigData.AuthTypeEnables), sizeof(AuthTypeEnables_T));
  399. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  400. // break;
  401. // case LAN_PARAM_IP_ADDRESS:
  402. // pendStatus = GetPendStatus(PEND_OP_SET_IP);
  403. // if(pendStatus == PEND_STATUS_PENDING)
  404. // {
  405. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  406. // return sizeof (INT8U);
  407. // }
  408. // //we need to do a read in hte pend task and not here
  409. // // because if pend task is still working on setting the source for example t- by then we would have got the
  410. // // 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.
  411. // //nwReadNWCfg (&NWConfig);
  412. // if(pBMCInfo->LANCfs[EthIndex].IPAddrSrc == DHCP_IP_SOURCE)
  413. // {
  414. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  415. // return sizeof (INT8U);
  416. // }
  417. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  418. // if(memcmp ( NWConfig.IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN ) == 0)
  419. // {
  420. // TCRIT("Same IP address, do nothing\n");
  421. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN);
  422. // break;
  423. // }
  424. // if(IPAddrCheck(pSetLanReq->ConfigData.IPAddr,LAN_PARAM_IP_ADDRESS))
  425. // {
  426. // *pRes = CC_INV_DATA_FIELD;
  427. // return sizeof (INT8U);
  428. // }
  429. // pendStatus = GetPendStatus(PEND_OP_SET_IP);
  430. // if(pendStatus == PEND_STATUS_PENDING)
  431. // {
  432. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  433. // return sizeof (INT8U);
  434. // }
  435. // _fmemcpy (NWConfig.IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN);
  436. // SetPendStatus(PEND_OP_SET_IP,PEND_STATUS_PENDING);
  437. // PostPendTask(PEND_OP_SET_IP,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
  438. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].IPAddr, pSetLanReq->ConfigData.IPAddr, IP_ADDR_LEN);
  439. // //nwWriteNWCfg (&NWConfig);
  440. // break;
  441. // case LAN_PARAM_IP_ADDRESS_SOURCE:
  442. // if ((pSetLanReq->ConfigData.IPAddrSrc > BMC_OTHER_SOURCE)
  443. // ||(pSetLanReq->ConfigData.IPAddrSrc == UNSPECIFIED_IP_SOURCE))
  444. // {
  445. // *pRes = CC_INV_DATA_FIELD;
  446. // return sizeof (INT8U);
  447. // }
  448. // if ( pBMCInfo->LANCfs[EthIndex].IPAddrSrc == pSetLanReq->ConfigData.IPAddrSrc )
  449. // {
  450. // TCRIT("LAN or VLAN if current SRC is DHCP/Static and incoming SRC is DHCP/Static, do nothing\n");
  451. // break;
  452. // }
  453. // if(!((pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE )))
  454. // pBMCInfo->LANCfs[EthIndex].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
  455. // if ( (pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE ) )
  456. // {
  457. // pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
  458. // if(pendStatus == PEND_STATUS_PENDING)
  459. // {
  460. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  461. // return sizeof (INT8U);
  462. // }
  463. // pBMCInfo->LANCfs[EthIndex].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
  464. // NWConfig.CfgMethod = pSetLanReq->ConfigData.IPAddrSrc;
  465. // SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
  466. // PostPendTask(PEND_OP_SET_SOURCE,(INT8U*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  467. // }
  468. // else if(pSetLanReq->ConfigData.IPAddrSrc == BIOS_IP_SOURCE)
  469. // {
  470. // /*Perform OEM action*/
  471. // if(g_PDKHandle[PDK_BIOSIPSOURCE] != NULL)
  472. // {
  473. // retValue = ((int(*)(INT8U))g_PDKHandle[PDK_BIOSIPSOURCE]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
  474. // if(retValue == 1)
  475. // {
  476. // *pRes = CC_INV_DATA_FIELD;
  477. // return sizeof (*pRes);
  478. // }
  479. // }
  480. // else
  481. // {
  482. // pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
  483. // if(pendStatus == PEND_STATUS_PENDING)
  484. // {
  485. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  486. // return sizeof (INT8U);
  487. // }
  488. // NWConfig.CfgMethod = STATIC_IP_SOURCE;
  489. // SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
  490. // PostPendTask(PEND_OP_SET_SOURCE, (INT8U*) &NWConfig,sizeof(NWConfig), (pSetLanReq->ChannelNum & CHANNEL_ID_MASK), BMCInst );
  491. // }
  492. // }
  493. // else if(pSetLanReq->ConfigData.IPAddrSrc == BMC_OTHER_SOURCE)
  494. // {
  495. // /*Perform OEM action*/
  496. // if(g_PDKHandle[PDK_BMCOTHERSOURCEIP] != NULL)
  497. // {
  498. // retValue = ((int(*)(INT8U))g_PDKHandle[PDK_BMCOTHERSOURCEIP]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
  499. // if(retValue == 1)
  500. // {
  501. // *pRes = CC_INV_DATA_FIELD;
  502. // return sizeof (*pRes);
  503. // }
  504. // }
  505. // else
  506. // {
  507. // *pRes = CC_INV_DATA_FIELD;
  508. // return sizeof (*pRes);
  509. // }
  510. // }
  511. // break;
  512. // case LAN_PARAM_MAC_ADDRESS:
  513. // #if 0
  514. // nwReadNWCfg (&NWConfig);
  515. // 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] );
  516. // _fmemcpy (NWConfig.MAC, pSetLanReq->ConfigData.MACAddr, MAC_ADDR_LEN);
  517. // 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] );
  518. // nwWriteNWCfg (&NWConfig);
  519. // #else
  520. // /* According to IPMI 2.0 Specification Revision 3, the MAC address can be read only parameter*/
  521. // //*pRes = CC_ATTEMPT_TO_SET_RO_PARAM;
  522. // //return sizeof (*pRes);
  523. // if (!enableSetMACAddr)
  524. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  525. // else
  526. // {
  527. // EnableSetMACAddress_T macAddrEnabled;
  528. // INT8U InvalidMac[MAC_ADDR_LEN] = {0};
  529. // if((pSetLanReq->ConfigData.MACAddr[0]& BIT0)|| (memcmp(&InvalidMac,&pSetLanReq->ConfigData.MACAddr,MAC_ADDR_LEN) == 0))
  530. // {
  531. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  532. // return sizeof(INT8U);
  533. // }
  534. // memset(&macAddrEnabled, 0, sizeof(EnableSetMACAddress_T));
  535. // macAddrEnabled.EthIndex = macEthIndex;
  536. // memcpy(&macAddrEnabled.MACAddress, &pSetLanReq->ConfigData.MACAddr, MAC_ADDR_LEN);
  537. // pendStatus = GetPendStatus(PEND_OP_SET_MAC_ADDRESS);
  538. // if(pendStatus == PEND_STATUS_PENDING)
  539. // {
  540. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  541. // return sizeof (INT8U);
  542. // }
  543. // SetPendStatus(PEND_OP_SET_MAC_ADDRESS, PEND_STATUS_PENDING);
  544. // PostPendTask(PEND_OP_SET_MAC_ADDRESS, (INT8U*)&macAddrEnabled, sizeof(EnableSetMACAddress_T), (pSetLanReq->ChannelNum & 0x0F), BMCInst);
  545. // enableSetMACAddr = FALSE;
  546. // macEthIndex = 0xFF;
  547. // pSetLanRes->CompletionCode = CC_NORMAL;
  548. // }
  549. // return sizeof(*pSetLanRes);
  550. // #endif
  551. // case LAN_PARAM_SUBNET_MASK:
  552. // pendStatus = GetPendStatus(PEND_OP_SET_SUBNET);
  553. // if(pendStatus == PEND_STATUS_PENDING)
  554. // {
  555. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  556. // return sizeof (INT8U);
  557. // }
  558. // /*Returning valid completion code in case of attempt to set netmask in DHCP mode */
  559. // if(pBMCInfo->LANCfs[EthIndex].IPAddrSrc == DHCP_IP_SOURCE)
  560. // {
  561. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  562. // return sizeof (INT8U);
  563. // }
  564. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  565. // if(memcmp ( NWConfig.Mask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN ) == 0)
  566. // {
  567. // TCRIT("Same Mask, do nothing\n");
  568. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].SubNetMask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN);
  569. // break;
  570. // }
  571. // if(IPAddrCheck(pSetLanReq->ConfigData.SubNetMask,LAN_PARAM_SUBNET_MASK))
  572. // {
  573. // *pRes = CC_INV_DATA_FIELD;
  574. // return sizeof (INT8U);
  575. // }
  576. // _fmemcpy (NWConfig.Mask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN);
  577. // SetPendStatus(PEND_OP_SET_SUBNET,PEND_STATUS_PENDING);
  578. // PostPendTask(PEND_OP_SET_SUBNET,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F) , BMCInst);
  579. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].SubNetMask, pSetLanReq->ConfigData.SubNetMask, IP_ADDR_LEN);
  580. // break;
  581. // case LAN_PARAM_IPv4_HEADER:
  582. // pendStatus = GetPendStatus(PEND_OP_SET_IPV4_HEADERS);
  583. // if(pendStatus == PEND_STATUS_PENDING)
  584. // {
  585. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  586. // return sizeof (INT8U);
  587. // }
  588. // if(!pSetLanReq->ConfigData.Ipv4HdrParam.TimeToLive > 0)
  589. // {
  590. // IPMI_DBG_PRINT("The requested IPv4 header(TTL) to set is invalid.\n");
  591. // *pRes = CC_PARAM_OUT_OF_RANGE;
  592. // return sizeof(*pRes);
  593. // }
  594. // if(pSetLanReq->ConfigData.Ipv4HdrParam.IpHeaderFlags == 0x60) // Flags can be either of the values: DF(0x40) or MF(0x20)
  595. // {
  596. // IPMI_DBG_PRINT("The requested IPv4 header(Flags) to set is invalid.\n");
  597. // *pRes = CC_PARAM_OUT_OF_RANGE;
  598. // return sizeof(*pRes);
  599. // }
  600. // LOCK_BMC_SHARED_MEM(BMCInst);
  601. // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam,
  602. // &pSetLanReq->ConfigData.Ipv4HdrParam, sizeof(IPv4HdrParams_T));
  603. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  604. // SetPendStatus(PEND_OP_SET_IPV4_HEADERS,PEND_STATUS_PENDING);
  605. // PostPendTask(PEND_OP_SET_IPV4_HEADERS, (INT8U*)&(pSetLanReq->ConfigData.Ipv4HdrParam),
  606. // sizeof(pSetLanReq->ConfigData.Ipv4HdrParam),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
  607. // break;
  608. // case LAN_PARAM_PRI_RMCP_PORT:
  609. // pendStatus = GetPendStatus(PEND_RMCP_PORT_CHANGE);
  610. // if(pendStatus == PEND_STATUS_PENDING)
  611. // {
  612. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  613. // return sizeof (INT8U);
  614. // }
  615. // LOCK_BMC_SHARED_MEM(BMCInst);
  616. // pBMCInfo->LANCfs[EthIndex].PrimaryRMCPPort = ipmitoh_u16 (pSetLanReq->ConfigData.PrimaryRMCPPort);
  617. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  618. // SetPendStatus(PEND_RMCP_PORT_CHANGE,PEND_STATUS_PENDING);
  619. // PostPendTask(PEND_RMCP_PORT_CHANGE,(INT8U*)&(pSetLanReq->ConfigData.PrimaryRMCPPort),
  620. // sizeof(pSetLanReq->ConfigData.PrimaryRMCPPort),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
  621. // break;
  622. // case LAN_PARAM_SEC_RMCP_PORT:
  623. // /* Returning Invalid error message */
  624. // *pRes = CC_PARAM_NOT_SUPPORTED;
  625. // return sizeof (INT8U);
  626. // /*pPMConfig->LANConfig[EthIndex].SecondaryPort = ipmitoh_u16 (pSetLanReq->ConfigData.SecondaryPort);*/
  627. // break;
  628. // case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
  629. // currBmcGenArpCtrl = pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl;
  630. // if(currBmcGenArpCtrl != pSetLanReq->ConfigData.BMCGeneratedARPControl)
  631. // pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl = pSetLanReq->ConfigData.BMCGeneratedARPControl;
  632. // if((ENABLE_ARP_RESPONSES & currBmcGenArpCtrl) !=
  633. // (ENABLE_ARP_RESPONSES & pSetLanReq->ConfigData.BMCGeneratedARPControl))
  634. // {
  635. // UpdateArpStatus(EthIndex, BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning, BMCInst);
  636. // }
  637. // if(!(GRATIUTOUS_ENABLE_MASK & currBmcGenArpCtrl) &&
  638. // (GRATIUTOUS_ENABLE_MASK & pSetLanReq->ConfigData.BMCGeneratedARPControl))
  639. // {
  640. // /* Create a thread to Send Gratuitous ARP Packet */
  641. // pLANArg = malloc(sizeof(BMCArg));
  642. // pLANArg->BMCInst = BMCInst;
  643. // pLANArg->Len = strlen((char *)&EthIndex);
  644. // pLANArg->Argument = malloc(pLANArg->Len);
  645. // memcpy(pLANArg->Argument,(char *)&EthIndex,pLANArg->Len);
  646. // OS_CREATE_THREAD ((void *)GratuitousARPTask,(void *)pLANArg, NULL);
  647. // }
  648. // break;
  649. // case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
  650. // pBMCInfo->LANCfs[EthIndex].GratitousARPInterval =
  651. // pSetLanReq->ConfigData.GratitousARPInterval;
  652. // break;
  653. // case LAN_PARAM_DEFAULT_GATEWAY_IP:
  654. // pendStatus = GetPendStatus(PEND_OP_SET_GATEWAY);
  655. // if(pendStatus == PEND_STATUS_PENDING)
  656. // {
  657. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  658. // return sizeof (INT8U);
  659. // }
  660. // /*Returning valid completion code in case of attempt to set default gateway ip in DHCP mode */
  661. // if(pBMCInfo->LANCfs[EthIndex].IPAddrSrc == DHCP_IP_SOURCE)
  662. // {
  663. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  664. // return sizeof (INT8U);
  665. // }
  666. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  667. // if(memcmp ( NWConfig.Gateway, pSetLanReq->ConfigData.DefaultGatewayIPAddr, IP_ADDR_LEN ) == 0)
  668. // {
  669. // TCRIT("Same Gateway, do nothing\n");
  670. // _fmemcpy(pBMCInfo->LANCfs[EthIndex].DefaultGatewayIPAddr, pSetLanReq->ConfigData.DefaultGatewayIPAddr,IP_ADDR_LEN);
  671. // break;
  672. // }
  673. // if(IPAddrCheck(pSetLanReq->ConfigData.DefaultGatewayIPAddr,LAN_PARAM_DEFAULT_GATEWAY_IP))
  674. // {
  675. // *pRes = CC_INV_DATA_FIELD;
  676. // return sizeof (INT8U);
  677. // }
  678. // _fmemcpy ((INT8U*)&GWIp,pSetLanReq->ConfigData.DefaultGatewayIPAddr, IP_ADDR_LEN);
  679. // _fmemcpy ((INT8U*)&Subnetmask,&NWConfig.Mask[0],IP_ADDR_LEN);
  680. // _fmemcpy ((INT8U*)&IPAddr,&NWConfig.IPAddr[0], IP_ADDR_LEN);
  681. // /* Allowing When the Default Gateway is Zero without validation to clear the Default Gateway */
  682. // if(GWIp != 0)
  683. // {
  684. // _fmemcpy ((INT8U*)&Subnetmask,pBMCInfo->LANCfs[EthIndex].SubNetMask,IP_ADDR_LEN);
  685. // _fmemcpy ((INT8U*)&IPAddr,pBMCInfo->LANCfs[EthIndex].IPAddr, IP_ADDR_LEN);
  686. // if((IPAddr & Subnetmask ) != (GWIp & Subnetmask))
  687. // {
  688. // IPMI_DBG_PRINT("\n Default GatewayIP to set is not valid \n");
  689. // *pRes = CC_INV_DATA_FIELD;
  690. // return sizeof (INT8U);
  691. // }
  692. // }
  693. // _fmemcpy (NWConfig.Gateway,pSetLanReq->ConfigData.DefaultGatewayIPAddr, IP_ADDR_LEN);
  694. // LOCK_BMC_SHARED_MEM(BMCInst);
  695. // _fmemcpy(pBMCInfo->LANCfs[EthIndex].DefaultGatewayIPAddr,
  696. // pSetLanReq->ConfigData.DefaultGatewayIPAddr,IP_ADDR_LEN);
  697. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  698. // SetPendStatus(PEND_OP_SET_GATEWAY,PEND_STATUS_PENDING);
  699. // PostPendTask(PEND_OP_SET_GATEWAY,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  700. // break;
  701. // case LAN_PARAM_DEFAULT_GATEWAY_MAC:
  702. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  703. // return sizeof(*pRes);
  704. // break;
  705. // case LAN_PARAM_BACKUP_GATEWAY_IP:
  706. // nwReadNWCfg_v4_v6( &NWConfig,&NWConfig6, netindex,g_corefeatures.global_ipv6);
  707. // _fmemcpy ((INT8U*)&GWIp,pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
  708. // _fmemcpy ((INT8U*)&Subnetmask,&NWConfig.Mask[0],IP_ADDR_LEN);
  709. // _fmemcpy ((INT8U*)&IPAddr,&NWConfig.IPAddr[0], IP_ADDR_LEN);
  710. // if(GWIp != 0)
  711. // {
  712. // if((IPAddr & Subnetmask ) != (GWIp & Subnetmask))
  713. // {
  714. // IPMI_DBG_PRINT("\n Backup GatewayIP to set is not valid \n");
  715. // *pRes = CC_INV_DATA_FIELD;
  716. // return sizeof (INT8U);
  717. // }
  718. // }
  719. // LOCK_BMC_SHARED_MEM(BMCInst);
  720. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,
  721. // pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
  722. // nwSetBkupGWyAddr(pSetLanReq->ConfigData.BackupGatewayIPAddr,netindex);
  723. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  724. // break;
  725. // case LAN_PARAM_BACKUP_GATEWAY_MAC:
  726. // LOCK_BMC_SHARED_MEM(BMCInst);
  727. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayMACAddr,
  728. // pSetLanReq->ConfigData.BackupGatewayMACAddr, MAC_ADDR_LEN);
  729. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  730. // break;
  731. // case LAN_PARAM_COMMUNITY_STRING:
  732. // if (g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME] != NULL )
  733. // {
  734. // if(((int(*)(INT8U *, INT8U,int))(g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME]))(pSetLanReq->ConfigData.CommunityStr,MAX_COMM_STRING_SIZE, BMCInst)==0)
  735. // break;
  736. // }
  737. // OS_THREAD_MUTEX_ACQUIRE(&pBMCInfo->PefConfig.PEFSharedMemMutex, WAIT_INFINITE);
  738. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CommunityStr,
  739. // pSetLanReq->ConfigData.CommunityStr, MAX_COMM_STRING_SIZE);
  740. // OS_THREAD_MUTEX_RELEASE(&pBMCInfo->PefConfig.PEFSharedMemMutex);
  741. // break;
  742. // case LAN_PARAM_DEST_NUM:
  743. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  744. // return sizeof(INT8U);
  745. // case LAN_PARAM_SELECT_DEST_TYPE:
  746. // // if (pSetLanReq->ConfigData.DestType.SetSelect > NUM_LAN_DESTINATION)
  747. // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
  748. // {
  749. // *pRes = CC_PARAM_OUT_OF_RANGE;
  750. // return sizeof (*pRes);
  751. // }
  752. // if (0 == pSetLanReq->ConfigData.DestType.SetSelect)
  753. // {
  754. // LOCK_BMC_SHARED_MEM(BMCInst);
  755. // _fmemcpy (&pSharedMem->VolLANDestType[EthIndex],
  756. // &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
  757. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  758. // }
  759. // else
  760. // {
  761. // LOCK_BMC_SHARED_MEM(BMCInst);
  762. // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestType [pSetLanReq->ConfigData.DestType.SetSelect - 1],
  763. // &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
  764. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  765. // }
  766. // break;
  767. // case LAN_PARAM_SELECT_DEST_ADDR:
  768. // pendStatus = GetPendStatus(PEND_OP_SET_GATEWAY);
  769. // if(pendStatus == PEND_STATUS_PENDING)
  770. // {
  771. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  772. // return sizeof (INT8U);
  773. // }
  774. // // if (pSetLanReq->ConfigData.DestAddr.SetSelect > NUM_LAN_DESTINATION)
  775. // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
  776. // {
  777. // *pRes = CC_PARAM_OUT_OF_RANGE ;
  778. // return sizeof (*pRes);
  779. // }
  780. // if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
  781. // {
  782. // LOCK_BMC_SHARED_MEM(BMCInst);
  783. // _fmemcpy (&pSharedMem->VolLANDest[EthIndex],
  784. // &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
  785. // memset(pSharedMem->VolLANv6Dest,0,sizeof(LANDestv6Addr_T));
  786. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  787. // }
  788. // else
  789. // {
  790. // LOCK_BMC_SHARED_MEM(BMCInst);
  791. // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestAddr [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
  792. // &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
  793. // memset( &pBMCInfo->LANCfs[EthIndex].Destv6Addr [pSetLanReq->ConfigData.Destv6Addr.SetSelect -1], 0 ,
  794. // sizeof(LANDestv6Addr_T));
  795. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  796. // }
  797. // /* Setting BackupGw to DefaultGw as per request to send trap */
  798. // if(pSetLanReq->ConfigData.DestAddr.GateWayUse == 1)
  799. // {
  800. // IPMI_DBG_PRINT("Setting Backupgw to Defaultgwip as per Request \n");
  801. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  802. // LOCK_BMC_SHARED_MEM(BMCInst);
  803. // _fmemcpy(NWConfig.Gateway,pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,IP_ADDR_LEN);
  804. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  805. // SetPendStatus(PEND_OP_SET_GATEWAY,PEND_STATUS_PENDING);
  806. // PostPendTask(PEND_OP_SET_GATEWAY,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
  807. // }
  808. // break;
  809. // case LAN_PARAM_VLAN_ID:
  810. // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
  811. // {
  812. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  813. // if((pSetLanReq->ConfigData.VLANID & VLAN_MASK_BIT) == VLAN_MASK_BIT) /* checks for VLAN enable bit*/
  814. // {
  815. // pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
  816. // if(pendStatus == PEND_STATUS_PENDING)
  817. // {
  818. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  819. // return sizeof (INT8U);
  820. // }
  821. // vlanID = (pSetLanReq->ConfigData.VLANID & 0xfff); /* get the vlan d from the data */
  822. // for(i=0;i<sizeof(InvalidVlanID)/sizeof(INT16U);i++)
  823. // {
  824. // if(InvalidVlanID[i] != vlanID)
  825. // {
  826. // continue;
  827. // }
  828. // else /*invalid vlan id */
  829. // {
  830. // *pRes = CC_INV_DATA_FIELD ;
  831. // return sizeof (*pRes);
  832. // }
  833. // }
  834. // if ( NWConfig.VLANID != 0) /* checks if vlan id already present */
  835. // {
  836. // if(NWConfig.VLANID == vlanID)
  837. // {
  838. // TCRIT("Currently configured vlan id and incoming set vlan id are same thus, do nothing\n");
  839. // break;
  840. // }
  841. // memset(IfcName,0,sizeof(IfcName));
  842. // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
  843. // {
  844. // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
  845. // *pRes = CC_INV_DATA_FIELD ;
  846. // return sizeof (*pRes);
  847. // }
  848. // sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
  849. // if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
  850. // {
  851. // pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
  852. // if(pendStatus == PEND_STATUS_PENDING)
  853. // {
  854. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  855. // return sizeof (INT8U);
  856. // }
  857. // SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
  858. // PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  859. // pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
  860. // }
  861. // }
  862. // NWConfig.VLANID=vlanID;
  863. // SetPendStatus(PEND_OP_SET_VLAN_ID,PEND_STATUS_PENDING);
  864. // PostPendTask(PEND_OP_SET_VLAN_ID,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  865. // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
  866. // }
  867. // else /* Vlan Bit is Disabled */
  868. // {
  869. // if(NWConfig.VLANID==0) /* Vlan id is disabled */
  870. // {
  871. // if((pSetLanReq->ConfigData.VLANID & 0xfff)!=0)
  872. // {
  873. // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
  874. // }
  875. // if((pSetLanReq->ConfigData.VLANID & 0xfff)==0)
  876. // {
  877. // if((pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff)!=0)
  878. // {
  879. // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
  880. // }
  881. // }
  882. // }
  883. // else /* Vlan ID is enable. so deconfigure it */
  884. // {
  885. // memset(IfcName,0,sizeof(IfcName));
  886. // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
  887. // {
  888. // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
  889. // *pRes = CC_INV_DATA_FIELD ;
  890. // return sizeof (*pRes);
  891. // }
  892. // sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
  893. // if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
  894. // {
  895. // pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
  896. // if(pendStatus == PEND_STATUS_PENDING)
  897. // {
  898. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  899. // return sizeof (INT8U);
  900. // }
  901. // SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
  902. // PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(INT8U*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  903. // pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
  904. // }
  905. // pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
  906. // if(pendStatus == PEND_STATUS_PENDING)
  907. // {
  908. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  909. // return sizeof (INT8U);
  910. // }
  911. // //NWConfig.VLANID=0;
  912. // NWConfig.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPAddrSrc;
  913. // SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
  914. // PostPendTask(PEND_OP_SET_SOURCE,(INT8U*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  915. // pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
  916. // }
  917. // }
  918. // }
  919. // else
  920. // {
  921. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  922. // return sizeof(INT8U);
  923. // }
  924. // break;
  925. // case LAN_PARAM_VLAN_PRIORITY:
  926. // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
  927. // {
  928. // if((pBMCInfo->LANCfs[EthIndex].VLANID & VLAN_MASK_BIT) != VLAN_MASK_BIT) /* checks for VLAN enable bit*/
  929. // {
  930. // if(g_corefeatures.vlan_priorityset == ENABLED)
  931. // {
  932. // if(pSetLanReq->ConfigData.VLANPriority > 7 )
  933. // {
  934. // TCRIT(" VLAN Priority value should be 0-7 \n");
  935. // *pRes = CC_INV_DATA_FIELD ;
  936. // return sizeof (*pRes);
  937. // }
  938. // if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
  939. // {
  940. // return -1;
  941. // }
  942. // if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
  943. // {
  944. // return -1;
  945. // }
  946. // pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
  947. // }
  948. // else
  949. // {
  950. // TCRIT(" VLAN is not Configured \n");
  951. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  952. // return sizeof (*pRes);
  953. // }
  954. // }
  955. // else
  956. // {
  957. // if(pSetLanReq->ConfigData.VLANPriority > 7 )
  958. // {
  959. // TCRIT(" VLAN Priority value should be 0-7 \n");
  960. // *pRes = CC_INV_DATA_FIELD ;
  961. // return sizeof (*pRes);
  962. // }
  963. // if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
  964. // {
  965. // return -1;
  966. // }
  967. // if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
  968. // {
  969. // return -1;
  970. // }
  971. // pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
  972. // vlanID = (pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff);
  973. // memset(IfcName,0,sizeof(IfcName));
  974. // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
  975. // {
  976. // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
  977. // *pRes = CC_INV_DATA_FIELD;
  978. // return sizeof(*pRes);
  979. // }
  980. // /*vconfig set_egress_map <valninterface> <skb_buffer> <vlan-priority>*/
  981. // sprintf(cmdSetPriority,"vconfig set_egress_map %s.%d 0 %d",IfcName,vlanID,pSetLanReq->ConfigData.VLANPriority);
  982. // if(((retValue = safe_system(cmdSetPriority)) < 0))
  983. // {
  984. // TCRIT("ERROR %d: Set VLAN Priority failed\n",retValue);
  985. // }
  986. // /*
  987. // * Set priority of IPMI commands.
  988. // * The skb->priority value of IPMI command will be modified by TOS option.
  989. // * So, use the mapping table to get the current value.
  990. // */
  991. // memset(&cmdSetPriority,0,sizeof(cmdSetPriority));
  992. // TOS = pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam.TypeOfService;
  993. // SkbPriority = IP_TOS2PRIO[IPTOS_TOS(TOS)>>1];
  994. // sprintf(cmdSetPriority,"vconfig set_egress_map %s.%d %d %d",IfcName,vlanID,SkbPriority,pSetLanReq->ConfigData.VLANPriority);
  995. // if(((retValue = safe_system(cmdSetPriority)) < 0))
  996. // {
  997. // TCRIT("ERROR %d: Set VLAN IPMI Priority failed\n",retValue);
  998. // }
  999. // }
  1000. // }
  1001. // else
  1002. // {
  1003. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1004. // return sizeof(INT8U);
  1005. // }
  1006. // break;
  1007. // case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
  1008. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  1009. // return sizeof(INT8U);
  1010. // case LAN_PARAM_CIPHER_SUITE_ENTRIES:
  1011. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  1012. // return sizeof(INT8U);
  1013. // break;
  1014. // case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
  1015. // LOCK_BMC_SHARED_MEM(BMCInst);
  1016. // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CipherSuitePrivLevels,
  1017. // pSetLanReq->ConfigData.CipherSuitePrivLevels, MAX_NUM_CIPHER_SUITE_PRIV_LEVELS);
  1018. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1019. // break;
  1020. // case LAN_PARAM_VLAN_TAGS:
  1021. // if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
  1022. // {
  1023. // LOCK_BMC_SHARED_MEM(BMCInst);
  1024. // _fmemcpy(&pSharedMem->VLANDestTag,
  1025. // ((_NEAR_ INT8U*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
  1026. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1027. // }
  1028. // else
  1029. // {
  1030. // if (pSetLanReq->ConfigData.DestAddr.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
  1031. // {
  1032. // pSetLanRes->CompletionCode = CC_PARAM_OUT_OF_RANGE;
  1033. // return sizeof (INT8U);
  1034. // }
  1035. // LOCK_BMC_SHARED_MEM(BMCInst);
  1036. // _fmemcpy(&pBMCInfo->LANCfs[EthIndex].VLANDestTags [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
  1037. // ((_NEAR_ INT8U*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
  1038. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1039. // }
  1040. // break;
  1041. // case LAN_PARAMS_BAD_PASSWORD_THRESHOLD:
  1042. // ClearUserLockAttempts(LAN_CHANNEL_BADP,BMCInst);
  1043. // LOCK_BMC_SHARED_MEM(BMCInst);
  1044. // _fmemcpy(&pBMCInfo->LANCfs[EthIndex].BadPasswd,
  1045. // &pSetLanReq->ConfigData.BadPasswd,sizeof(BadPassword_T));
  1046. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1047. // break;
  1048. // case LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR:
  1049. // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
  1050. // {
  1051. // TCRIT("Invalid data for SetSelect");
  1052. // *pRes = CC_INV_DATA_FIELD ;
  1053. // return sizeof (*pRes);
  1054. // }
  1055. // /*Validate the IPv6 address*/
  1056. // if(0 != IsValidGlobalIPv6Addr((struct in6_addr*)&pSetLanReq->ConfigData.Destv6Addr.IPAddr))
  1057. // {
  1058. // TCRIT("Invalid Global IPv6 Address\n");
  1059. // *pRes = CC_INV_DATA_FIELD;
  1060. // return sizeof(INT8U);
  1061. // }
  1062. // if (0 == pSetLanReq->ConfigData.Destv6Addr.SetSelect)
  1063. // {
  1064. // LOCK_BMC_SHARED_MEM(BMCInst);
  1065. // _fmemcpy (&pSharedMem->VolLANv6Dest,
  1066. // &pSetLanReq->ConfigData.Destv6Addr, sizeof(LANDestv6Addr_T));
  1067. // memset(pSharedMem->VolLANDest,0,sizeof(LANDestAddr_T));
  1068. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1069. // }
  1070. // else
  1071. // {
  1072. // LOCK_BMC_SHARED_MEM(BMCInst);
  1073. // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].Destv6Addr[pSetLanReq->ConfigData.Destv6Addr.SetSelect - 1],
  1074. // &pSetLanReq->ConfigData.Destv6Addr, sizeof(LANDestv6Addr_T));
  1075. // memset(&pBMCInfo->LANCfs[EthIndex].DestAddr[pSetLanReq->ConfigData.DestAddr.SetSelect - 1],0,sizeof(LANDestAddr_T));
  1076. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1077. // }
  1078. // TDBG("\n SetLanconfig: Setting SNMPv6 configuration done..\n");
  1079. // break;
  1080. // case LAN_PARAMS_AMI_OEM_ENABLE_SET_MAC: //194
  1081. // NIC_Count = g_coremacros.global_nic_count;
  1082. // if (ReqLen != 1)
  1083. // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
  1084. // else if (pSetLanReq->ConfigData.EthIndex > ( NIC_Count- 1))
  1085. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1086. // else
  1087. // {
  1088. // enableSetMACAddr = TRUE;
  1089. // macEthIndex = pSetLanReq->ConfigData.EthIndex;
  1090. // pSetLanRes->CompletionCode = CC_NORMAL;
  1091. // }
  1092. // return sizeof(*pSetLanRes);
  1093. // case LAN_PARAMS_AMI_OEM_IPV6_ENABLE:
  1094. // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_ENABLE);
  1095. // if (pendStatus == PEND_STATUS_PENDING)
  1096. // {
  1097. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1098. // return sizeof (INT8U);
  1099. // }
  1100. // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_ENABLE \n");
  1101. // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable == pSetLanReq->ConfigData.IPv6_Enable)
  1102. // {
  1103. // TCRIT("LAN or VLAN - the current state is the same \n");
  1104. // break;
  1105. // }
  1106. // pBMCInfo->LANCfs[EthIndex].IPv6_Enable= pSetLanReq->ConfigData.IPv6_Enable;
  1107. // NWConfig6.enable= pSetLanReq->ConfigData.IPv6_Enable;
  1108. // SetPendStatus(PEND_OP_SET_IPV6_ENABLE,PEND_STATUS_PENDING);
  1109. // PostPendTask(PEND_OP_SET_IPV6_ENABLE,(INT8U*) &NWConfig6,sizeof(NWConfig6),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  1110. // break;
  1111. // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE:
  1112. // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_IP_ADDR_SOURCE);
  1113. // if (pendStatus == PEND_STATUS_PENDING)
  1114. // {
  1115. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1116. // return sizeof (INT8U);
  1117. // }
  1118. // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE \n");
  1119. // /* check for IPv6 enable state */
  1120. // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
  1121. // {
  1122. // TCRIT("IPv6 is not enabled yet... \n");
  1123. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1124. // return sizeof (INT8U);
  1125. // }
  1126. // if ((pSetLanReq->ConfigData.IPv6_IPAddrSrc > BMC_OTHER_SOURCE)
  1127. // ||(pSetLanReq->ConfigData.IPv6_IPAddrSrc == UNSPECIFIED_IP_SOURCE))
  1128. // {
  1129. // *pRes = CC_INV_DATA_FIELD;
  1130. // return sizeof (INT8U);
  1131. // }
  1132. // else if((pSetLanReq->ConfigData.IPv6_IPAddrSrc == BIOS_IP_SOURCE)
  1133. // || (pSetLanReq->ConfigData.IPv6_IPAddrSrc == BMC_OTHER_SOURCE))
  1134. // {
  1135. // /* we only support DHCP and Static IP source */
  1136. // *pRes = CC_INV_DATA_FIELD;
  1137. // return sizeof (INT8U);
  1138. // }
  1139. // if (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == pSetLanReq->ConfigData.IPv6_IPAddrSrc )
  1140. // {
  1141. // TCRIT("LAN or VLAN if current SRC is DHCP/Static and incoming SRC is DHCP/Static, do nothing\n");
  1142. // break;
  1143. // }
  1144. // pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc = pSetLanReq->ConfigData.IPv6_IPAddrSrc ;
  1145. // if ( (pSetLanReq->ConfigData.IPv6_IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPv6_IPAddrSrc == DHCP_IP_SOURCE ) )
  1146. // {
  1147. // NWConfig6.CfgMethod = pSetLanReq->ConfigData.IPv6_IPAddrSrc;
  1148. // SetPendStatus(PEND_OP_SET_IPV6_IP_ADDR_SOURCE,PEND_STATUS_PENDING);
  1149. // PostPendTask(PEND_OP_SET_IPV6_IP_ADDR_SOURCE,(INT8U*) &NWConfig6,sizeof(NWConfig6),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  1150. // }
  1151. // break;
  1152. // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR:
  1153. // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_IP_ADDR);
  1154. // if (pendStatus == PEND_STATUS_PENDING)
  1155. // {
  1156. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1157. // return sizeof (INT8U);
  1158. // }
  1159. // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR \n");
  1160. // /* check for IPv6 enable state */
  1161. // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
  1162. // {
  1163. // TCRIT("IPv6 is not enabled yet... \n");
  1164. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1165. // return sizeof (INT8U);
  1166. // }
  1167. // /* Do IP address source check */
  1168. // if( pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
  1169. // {
  1170. // TCRIT("IPv6 Address source is currently in DHCP \n");
  1171. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1172. // return sizeof (INT8U);
  1173. // }
  1174. // /*Validate the Index value*/
  1175. // if(pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr & 0xF0)
  1176. // {
  1177. // *pRes = CC_INV_DATA_FIELD;
  1178. // return sizeof(INT8U);
  1179. // }
  1180. // /*Validate the IPv6 address*/
  1181. // if(0 != IsValidGlobalIPv6Addr((struct in6_addr*)&pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr))
  1182. // {
  1183. // TCRIT("Invalid Global IPv6 Address\n");
  1184. // *pRes = CC_INV_DATA_FIELD;
  1185. // return sizeof(INT8U);
  1186. // }
  1187. // /*Validate the duplicate IPv6 Address*/
  1188. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  1189. // for(i=0;i<MAX_IPV6ADDRS;i++)
  1190. // {
  1191. // /*Use can set the same IPv6 address for same index. To satisfy the WebServer*/
  1192. // if((memcmp(NWConfig6.GlobalIPAddr[i],pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr,IP6_ADDR_LEN) == 0) && pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr != i)
  1193. // {
  1194. // *pRes = CC_INV_DATA_FIELD;
  1195. // return sizeof(INT8U);
  1196. // }
  1197. // }
  1198. // _fmemcpy(pBMCInfo->LANCfs[EthIndex].IPv6_IPAddr[pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr], pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, IP6_ADDR_LEN );
  1199. // SetPendStatus(PEND_OP_SET_IPV6_IP_ADDR,PEND_STATUS_PENDING);
  1200. // PostPendTask(PEND_OP_SET_IPV6_IP_ADDR, (INT8U*) &pSetLanReq->ConfigData.IPv6Addr,\
  1201. // sizeof (IPv6Addr_T),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  1202. // break;
  1203. // case LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH:
  1204. // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_PREFIX_LENGTH);
  1205. // if (pendStatus == PEND_STATUS_PENDING)
  1206. // {
  1207. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1208. // return sizeof (INT8U);
  1209. // }
  1210. // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH \n");
  1211. // /* check for IPv6 enable state */
  1212. // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
  1213. // {
  1214. // TCRIT("IPv6 is not enabled yet... \n");
  1215. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1216. // return sizeof (INT8U);
  1217. // }
  1218. // /* Do IP address source check */
  1219. // if( pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
  1220. // {
  1221. // TCRIT("IPv6 Address source is currently in DHCP \n");
  1222. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1223. // return sizeof (INT8U);
  1224. // }
  1225. // /*Validate the Index value*/
  1226. // if(pSetLanReq->ConfigData.IPv6Prefix.IPv6_Prepos & 0xF0)
  1227. // {
  1228. // *pRes = CC_INV_DATA_FIELD;
  1229. // return sizeof(INT8U);
  1230. // }
  1231. // pBMCInfo->LANCfs[EthIndex].IPv6_PrefixLen[pSetLanReq->ConfigData.IPv6Prefix.IPv6_Prepos] = pSetLanReq->ConfigData.IPv6Prefix.IPv6_PrefixLen;
  1232. // SetPendStatus(PEND_OP_SET_IPV6_PREFIX_LENGTH,PEND_STATUS_PENDING);
  1233. // PostPendTask(PEND_OP_SET_IPV6_PREFIX_LENGTH,(INT8U*) &pSetLanReq->ConfigData.IPv6Prefix, sizeof(IPv6Prefix_T),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  1234. // break;
  1235. // case LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP:
  1236. // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_GATEWAY);
  1237. // if (pendStatus == PEND_STATUS_PENDING)
  1238. // {
  1239. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1240. // return sizeof (INT8U);
  1241. // }
  1242. // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP \n");
  1243. // /* check for IPv6 enable state */
  1244. // if ( pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
  1245. // {
  1246. // TCRIT("IPv6 is not enabled yet... \n");
  1247. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1248. // return sizeof (INT8U);
  1249. // }
  1250. // /* Do IP address source check */
  1251. // if( pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
  1252. // {
  1253. // TCRIT("IPv6 Address source is currently in DHCP \n");
  1254. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1255. // return sizeof (INT8U);
  1256. // }
  1257. // /*Validate the IPv6 address*/
  1258. // if(0 != IsValidGlobalIPv6Addr((struct in6_addr*)&pSetLanReq->ConfigData.IPv6_GatewayIPAddr))
  1259. // {
  1260. // TCRIT("Invalid Global IPv6 Address\n");
  1261. // *pRes = CC_INV_DATA_FIELD;
  1262. // return sizeof(INT8U);
  1263. // }
  1264. // _fmemcpy( pBMCInfo->LANCfs[EthIndex].IPv6_GatewayIPAddr, pSetLanReq->ConfigData.IPv6_GatewayIPAddr, IP6_ADDR_LEN );
  1265. // _fmemcpy( NWConfig6.Gateway, pSetLanReq->ConfigData.IPv6_GatewayIPAddr, IP6_ADDR_LEN );
  1266. // SetPendStatus(PEND_OP_SET_IPV6_GATEWAY,PEND_STATUS_PENDING);
  1267. // PostPendTask(PEND_OP_SET_IPV6_GATEWAY,(INT8U*) &NWConfig6,sizeof(NWConfig6),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  1268. // break;
  1269. // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64:
  1270. // /* 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 */
  1271. // if((ReqLen < 2) || (ReqLen > 9))
  1272. // {
  1273. // *pRes = CC_REQ_INV_LEN;
  1274. // return sizeof(INT8U);
  1275. // }
  1276. // pendStatus = GetPendStatus(PEND_OP_SET_IPV6_IP_ADDR);
  1277. // if (pendStatus == PEND_STATUS_PENDING)
  1278. // {
  1279. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1280. // return sizeof (INT8U);
  1281. // }
  1282. // TDBG("\n Entered in LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64 \n");
  1283. // /* Check for IPv6 enabled state */
  1284. // if(pBMCInfo->LANCfs[EthIndex].IPv6_Enable != 1)
  1285. // {
  1286. // TCRIT("IPv6 is not enabled yet... \n");
  1287. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1288. // return sizeof(INT8U);
  1289. // }
  1290. // /* Do IP address source check */
  1291. // if(pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == DHCP_IP_SOURCE)
  1292. // {
  1293. // TCRIT("IPv6 Address source is currently in DHCP \n");
  1294. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1295. // return sizeof (INT8U);
  1296. // }
  1297. // /*Validate the Index value*/
  1298. // if(pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr & 0xF0)
  1299. // {
  1300. // TCRIT("Index of the given IPv6 Address is invalid. \n");
  1301. // *pRes = CC_INV_DATA_FIELD;
  1302. // return sizeof(INT8U);
  1303. // }
  1304. // /* The request may be of variable length, so fill the network prefix by appending zeros. This is to avoid garbage values */
  1305. // for(i = ReqLen-1; i<8; i++)
  1306. // {
  1307. // pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr[i] = 0;
  1308. // }
  1309. // /* Generate the IPv6 address using EUI-64 algo */
  1310. // if(nwFormIPv6Addr_EUI64((INT8U*) &pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, netindex, g_corefeatures.global_ipv6) != 0)
  1311. // {
  1312. // *pRes = CC_INV_DATA_FIELD;
  1313. // return sizeof(INT8U);
  1314. // }
  1315. // /* Get the current network configuration settings */
  1316. // nwReadNWCfg_v4_v6(&NWConfig, &NWConfig6, netindex, g_corefeatures.global_ipv6);
  1317. // /*Validate the duplicate IPv6 Address*/
  1318. // for(i=0; i<MAX_IPV6ADDRS; i++)
  1319. // {
  1320. // /* User can set the same IPv6 address for same index to satisfy the WebServer */
  1321. // if((memcmp(NWConfig6.GlobalIPAddr[i], pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, IP6_ADDR_LEN) == 0) && pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr != i)
  1322. // {
  1323. // TCRIT("\n Error in setting the IPv6 address - Duplicate :( \n");
  1324. // *pRes = CC_INV_DATA_FIELD;
  1325. // return sizeof(INT8U);
  1326. // }
  1327. // }
  1328. // _fmemcpy(pBMCInfo->LANCfs[EthIndex].IPv6_IPAddr[pSetLanReq->ConfigData.IPv6Addr.IPv6_Cntr], pSetLanReq->ConfigData.IPv6Addr.IPv6_IPAddr, IP6_ADDR_LEN);
  1329. // SetPendStatus(PEND_OP_SET_IPV6_IP_ADDR,PEND_STATUS_PENDING);
  1330. // PostPendTask(PEND_OP_SET_IPV6_IP_ADDR, (INT8U*) &pSetLanReq->ConfigData.IPv6Addr, sizeof(IPv6Addr_T), (pSetLanReq->ChannelNum & 0x0F), BMCInst);
  1331. // break;
  1332. // case LAN_PARAMS_AMI_OEM_PHY_SETTINGS:
  1333. // if(ReqLen != 4)
  1334. // {
  1335. // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
  1336. // return sizeof(*pSetLanRes);
  1337. // }
  1338. // memset(IfcName, 0, sizeof(IfcName));
  1339. // if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
  1340. // {
  1341. // TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
  1342. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1343. // return sizeof(*pSetLanRes);
  1344. // }
  1345. // if(nwGetEthInformation(&PHYCfg, IfcName) == 0)
  1346. // {
  1347. // if(((PHYCfg.autoneg == pSetLanReq->ConfigData.PHYConfig.AutoNegotiationEnable) && (PHYCfg.speed == pSetLanReq->ConfigData.PHYConfig.Speed)
  1348. // && (PHYCfg.duplex == pSetLanReq->ConfigData.PHYConfig.Duplex)))
  1349. // {
  1350. // TDBG("There is no change in the link mode, ignoring the request for setting the speed/duplex.\n");
  1351. // break;
  1352. // }
  1353. // }
  1354. // else
  1355. // {
  1356. // pSetLanRes->CompletionCode = CC_UNSPECIFIED_ERR;
  1357. // return sizeof(*pSetLanRes);
  1358. // }
  1359. // if(pSetLanReq->ConfigData.PHYConfig.Speed != 0xFFFF && pSetLanReq->ConfigData.PHYConfig.Duplex != 0xFF)
  1360. // {
  1361. // if(IsLinkModeSupported(&PHYCfg,pSetLanReq->ConfigData.PHYConfig.Speed,pSetLanReq->ConfigData.PHYConfig.Duplex) <= 0)
  1362. // {
  1363. // TCRIT("Unsupported link mode \n");
  1364. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1365. // return sizeof(*pSetLanRes);
  1366. // }
  1367. // }
  1368. // SetPendStatus(PEND_OP_SET_SPEED, PEND_STATUS_PENDING);
  1369. // PostPendTask(PEND_OP_SET_SPEED, (INT8U*) &(pSetLanReq->ConfigData.PHYConfig), sizeof(PHYConfig_T),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  1370. // break;
  1371. // case LAN_PARAMS_AMI_OEM_MTU_SETTINGS:
  1372. // if(ReqLen != 2)
  1373. // {
  1374. // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
  1375. // return sizeof(*pSetLanRes);
  1376. // }
  1377. // /* Setting MTU values less than 1280 disables IPv6,
  1378. // RFC 1280 recommends MTU value should be greater than 1200 for IPV6.
  1379. // so restricting MTU value b/w 1280 to 1500.*/
  1380. // if( (pSetLanReq->ConfigData.MTU_size < 1280) || (pSetLanReq->ConfigData.MTU_size > 1500) )
  1381. // {
  1382. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1383. // return sizeof(*pSetLanRes);
  1384. // }
  1385. // SetPendStatus(PEND_OP_SET_MTU_SIZE, PEND_STATUS_PENDING);
  1386. // PostPendTask(PEND_OP_SET_MTU_SIZE, (INT8U*) &(pSetLanReq->ConfigData.MTU_size), sizeof(INT16U),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
  1387. // break;
  1388. // case LAN_PARAMS_SSI_OEM_2ND_PRI_ETH_MAC_ADDR:
  1389. // if(g_corefeatures.ssi_support == ENABLED)
  1390. // {
  1391. // pendStatus = GetPendStatus(PEND_OP_SET_MAC_ADDRESS);
  1392. // if(pendStatus == PEND_STATUS_PENDING)
  1393. // {
  1394. // *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
  1395. // return sizeof (INT8U);
  1396. // }
  1397. // if (!enableSetMACAddr)
  1398. // {
  1399. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  1400. // return sizeof(INT8U);
  1401. // }
  1402. // else
  1403. // {
  1404. // EnableSetMACAddress_T macAddrEnabled;
  1405. // memset(&macAddrEnabled, 0, sizeof(EnableSetMACAddress_T));
  1406. // macAddrEnabled.EthIndex = 0x1; /* Specify the 2nd interface */
  1407. // memcpy(&macAddrEnabled.MACAddress, pSetLanReq->ConfigData.SSI2ndPriEthMACAddr, MAC_ADDR_LEN);
  1408. // SetPendStatus(PEND_OP_SET_MAC_ADDRESS, PEND_STATUS_PENDING);
  1409. // PostPendTask(PEND_OP_SET_MAC_ADDRESS, (INT8U*)&macAddrEnabled, sizeof(EnableSetMACAddress_T), 0x1, BMCInst);
  1410. // }
  1411. // break;
  1412. // }
  1413. // else
  1414. // {
  1415. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  1416. // return sizeof(INT8U);
  1417. // }
  1418. // case LAN_PARAMS_SSI_OEM_LINK_CTRL:
  1419. // if(g_corefeatures.ssi_support == ENABLED)
  1420. // {
  1421. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM; /* Read Only */
  1422. // }
  1423. // else
  1424. // {
  1425. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  1426. // }
  1427. // return sizeof(INT8U);
  1428. // case LAN_PARAMS_SSI_OEM_CMM_IP_ADDR:
  1429. // if(g_corefeatures.ssi_support == ENABLED)
  1430. // {
  1431. // _fmemcpy(pBMCInfo->SSIConfig.CMMIPAddr, pSetLanReq->ConfigData.CMMIPAddr, IP_ADDR_LEN);
  1432. // FlushIPMI((INT8U*)&pBMCInfo->SSIConfig, (INT8U*)&pBMCInfo->SSIConfig, pBMCInfo->IPMIConfLoc.SSIConfigAddr,
  1433. // sizeof(SSIConfig_T), BMCInst);
  1434. // break;
  1435. // }
  1436. // else
  1437. // {
  1438. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  1439. // return sizeof(INT8U);
  1440. // }
  1441. // default:
  1442. // if(g_corefeatures.ncsi_cmd_support == ENABLED)
  1443. // {
  1444. // switch (pSetLanReq->ParameterSelect)
  1445. // {
  1446. // case LAN_PARAMS_AMI_OEM_NCSI_CONFIG_NUM:
  1447. // pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
  1448. // return sizeof(*pSetLanRes);
  1449. // case LAN_PARAMS_AMI_OEM_NCSI_SETTINGS:
  1450. // NIC_Count=g_coremacros.global_nic_count;
  1451. // if (ReqLen != 3)
  1452. // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
  1453. // else if (pSetLanReq->ConfigData.NCSIPortConfig.Interface >= NIC_Count)
  1454. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1455. // else
  1456. // {
  1457. // pendStatus = GetPendStatus(PEND_OP_SET_NCSI_CHANNEL_ID);
  1458. // if(pendStatus == PEND_STATUS_PENDING)
  1459. // {
  1460. // *pRes = CC_NODE_BUSY;
  1461. // return sizeof (INT8U);
  1462. // }
  1463. // NCSIConfig_T configData;
  1464. // char interfaceName[8];
  1465. // memset(&configData, 0, sizeof(NCSIConfig_T));
  1466. // memset(interfaceName, 0, sizeof(interfaceName));
  1467. // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pSetLanReq->ConfigData.NCSIPortConfig.Interface);
  1468. // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
  1469. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1470. // else
  1471. // {
  1472. // configData.PackageId = pSetLanReq->ConfigData.NCSIPortConfig.PackageId;
  1473. // configData.ChannelId = pSetLanReq->ConfigData.NCSIPortConfig.ChannelId;
  1474. // if (NCSISetPortConfigByName(interfaceName, configData) != 0)
  1475. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1476. // else
  1477. // {
  1478. // SetPendStatus(PEND_OP_SET_NCSI_CHANNEL_ID, PEND_STATUS_PENDING);
  1479. // PostPendTask(PEND_OP_SET_NCSI_CHANNEL_ID, NULL, 0, 0, BMCInst);
  1480. // pSetLanRes->CompletionCode = CC_NORMAL;
  1481. // }
  1482. // }
  1483. // }
  1484. // return sizeof(*pSetLanRes);
  1485. // case LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE:
  1486. // NIC_Count=g_coremacros.global_nic_count;
  1487. // if (ReqLen != 2)
  1488. // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
  1489. // else if (pSetLanReq->ConfigData.NCSIModeConfig.Interface >= NIC_Count)
  1490. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1491. // else
  1492. // {
  1493. // pendStatus = GetPendStatus(PEND_OP_SET_NCSI_MODE_CHANGE);
  1494. // if(pendStatus == PEND_STATUS_PENDING)
  1495. // {
  1496. // *pRes = CC_NODE_BUSY;
  1497. // return sizeof (INT8U);
  1498. // }
  1499. // NCSIConfig_T configData;
  1500. // char interfaceName[8];
  1501. // memset(&configData, 0, sizeof(NCSIConfig_T));
  1502. // memset(interfaceName, 0, sizeof(interfaceName));
  1503. // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pSetLanReq->ConfigData.NCSIModeConfig.Interface);
  1504. // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
  1505. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1506. // else
  1507. // {
  1508. // configData.AutoSelect = pSetLanReq->ConfigData.NCSIModeConfig.NCSIMode;
  1509. // if (NCSISetPortConfigByName(interfaceName, configData) != 0)
  1510. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1511. // else
  1512. // {
  1513. // SetPendStatus(PEND_OP_SET_NCSI_MODE_CHANGE, PEND_STATUS_PENDING);
  1514. // PostPendTask(PEND_OP_SET_NCSI_MODE_CHANGE, NULL, 0, 0, BMCInst);
  1515. // pSetLanRes->CompletionCode = CC_NORMAL;
  1516. // }
  1517. // }
  1518. // }
  1519. // return sizeof(*pSetLanRes);
  1520. // case LAN_PARAMS_AMI_OEM_NCSI_EXTENSION:
  1521. // if ((0x20 == pSetLanReq->ConfigData.NCSIPHYConfigSet.Command) &&
  1522. // (g_corefeatures.ncsi_keep_phy_linkup_support == ENABLED))
  1523. // {
  1524. // NIC_Count=g_coremacros.global_nic_count;
  1525. // if (ReqLen != 3)
  1526. // pSetLanRes->CompletionCode = CC_REQ_INV_LEN;
  1527. // else if (pSetLanReq->ConfigData.NCSIPHYConfigSet.Interface >= NIC_Count)
  1528. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1529. // else
  1530. // {
  1531. // pendStatus = GetPendStatus(PEND_OP_SET_NCSI_VETOBIT);
  1532. // if(pendStatus == PEND_STATUS_PENDING)
  1533. // {
  1534. // *pRes = CC_NODE_BUSY;
  1535. // return sizeof (INT8U);
  1536. // }
  1537. // NCSIConfig_T configData;
  1538. // char interfaceName[8];
  1539. // memset(&configData, 0, sizeof(NCSIConfig_T));
  1540. // memset(interfaceName, 0, sizeof(interfaceName));
  1541. // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pSetLanReq->ConfigData.NCSIPHYConfigSet.Interface);
  1542. // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
  1543. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1544. // else
  1545. // {
  1546. // configData.VetoBit= pSetLanReq->ConfigData.NCSIPHYConfigSet.VetoBit;
  1547. // if (NCSISetPortConfigByName(interfaceName, configData) != 0)
  1548. // pSetLanRes->CompletionCode = CC_INV_DATA_FIELD;
  1549. // else
  1550. // {
  1551. // SetPendStatus(PEND_OP_SET_NCSI_VETOBIT, PEND_STATUS_PENDING);
  1552. // PostPendTask(PEND_OP_SET_NCSI_VETOBIT, NULL, 0, 0, BMCInst);
  1553. // pSetLanRes->CompletionCode = CC_NORMAL;
  1554. // }
  1555. // }
  1556. // }
  1557. // }
  1558. // else
  1559. // {
  1560. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  1561. // }
  1562. // return sizeof(*pSetLanRes);
  1563. // default:
  1564. // TDBG("In Valid Option\n");
  1565. // }
  1566. // }
  1567. // pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  1568. // return sizeof(INT8U);
  1569. // }
  1570. // pSetLanRes->CompletionCode = CC_NORMAL;
  1571. // if(g_PDKHandle[PDK_POSTSETLANPARAM] != NULL)
  1572. // {
  1573. // ((int(*)(INT8U*, INT8U, int))(g_PDKHandle[PDK_POSTSETLANPARAM]))(pReq, ReqLen, BMCInst);
  1574. // }
  1575. // FlushIPMI((INT8U*)&pBMCInfo->LANCfs[0],(INT8U*)&pBMCInfo->LANCfs[EthIndex],pBMCInfo->IPMIConfLoc.LANCfsAddr,
  1576. // sizeof(LANConfig_T),BMCInst);
  1577. // return sizeof(*pSetLanRes);
  1578. // }
  1579. // /*
  1580. // *@fn IPAddrCheck function
  1581. // *@brief It will validate the IP Address and net Mask
  1582. // *@param Addr - IP Address or net Mask
  1583. // *@param params - parameter data to validate
  1584. // */
  1585. // int IPAddrCheck(INT8U *Addr,int params)
  1586. // {
  1587. // int i,maskcount=0,bitmask =0,j,bitcheck=0;
  1588. // for(i=0;i< IP_ADDR_LEN;i++)
  1589. // {
  1590. // if(Addr[i] == BRD_CAST_BIT_MASK)
  1591. // {
  1592. // maskcount++;
  1593. // }
  1594. // }
  1595. // if(maskcount == IP_ADDR_LEN)
  1596. // {
  1597. // return 1;
  1598. // }
  1599. // if(params == LAN_PARAM_SUBNET_MASK)
  1600. // {
  1601. // if(Addr[0] == BRD_CAST_BIT_MASK)
  1602. // {
  1603. // for(i=1;i< IP_ADDR_LEN;i++)
  1604. // {
  1605. // if(Addr[i-1] == 0)
  1606. // {
  1607. // bitmask = 1;
  1608. // }
  1609. // if(Addr[i] != 0)
  1610. // {
  1611. // for(j=0;j<8;j++)
  1612. // {
  1613. // if((Addr[i]<<j) & SUBNET_MASK_BIT_CHECK)
  1614. // {
  1615. // if(bitcheck == 1)
  1616. // {
  1617. // return 1;
  1618. // }
  1619. // continue;
  1620. // }
  1621. // bitcheck=1;
  1622. // }
  1623. // if((bitcheck == 1 && Addr[i-1] != BRD_CAST_BIT_MASK) || (Addr[i] > 0 && bitmask == 1))
  1624. // {
  1625. // return 1;
  1626. // }
  1627. // }
  1628. // }
  1629. // return 0;
  1630. // }
  1631. // return 1;
  1632. // }
  1633. // if(Addr[0] == LOOP_BACK_BIT_MASK || Addr[0] == BRD_CAST_BIT_MASK)
  1634. // {
  1635. // return 1;
  1636. // }
  1637. // return 0;
  1638. // }
  1639. // /*----------------------------------------------
  1640. // * GratuitousARPTask
  1641. // *----------------------------------------------*/
  1642. // void* GratuitousARPTask (INT8U *Addr)
  1643. // {
  1644. // INT8U IntervalInSec;
  1645. // INT8U Status;
  1646. // int nRet;
  1647. // NWCFG_STRUCT NWConfig;
  1648. // NWCFG6_STRUCT NWConfig6;
  1649. // INT8U EthIndex,netindex= 0xFF;
  1650. // int BMCInst,i;
  1651. // char IfcName[16];
  1652. // BMCArg *GratArpArgs = (BMCArg *)Addr;
  1653. // BMCInst = GratArpArgs->BMCInst;
  1654. // BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
  1655. // prctl(PR_SET_NAME,__FUNCTION__,0,0,0);
  1656. // memcpy(&EthIndex,GratArpArgs->Argument,GratArpArgs->Len);
  1657. // memset(IfcName,0,sizeof(IfcName));
  1658. // /*Get the EthIndex*/
  1659. // if(GetIfcName(EthIndex,IfcName, BMCInst) == -1)
  1660. // {
  1661. // TCRIT("Error in Getting Ifcname\n");
  1662. // return 0;
  1663. // }
  1664. // for(i=0;i<sizeof(Ifcnametable)/sizeof(IfcName_T);i++)
  1665. // {
  1666. // if(strcmp(Ifcnametable[i].Ifcname,IfcName) == 0)
  1667. // {
  1668. // netindex= Ifcnametable[i].Index;
  1669. // break;
  1670. // }
  1671. // }
  1672. // if(netindex == 0xFF)
  1673. // {
  1674. // TCRIT("Error in gettting netindex\n");
  1675. // return 0;
  1676. // }
  1677. // if(Addr != NULL)
  1678. // {
  1679. // free(GratArpArgs->Argument);
  1680. // free(Addr);
  1681. // }
  1682. // TDBG ("Gratuitous ARP thread starts for ethindex : %x\n",EthIndex);
  1683. // while (1)
  1684. // {
  1685. // /*Is Gratiutous Arp Enabled */
  1686. // if (0 == (pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl & GRATIUTOUS_ENABLE_MASK))
  1687. // {
  1688. // TDBG("Gratuitous ARP thread exits : Disable BMC-generated Gratuitous ARPs invoked\n");
  1689. // break;
  1690. // }
  1691. // /*Is Gratiutous Arp Suspended */
  1692. // Status = BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex];
  1693. // if ((0 != (Status & GRATIUTOUS_ENABLE_MASK)) &&
  1694. // (BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning == TRUE))
  1695. // {
  1696. // // Gratuitous ARP Suspended.
  1697. // // sleep requested to access Shared memory for two different threads.
  1698. // usleep (20);
  1699. // continue;
  1700. // }
  1701. // nwReadNWCfg_v4_v6( &NWConfig,&NWConfig6, netindex,g_corefeatures.global_ipv6);
  1702. // if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
  1703. // {
  1704. // TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
  1705. // }
  1706. // if (NWConfig.IFName[0] == 0)
  1707. // sprintf((char *)&NWConfig.IFName, "%s",IfcName);
  1708. // TDBG ( "MAC is %2x:%2x:%2x:%2x:%2x:%2x \n", NWConfig.MAC [0], NWConfig.MAC [1],
  1709. // NWConfig.MAC [2], NWConfig.MAC [3], NWConfig.MAC [4], NWConfig.MAC [5] );
  1710. // TDBG ( "IP is %d.%d.%d.%d\n", NWConfig.IPAddr[0], NWConfig.IPAddr[1],
  1711. // NWConfig.IPAddr[2], NWConfig.IPAddr[3]);
  1712. // TDBG ( "Device Name : %s\n", (char *)&NWConfig.IFName);
  1713. // nRet = SendGratuitousARPPacket((char *)&NWConfig.IFName, NWConfig.IPAddr, NWConfig.MAC);
  1714. // if (0 != nRet)
  1715. // {
  1716. // TCRIT("Gratuitous ARP thread exits : Unable to Send Gratuitous ARP packet\n");
  1717. // break;
  1718. // }
  1719. // TDBG ("Send Gratuitous Packet\n");
  1720. // if (0 == pBMCInfo->LANCfs[EthIndex].GratitousARPInterval)
  1721. // {
  1722. // IntervalInSec = 2; //Default 2 secs
  1723. // } else {
  1724. // // Gratuitous ARP interval in 500 millisecond increments.
  1725. // IntervalInSec = (pBMCInfo->LANCfs[EthIndex].GratitousARPInterval * 500)/1000;
  1726. // }
  1727. // usleep( IntervalInSec * 1000 * 1000 );
  1728. // }
  1729. // return 0;
  1730. // }
  1731. // /*---------------------------------------------------
  1732. // * GetLanConfigParam
  1733. // *---------------------------------------------------*/
  1734. // int
  1735. // GetLanConfigParam (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
  1736. // {
  1737. // _NEAR_ GetLanConfigReq_T* pGetLanReq = (_NEAR_ GetLanConfigReq_T*) pReq;
  1738. // _NEAR_ GetLanConfigRes_T* pGetLanRes = (_NEAR_ GetLanConfigRes_T*) pRes;
  1739. // _FAR_ BMCSharedMem_T* pSharedMem = BMC_GET_SHARED_MEM (BMCInst);
  1740. // INT8U IsOemDefined = FALSE;
  1741. // NWCFG_STRUCT NWConfig;
  1742. // NWCFG6_STRUCT NWConfig6;
  1743. // // V6DNS_CONFIG v6dnsconfig;
  1744. // INT8U EthIndex,netindex= 0xFF,i;
  1745. // _FAR_ BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
  1746. // int ncsiPortConfigNum = 0;
  1747. // ETHCFG_STRUCT PHYCfg;
  1748. // ChannelInfo_T* pChannelInfo = NULL;
  1749. // char IfcName[16]; /* Eth interface name */
  1750. // INT8U ComStrLen=MAX_COMM_STRING_SIZE;
  1751. // int retValue = 0,NIC_Count = 0;
  1752. // pGetLanRes->CCParamRev.CompletionCode = CC_NORMAL;
  1753. // pGetLanRes->CCParamRev.ParamRevision = PARAMETER_REVISION_FORMAT;
  1754. // // printf("---> channel: %d, parameter: %#x, setslect: %#x, blockselect: %#x\n", pGetLanReq->ChannelNum, pGetLanReq->ParameterSelect, pGetLanReq->SetSelect, pGetLanReq->BlockSelect);
  1755. // if(pGetLanReq->ChannelNum & RESERVED_VALUE_70)
  1756. // {
  1757. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  1758. // *pRes = CC_INV_DATA_FIELD;
  1759. // return sizeof (*pRes);
  1760. // }
  1761. // if((pGetLanReq->ParameterSelect >= MIN_LAN_OEM_CONF_PARAM) &&
  1762. // (pGetLanReq->ParameterSelect <= MAX_LAN_OEM_CONF_PARAM) )
  1763. // {
  1764. // /* Converts OEM parameter value to equivalent AMI parameter value */
  1765. // if (0 != GetLanAMIParamValue (&pGetLanReq->ParameterSelect, &IsOemDefined) )
  1766. // {
  1767. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
  1768. // return sizeof(INT8U);
  1769. // }
  1770. // /* Hook for OEM to handle this parameter */
  1771. // if ( (IsOemDefined) && (g_PDKHandle[PDK_GETLANOEMPARAM] != NULL) )
  1772. // {
  1773. // return ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_GETLANOEMPARAM]))(pReq, ReqLen, pRes, BMCInst);
  1774. // }
  1775. // }
  1776. // if (g_PDKHandle[PDK_BEFOREGETLANPARM] != NULL)
  1777. // {
  1778. // retValue = ((int(*)(INT8U *, INT8U, INT8U *,int))(g_PDKHandle[PDK_BEFOREGETLANPARM]))(pReq, ReqLen, pRes, BMCInst);
  1779. // if(retValue != 0)
  1780. // {
  1781. // return retValue;
  1782. // }
  1783. // }
  1784. // //! Validate the SetSelector value.
  1785. // if ( (0x00 != pGetLanReq->SetSelect) &&
  1786. // (pGetLanReq->ParameterSelect != LAN_PARAM_SELECT_DEST_TYPE) &&
  1787. // (pGetLanReq->ParameterSelect != LAN_PARAM_SELECT_DEST_ADDR) &&
  1788. // (pGetLanReq->ParameterSelect != LAN_PARAM_VLAN_TAGS) &&
  1789. // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR) &&
  1790. // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR) &&
  1791. // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64) &&
  1792. // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH))
  1793. // {
  1794. // printf("GetLanConfigParam log1\n");
  1795. // if( g_corefeatures.ncsi_cmd_support == ENABLED )
  1796. // {
  1797. // if ((pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_SETTINGS) &&
  1798. // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE) &&
  1799. // (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_EXTENSION))
  1800. // {
  1801. // *pRes = CC_INV_DATA_FIELD;
  1802. // return sizeof (*pRes);
  1803. // }
  1804. // }
  1805. // else
  1806. // {
  1807. // *pRes = CC_INV_DATA_FIELD;
  1808. // return sizeof (*pRes);
  1809. // }
  1810. // }
  1811. // //! Validate the BlockSelector value.
  1812. // if (0x00 != pGetLanReq->BlockSelect)
  1813. // {
  1814. // printf("GetLanConfigParam log2\n");
  1815. // *pRes = CC_INV_DATA_FIELD;
  1816. // return sizeof (*pRes);
  1817. // }
  1818. // EthIndex= GetEthIndex(pGetLanReq->ChannelNum & 0x0F, BMCInst);
  1819. // if(0xff == EthIndex)
  1820. // {
  1821. // printf("GetLanConfigParam log3\n");
  1822. // *pRes = CC_INV_DATA_FIELD;
  1823. // return sizeof (INT8U);
  1824. // }
  1825. // /*Get the EthIndex*/
  1826. // if(GetIfcName(EthIndex,IfcName, BMCInst) != 0)
  1827. // {
  1828. // TCRIT("Error in Getting IfcName\n");
  1829. // *pRes = CC_INV_DATA_FIELD;
  1830. // return sizeof (INT8U);
  1831. // }
  1832. // for(i=0;i<sizeof(Ifcnametable)/sizeof(IfcName_T);i++)
  1833. // {
  1834. // if(strcmp(Ifcnametable[i].Ifcname,IfcName) == 0)
  1835. // {
  1836. // netindex= Ifcnametable[i].Index;
  1837. // break;
  1838. // }
  1839. // }
  1840. // if(netindex == 0xFF)
  1841. // {
  1842. // TCRIT("Error in Getting netindex %d %s\n",netindex,IfcName);
  1843. // *pRes = CC_INV_DATA_FIELD;
  1844. // return sizeof (INT8U);
  1845. // }
  1846. // if ((pGetLanReq->ChannelNum & GET_PARAMETER_REVISION_MASK) != 0)
  1847. // {
  1848. // if((MAX_LAN_CONF_PARAM >= pGetLanReq->ParameterSelect) ||
  1849. // ((MIN_LAN_OEM_CONF_PARAM <= pGetLanReq->ParameterSelect) && (MAX_LAN_OEM_CONF_PARAM >= pGetLanReq->ParameterSelect)) )
  1850. // {
  1851. // return sizeof(GetLanCCRev_T);
  1852. // }
  1853. // else
  1854. // {
  1855. // *pRes = CC_PARAM_NOT_SUPPORTED;
  1856. // return sizeof (*pRes);
  1857. // }
  1858. // }
  1859. // else
  1860. // {
  1861. // printf("GetLanConfigParam log4\n");
  1862. // switch(pGetLanReq->ParameterSelect)
  1863. // {
  1864. // case LAN_PARAM_SET_IN_PROGRESS:
  1865. // LOCK_BMC_SHARED_MEM(BMCInst);
  1866. // pGetLanRes->ConfigData.SetInProgress = BMC_GET_SHARED_MEM(BMCInst)->m_Lan_SetInProgress;
  1867. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1868. // break;
  1869. // case LAN_PARAM_AUTH_TYPE_SUPPORT:
  1870. // pGetLanRes->ConfigData.AuthTypeSupport = pBMCInfo->LANCfs[EthIndex].AuthTypeSupport;
  1871. // break;
  1872. // case LAN_PARAM_AUTH_TYPE_ENABLES:
  1873. // LOCK_BMC_SHARED_MEM(BMCInst);
  1874. // _fmemcpy (&pGetLanRes->ConfigData.AuthTypeEnables,
  1875. // &(pBMCInfo->LANCfs[EthIndex].AuthTypeEnables), sizeof(AuthTypeEnables_T));
  1876. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1877. // break;
  1878. // case LAN_PARAM_IP_ADDRESS:
  1879. // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
  1880. // {
  1881. // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
  1882. // {
  1883. // _fmemcpy (NWConfig.IPAddr,pBMCInfo->LANCfs[EthIndex].IPAddr, IP_ADDR_LEN);
  1884. // }
  1885. // else
  1886. // {
  1887. // memset(&NWConfig, 0, sizeof(NWConfig));
  1888. // }
  1889. // }
  1890. // else
  1891. // {
  1892. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  1893. // }
  1894. // _fmemcpy (pGetLanRes->ConfigData.IPAddr, NWConfig.IPAddr, IP_ADDR_LEN);
  1895. // break;
  1896. // case LAN_PARAM_IP_ADDRESS_SOURCE:
  1897. // if(g_corefeatures.delayed_lan_restart_support)
  1898. // {
  1899. // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
  1900. // {
  1901. // NWConfig.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPAddrSrc;
  1902. // }
  1903. // else
  1904. // {
  1905. // memset(&NWConfig, 0, sizeof(NWConfig));
  1906. // }
  1907. // }
  1908. // else
  1909. // {
  1910. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  1911. // }
  1912. // pGetLanRes->ConfigData.IPAddrSrc = NWConfig.CfgMethod;
  1913. // break;
  1914. // case LAN_PARAM_MAC_ADDRESS:
  1915. // nwGetNWInformations(&NWConfig,IfcName);
  1916. // _fmemcpy (pGetLanRes->ConfigData.MACAddr, NWConfig.MAC, MAC_ADDR_LEN);
  1917. // break;
  1918. // case LAN_PARAM_SUBNET_MASK:
  1919. // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
  1920. // {
  1921. // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
  1922. // {
  1923. // _fmemcpy (NWConfig.Mask,pBMCInfo->LANCfs[EthIndex].SubNetMask, IP_ADDR_LEN);
  1924. // }
  1925. // else
  1926. // {
  1927. // memset(&NWConfig, 0, sizeof(NWConfig));
  1928. // }
  1929. // }
  1930. // else
  1931. // {
  1932. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  1933. // }
  1934. // _fmemcpy (pGetLanRes->ConfigData.SubNetMask, NWConfig.Mask, IP_ADDR_LEN);
  1935. // break;
  1936. // case LAN_PARAM_IPv4_HEADER:
  1937. // LOCK_BMC_SHARED_MEM(BMCInst);
  1938. // _fmemcpy (&pGetLanRes->ConfigData.Ipv4HdrParam,
  1939. // &(pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam), sizeof(IPv4HdrParams_T));
  1940. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1941. // break;
  1942. // case LAN_PARAM_PRI_RMCP_PORT:
  1943. // pGetLanRes->ConfigData.PrimaryRMCPPort = htoipmi_u16(pBMCInfo->LANCfs[EthIndex].PrimaryRMCPPort);
  1944. // break;
  1945. // case LAN_PARAM_SEC_RMCP_PORT:
  1946. // /* Returning Invalid error message */
  1947. // *pRes = CC_PARAM_NOT_SUPPORTED;
  1948. // return sizeof (INT8U);
  1949. // /*pGetLanRes->ConfigData.SecondaryPort = htoipmi_u16(pPMConfig->LANConfig[EthIndex].SecondaryPort);*/
  1950. // break;
  1951. // case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
  1952. // pGetLanRes->ConfigData.BMCGeneratedARPControl = pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl;
  1953. // break;
  1954. // case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
  1955. // pGetLanRes->ConfigData.GratitousARPInterval =
  1956. // pBMCInfo->LANCfs[EthIndex].GratitousARPInterval;
  1957. // break;
  1958. // case LAN_PARAM_DEFAULT_GATEWAY_IP:
  1959. // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
  1960. // {
  1961. // if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
  1962. // {
  1963. // _fmemcpy (NWConfig.Gateway, pBMCInfo->LANCfs[EthIndex].DefaultGatewayIPAddr, IP_ADDR_LEN);
  1964. // }
  1965. // else
  1966. // {
  1967. // memset(&NWConfig, 0, sizeof(NWConfig));
  1968. // }
  1969. // }
  1970. // else
  1971. // {
  1972. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  1973. // }
  1974. // _fmemcpy (pGetLanRes->ConfigData.DefaultGatewayIPAddr, NWConfig.Gateway, IP_ADDR_LEN);
  1975. // break;
  1976. // case LAN_PARAM_DEFAULT_GATEWAY_MAC:
  1977. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  1978. // nwGetSrcMacAddr(&NWConfig.Gateway[0],netindex, &pGetLanRes->ConfigData.DefaultGatewayMACAddr[0]);
  1979. // break;
  1980. // case LAN_PARAM_BACKUP_GATEWAY_IP:
  1981. // LOCK_BMC_SHARED_MEM(BMCInst);
  1982. // nwGetBkupGWyAddr(pGetLanRes->ConfigData.BackupGatewayIPAddr,netindex);
  1983. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1984. // break;
  1985. // case LAN_PARAM_BACKUP_GATEWAY_MAC:
  1986. // LOCK_BMC_SHARED_MEM(BMCInst);
  1987. // _fmemcpy (pGetLanRes->ConfigData.BackupGatewayMACAddr,
  1988. // pBMCInfo->LANCfs[EthIndex].BackupGatewayMACAddr, MAC_ADDR_LEN);
  1989. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  1990. // break;
  1991. // case LAN_PARAM_COMMUNITY_STRING:
  1992. // if (g_PDKHandle[PDK_GETSNMPCOMMUNITYNAME] != NULL )
  1993. // {
  1994. // if(((int(*)(INT8U *, INT8U *,int))(g_PDKHandle[PDK_GETSNMPCOMMUNITYNAME]))(pGetLanRes->ConfigData.CommunityStr,&ComStrLen, BMCInst)==0)
  1995. // break;
  1996. // }
  1997. // LOCK_BMC_SHARED_MEM(BMCInst);
  1998. // _fmemcpy (pGetLanRes->ConfigData.CommunityStr,
  1999. // pBMCInfo->LANCfs[EthIndex].CommunityStr, MAX_COMM_STRING_SIZE);
  2000. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2001. // break;
  2002. // case LAN_PARAM_DEST_NUM:
  2003. // pGetLanRes->ConfigData.NumDest = pBMCInfo->LANCfs[EthIndex].NumDest;
  2004. // break;
  2005. // case LAN_PARAM_SELECT_DEST_TYPE:
  2006. // //if (pGetLanReq->SetSelect > NUM_LAN_DESTINATION)
  2007. // if ( pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
  2008. // {
  2009. // *pRes = CC_PARAM_OUT_OF_RANGE ;
  2010. // return sizeof (*pRes);
  2011. // }
  2012. // if (0 == pGetLanReq->SetSelect)
  2013. // {
  2014. // LOCK_BMC_SHARED_MEM(BMCInst);
  2015. // _fmemcpy (&pGetLanRes->ConfigData.DestType,
  2016. // &pSharedMem->VolLANDestType[EthIndex], sizeof(LANDestType_T));
  2017. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2018. // }
  2019. // else
  2020. // {
  2021. // LOCK_BMC_SHARED_MEM(BMCInst);
  2022. // _fmemcpy (&pGetLanRes->ConfigData.DestType,
  2023. // &(pBMCInfo->LANCfs[EthIndex].DestType[pGetLanReq->SetSelect - 1]),
  2024. // sizeof(LANDestType_T));
  2025. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2026. // }
  2027. // break;
  2028. // case LAN_PARAM_SELECT_DEST_ADDR:
  2029. // //if (pGetLanReq->SetSelect > NUM_LAN_DESTINATION)
  2030. // if ( pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
  2031. // {
  2032. // *pRes = CC_PARAM_OUT_OF_RANGE ;
  2033. // return sizeof (*pRes);
  2034. // }
  2035. // if (0 == pGetLanReq->SetSelect)
  2036. // {
  2037. // LOCK_BMC_SHARED_MEM(BMCInst);
  2038. // _fmemcpy (&pGetLanRes->ConfigData.DestAddr,
  2039. // &pSharedMem->VolLANDest[EthIndex], sizeof(LANDestAddr_T));
  2040. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2041. // }
  2042. // else
  2043. // {
  2044. // LOCK_BMC_SHARED_MEM(BMCInst);
  2045. // _fmemcpy (&pGetLanRes->ConfigData.DestAddr,
  2046. // &(pBMCInfo->LANCfs[EthIndex].DestAddr[pGetLanReq->SetSelect - 1]),
  2047. // sizeof(LANDestAddr_T));
  2048. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2049. // }
  2050. // break;
  2051. // case LAN_PARAM_VLAN_ID:
  2052. // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
  2053. // {
  2054. // pGetLanRes->ConfigData.VLANID = pBMCInfo->LANCfs[EthIndex].VLANID;
  2055. // }
  2056. // break;
  2057. // case LAN_PARAM_VLAN_PRIORITY:
  2058. // pGetLanRes->ConfigData.VLANPriority = pBMCInfo->LANCfs[EthIndex].VLANPriority;
  2059. // break;
  2060. // case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
  2061. // pGetLanRes->ConfigData.CipherSuiteSup = N0_OF_CIPHER_SUITE_SUPPORTED;
  2062. // break;
  2063. // case LAN_PARAM_CIPHER_SUITE_ENTRIES:
  2064. // {
  2065. // int i;
  2066. // _fmemset (pGetLanRes->ConfigData.CipherSuiteEntries, 0,
  2067. // sizeof (pGetLanRes->ConfigData.CipherSuiteEntries));
  2068. // for (i = 0; i < (N0_OF_CIPHER_SUITE_SUPPORTED); i++)
  2069. // {
  2070. // pGetLanRes->ConfigData.CipherSuiteEntries[i+1] = g_CipherRec[1 + i * 5];
  2071. // }
  2072. // }
  2073. // break;
  2074. // case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
  2075. // LOCK_BMC_SHARED_MEM(BMCInst);
  2076. // _fmemcpy (pGetLanRes->ConfigData.CipherSuitePrivLevels,
  2077. // pBMCInfo->LANCfs[EthIndex].CipherSuitePrivLevels,
  2078. // MAX_NUM_CIPHER_SUITE_PRIV_LEVELS);
  2079. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2080. // break;
  2081. // case LAN_PARAM_VLAN_TAGS:
  2082. // *((_NEAR_ INT8U*)&pGetLanRes->ConfigData) = pGetLanReq->SetSelect;
  2083. // if (pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
  2084. // {
  2085. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_OUT_OF_RANGE;
  2086. // return sizeof (GetLanCCRev_T);
  2087. // }
  2088. // if (0 == pGetLanReq->SetSelect)
  2089. // {
  2090. // LOCK_BMC_SHARED_MEM(BMCInst);
  2091. // _fmemcpy (((_NEAR_ INT8U*) &pGetLanRes->ConfigData) + 1,&pSharedMem->VLANDestTag, sizeof(VLANDestTags_T));
  2092. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2093. // }
  2094. // else
  2095. // {
  2096. // if (pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
  2097. // {
  2098. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_OUT_OF_RANGE;
  2099. // return sizeof(GetLanCCRev_T);
  2100. // }
  2101. // LOCK_BMC_SHARED_MEM(BMCInst);
  2102. // _fmemcpy (((_NEAR_ INT8U*)&pGetLanRes->ConfigData) + 1,
  2103. // &pBMCInfo->LANCfs[EthIndex].VLANDestTags[pGetLanReq->SetSelect - 1],
  2104. // sizeof(VLANDestTags_T));
  2105. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2106. // }
  2107. // break;
  2108. // case LAN_PARAMS_BAD_PASSWORD_THRESHOLD:
  2109. // LOCK_BMC_SHARED_MEM(BMCInst);
  2110. // _fmemcpy(&pGetLanRes->ConfigData.BadPasswd,
  2111. // &pBMCInfo->LANCfs[EthIndex].BadPasswd,sizeof(BadPassword_T));
  2112. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2113. // break;
  2114. // case LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR:
  2115. // if ( pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
  2116. // {
  2117. // *pRes = CC_PARAM_OUT_OF_RANGE ;
  2118. // return sizeof (*pRes);
  2119. // }
  2120. // if (0 == pGetLanReq->SetSelect)
  2121. // {
  2122. // LOCK_BMC_SHARED_MEM(BMCInst);
  2123. // _fmemcpy (&pGetLanRes->ConfigData.Destv6Addr,
  2124. // &pSharedMem->VolLANv6Dest[EthIndex], sizeof(LANDestv6Addr_T));
  2125. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2126. // }
  2127. // else
  2128. // {
  2129. // LOCK_BMC_SHARED_MEM(BMCInst);
  2130. // _fmemcpy (&pGetLanRes->ConfigData.Destv6Addr,
  2131. // &(pBMCInfo->LANCfs[EthIndex].Destv6Addr[pGetLanReq->SetSelect - 1]),
  2132. // sizeof(LANDestv6Addr_T));
  2133. // UNLOCK_BMC_SHARED_MEM(BMCInst);
  2134. // }
  2135. // TDBG("\n GetLanconfig: Getting SNMPv6 configuration done..\n");
  2136. // return sizeof(GetLanConfigRes_T);
  2137. // break;
  2138. // case LAN_PARAMS_AMI_OEM_ENABLE_SET_MAC:
  2139. // pGetLanRes->ConfigData.ChangeMACEnabled = enableSetMACAddr;
  2140. // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
  2141. // case LAN_PARAMS_AMI_OEM_IPV6_ENABLE:
  2142. // if(g_corefeatures.delayed_lan_restart_support)
  2143. // {
  2144. // NWConfig6.enable = pBMCInfo->LANCfs[EthIndex].IPv6_Enable;
  2145. // }
  2146. // else
  2147. // {
  2148. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2149. // }
  2150. // pGetLanRes->ConfigData.IPv6_Enable = NWConfig6.enable;
  2151. // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
  2152. // break;
  2153. // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE:
  2154. // if(g_corefeatures.delayed_lan_restart_support)
  2155. // {
  2156. // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
  2157. // {
  2158. // NWConfig6.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc;
  2159. // }
  2160. // else
  2161. // {
  2162. // memset(&NWConfig6, 0, sizeof(NWConfig6));
  2163. // }
  2164. // }
  2165. // else
  2166. // {
  2167. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2168. // }
  2169. // pGetLanRes->ConfigData.IPv6_IPAddrSrc = NWConfig6.CfgMethod;
  2170. // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
  2171. // break;
  2172. // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR:
  2173. // case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64:
  2174. // if(pGetLanReq->SetSelect & 0xF0)
  2175. // {
  2176. // *pRes = CC_INV_DATA_FIELD;
  2177. // return sizeof(INT8U);
  2178. // }
  2179. // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
  2180. // {
  2181. // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
  2182. // {
  2183. // _fmemcpy (NWConfig6.GlobalIPAddr,pBMCInfo->LANCfs[EthIndex].IPv6_IPAddr, IP6_ADDR_LEN*MAX_IPV6ADDRS);
  2184. // }
  2185. // else
  2186. // {
  2187. // memset(&NWConfig6, 0, sizeof(NWConfig6));
  2188. // }
  2189. // }
  2190. // else
  2191. // {
  2192. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2193. // }
  2194. // _fmemcpy (pGetLanRes->ConfigData.IPv6_LinkAddr, NWConfig6.GlobalIPAddr[(pGetLanReq->SetSelect & 0x0F)], IP6_ADDR_LEN);
  2195. // return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
  2196. // break;
  2197. // case LAN_PARAMS_AMI_OEM_IPV6_LINK_ADDR:
  2198. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2199. // _fmemcpy (pGetLanRes->ConfigData.IPv6_LinkAddr, NWConfig6.LinkIPAddr, IP6_ADDR_LEN);
  2200. // return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
  2201. // case LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH:
  2202. // if(pGetLanReq->SetSelect & 0xF0)
  2203. // {
  2204. // *pRes = CC_INV_DATA_FIELD;
  2205. // return sizeof(INT8U);
  2206. // }
  2207. // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
  2208. // {
  2209. // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
  2210. // {
  2211. // NWConfig6.GlobalPrefix[(pGetLanReq->SetSelect & 0x0F)] = pBMCInfo->LANCfs[EthIndex].IPv6_PrefixLen[(pGetLanReq->SetSelect & 0x0F)];
  2212. // }
  2213. // else
  2214. // {
  2215. // memset(&NWConfig6, 0, sizeof(NWConfig6));
  2216. // }
  2217. // }
  2218. // else
  2219. // {
  2220. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2221. // }
  2222. // pGetLanRes->ConfigData.IPv6_LinkAddrPrefix = NWConfig6.GlobalPrefix[(pGetLanReq->SetSelect & 0x0F)];
  2223. // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
  2224. // break;
  2225. // case LAN_PARAMS_AMI_OEM_IPV6_LINK_ADDR_PREFIX:
  2226. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2227. // pGetLanRes->ConfigData.IPv6_LinkAddrPrefix = NWConfig6.LinkPrefix;
  2228. // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
  2229. // break;
  2230. // case LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP:
  2231. // if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
  2232. // {
  2233. // if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
  2234. // {
  2235. // _fmemcpy (NWConfig6.Gateway,pBMCInfo->LANCfs[EthIndex].IPv6_GatewayIPAddr, IP6_ADDR_LEN);
  2236. // }
  2237. // else
  2238. // {
  2239. // memset(&NWConfig6, 0, sizeof(NWConfig6));
  2240. // }
  2241. // }
  2242. // else
  2243. // {
  2244. // nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2245. // }
  2246. // _fmemcpy (pGetLanRes->ConfigData.IPv6_GatewayIPAddr, NWConfig6.Gateway, IP6_ADDR_LEN);
  2247. // return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
  2248. // break;
  2249. // case LAN_PARAMS_AMI_OEM_PHY_SETTINGS:
  2250. // memset(IfcName, 0, sizeof(IfcName));
  2251. // if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
  2252. // {
  2253. // TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
  2254. // }
  2255. // if(nwGetEthInformation(&PHYCfg, IfcName) !=0)
  2256. // {
  2257. // pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
  2258. // return sizeof(GetLanCCRev_T);
  2259. // }
  2260. // pGetLanRes->ConfigData.PHYConfig.Interface = EthIndex;
  2261. // pGetLanRes->ConfigData.PHYConfig.AutoNegotiationEnable = PHYCfg.autoneg;
  2262. // pGetLanRes->ConfigData.PHYConfig.Speed = PHYCfg.speed;
  2263. // pGetLanRes->ConfigData.PHYConfig.Duplex = PHYCfg.duplex;
  2264. // pGetLanRes->ConfigData.PHYConfig.CapabilitiesSupported = PHYCfg.supported;
  2265. // return sizeof(GetLanCCRev_T) + sizeof(PHYConfig_T);
  2266. // case LAN_PARAMS_AMI_OEM_MTU_SETTINGS:
  2267. // memset(IfcName,0,sizeof(IfcName));
  2268. // if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
  2269. // {
  2270. // TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
  2271. // pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
  2272. // return sizeof(GetLanCCRev_T);
  2273. // }
  2274. // if(nwGetEthInformation(&PHYCfg, IfcName) !=0)
  2275. // {
  2276. // pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
  2277. // return sizeof(GetLanCCRev_T);
  2278. // }
  2279. // pGetLanRes->ConfigData.MTU_size = PHYCfg.maxtxpkt;
  2280. // return sizeof(GetLanCCRev_T) + sizeof(INT16U);
  2281. // case LAN_PARAMS_SSI_OEM_2ND_PRI_ETH_MAC_ADDR:
  2282. // if(g_corefeatures.ssi_support == ENABLED)
  2283. // {
  2284. // netindex = 0x1; /* Specify the 2nd interface */
  2285. // nwReadNWCfg_v4_v6(&NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
  2286. // _fmemcpy(pGetLanRes->ConfigData.SSI2ndPriEthMACAddr, NWConfig.MAC, MAC_ADDR_LEN);
  2287. // return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.SSI2ndPriEthMACAddr);
  2288. // }
  2289. // else
  2290. // {
  2291. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
  2292. // return sizeof(INT8U);
  2293. // }
  2294. // break;
  2295. // case LAN_PARAMS_SSI_OEM_LINK_CTRL:
  2296. // if(g_corefeatures.ssi_support == ENABLED)
  2297. // {
  2298. // pGetLanRes->ConfigData.SSILinkControl = 0;
  2299. // pChannelInfo = getChannelInfo(pBMCInfo->RMCPLAN1Ch, BMCInst);
  2300. // if(NULL == pChannelInfo)
  2301. // {
  2302. // *pRes = CC_UNSPECIFIED_ERR;
  2303. // return sizeof (*pRes);
  2304. // }
  2305. // if (pChannelInfo->AccessMode == 0x02) /* If 1st channal is available */
  2306. // pGetLanRes->ConfigData.SSILinkControl |= BIT0;
  2307. // NIC_Count = g_coremacros.global_nic_count;
  2308. // if (NIC_Count == 2)
  2309. // {
  2310. // pChannelInfo = getChannelInfo(pBMCInfo->RMCPLAN2Ch, BMCInst);
  2311. // if(NULL == pChannelInfo)
  2312. // {
  2313. // *pRes = CC_UNSPECIFIED_ERR;
  2314. // return sizeof (*pRes);
  2315. // }
  2316. // if (pChannelInfo->AccessMode == 0x02) /* If 2nd channal is available */
  2317. // pGetLanRes->ConfigData.SSILinkControl |= BIT1;
  2318. // }
  2319. // return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.SSILinkControl);
  2320. // }
  2321. // else
  2322. // {
  2323. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
  2324. // return sizeof(INT8U);
  2325. // }
  2326. // break;
  2327. // case LAN_PARAMS_SSI_OEM_CMM_IP_ADDR:
  2328. // if(g_corefeatures.ssi_support == ENABLED)
  2329. // {
  2330. // _fmemcpy (pGetLanRes->ConfigData.CMMIPAddr, pBMCInfo->SSIConfig.CMMIPAddr, IP_ADDR_LEN);
  2331. // return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.CMMIPAddr);
  2332. // }
  2333. // else
  2334. // {
  2335. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
  2336. // return sizeof(INT8U);
  2337. // }
  2338. // break;
  2339. // default:
  2340. // if(g_corefeatures.ncsi_cmd_support == ENABLED)
  2341. // {
  2342. // switch(pGetLanReq->ParameterSelect)
  2343. // {
  2344. // case LAN_PARAMS_AMI_OEM_NCSI_CONFIG_NUM:
  2345. // NCSIGetTotalPorts(&ncsiPortConfigNum);
  2346. // if (ncsiPortConfigNum >= 0xFF)
  2347. // {
  2348. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2349. // return sizeof(GetLanCCRev_T);
  2350. // }
  2351. // else
  2352. // {
  2353. // pGetLanRes->ConfigData.NumNCSIPortConfigs = ncsiPortConfigNum;
  2354. // return sizeof(GetLanCCRev_T) + sizeof(INT8U);
  2355. // }
  2356. // break;
  2357. // case LAN_PARAMS_AMI_OEM_NCSI_SETTINGS:
  2358. // {
  2359. // NIC_Count=g_coremacros.global_nic_count;
  2360. // if (pGetLanReq->SetSelect >= NIC_Count)
  2361. // {
  2362. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2363. // return sizeof(GetLanCCRev_T);
  2364. // }
  2365. // NCSIConfig_T configData;
  2366. // char interfaceName[8];
  2367. // memset(&configData, 0, sizeof(NCSIConfig_T));
  2368. // memset(interfaceName, 0, sizeof(interfaceName));
  2369. // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pGetLanReq->SetSelect);
  2370. // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
  2371. // {
  2372. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2373. // return sizeof(GetLanCCRev_T);
  2374. // }
  2375. // if (configData.PackageId >= 0xFF || configData.ChannelId >= 0xFF)
  2376. // {
  2377. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2378. // return sizeof(GetLanCCRev_T);
  2379. // }
  2380. // pGetLanRes->ConfigData.NCSIPortConfig.Interface = pGetLanReq->SetSelect;
  2381. // pGetLanRes->ConfigData.NCSIPortConfig.PackageId = configData.PackageId;
  2382. // pGetLanRes->ConfigData.NCSIPortConfig.ChannelId = configData.ChannelId;
  2383. // return sizeof(GetLanCCRev_T) + sizeof(NCSIPortConfig_T);
  2384. // }
  2385. // break;
  2386. // case LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE:
  2387. // {
  2388. // NIC_Count=g_coremacros.global_nic_count;
  2389. // if (pGetLanReq->SetSelect >= NIC_Count)
  2390. // {
  2391. // printf("---> log5, SetSelect = %d, NIC_Count = %d\n",pGetLanReq->SetSelect, NIC_Count);
  2392. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2393. // return sizeof(GetLanCCRev_T);
  2394. // }
  2395. // NCSIConfig_T configData;
  2396. // char interfaceName[8];
  2397. // memset(&configData, 0, sizeof(NCSIConfig_T));
  2398. // memset(interfaceName, 0, sizeof(interfaceName));
  2399. // snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pGetLanReq->SetSelect);
  2400. // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
  2401. // {
  2402. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2403. // return sizeof(GetLanCCRev_T);
  2404. // }
  2405. // if (configData.AutoSelect>= 0xFF)
  2406. // {
  2407. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2408. // return sizeof(GetLanCCRev_T);
  2409. // }
  2410. // pGetLanRes->ConfigData.NCSIModeConfig.Interface = pGetLanReq->SetSelect;
  2411. // pGetLanRes->ConfigData.NCSIModeConfig.NCSIMode = configData.AutoSelect;
  2412. // return sizeof(GetLanCCRev_T) + sizeof(NCSIModeConfig_T);
  2413. // }
  2414. // break;
  2415. // case LAN_PARAMS_AMI_OEM_NCSI_EXTENSION:
  2416. // {
  2417. // char ncsi_default_ifc[IFNAMSIZ + 1] = "eth1";
  2418. // if ((pGetLanReq->SetSelect == 0x20) &&
  2419. // (g_corefeatures.ncsi_keep_phy_linkup_support == ENABLED))
  2420. // {
  2421. // NIC_Count=g_coremacros.global_nic_count;
  2422. // NCSIConfig_T configData;
  2423. // char interfaceName[8];
  2424. // memset(&configData, 0, sizeof(NCSIConfig_T));
  2425. // memset(interfaceName, 0, sizeof(interfaceName));
  2426. // GetMacrodefine_string("CONFIG_SPX_FEATURE_NCSI_DEFAULT_INTERFACE", ncsi_default_ifc);
  2427. // snprintf(interfaceName, sizeof(interfaceName), "%s", ncsi_default_ifc);
  2428. // if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
  2429. // {
  2430. // pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
  2431. // return sizeof(GetLanCCRev_T);
  2432. // }
  2433. // char Interface[2];
  2434. // snprintf(Interface, sizeof(Interface), "%c", interfaceName[3]);
  2435. // pGetLanRes->ConfigData.NCSIPHYConfigGet.Interface = atoi(Interface);
  2436. // pGetLanRes->ConfigData.NCSIPHYConfigGet.VetoBit = configData.VetoBit;
  2437. // return sizeof(GetLanCCRev_T) + sizeof(NCSIPHYConfigGet_T);
  2438. // }
  2439. // else
  2440. // {
  2441. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
  2442. // return sizeof(GetLanCCRev_T);
  2443. // }
  2444. // }
  2445. // break;
  2446. // default:
  2447. // TDBG("In Valid Option\n");
  2448. // }
  2449. // }
  2450. // pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
  2451. // return sizeof(INT8U);
  2452. // }
  2453. // }
  2454. // return sizeof(GetLanCCRev_T) + LanconfigParameterLength[pGetLanReq->ParameterSelect];
  2455. // }
  2456. // /*---------------------------------------------------
  2457. // * SuspendBMCArps
  2458. // *---------------------------------------------------*/
  2459. // int
  2460. // SuspendBMCArps (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
  2461. // {
  2462. // _NEAR_ SuspendBMCArpsReq_T* pArpReq = (_NEAR_ SuspendBMCArpsReq_T*) pReq;
  2463. // _NEAR_ SuspendBMCArpsRes_T* pArpRes = (_NEAR_ SuspendBMCArpsRes_T*) pRes;
  2464. // INT8U EthIndex;
  2465. // /* Verify Channel ID */
  2466. // pArpRes->CompletionCode = CC_INV_DATA_FIELD;
  2467. // if(pArpReq->ChannelNo & RESERVED_BITS_SUSPENDBMCARPS) return sizeof(*pRes);
  2468. // if (!IsLANChannel(pArpReq->ChannelNo & CHANNEL_ID_MASK, BMCInst) )
  2469. // {
  2470. // return sizeof (*pRes);
  2471. // }
  2472. // EthIndex= GetEthIndex(pArpReq->ChannelNo & 0x0F,BMCInst);
  2473. // if(0xff == EthIndex)
  2474. // {
  2475. // return sizeof (*pRes);
  2476. // }
  2477. // /* Reserved Bits Validation */
  2478. // if (0 != (SUSPEND_ARP_RSVD_BIT_MASK & pArpReq->ArpSuspend))
  2479. // {
  2480. // return sizeof (*pRes);
  2481. // }
  2482. // if (BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning == TRUE)
  2483. // BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex] = pArpReq->ArpSuspend;
  2484. // /* Update Response */
  2485. // pArpRes->CompletionCode = CC_NORMAL;
  2486. // pArpRes->ArpSuspendStatus = UpdateArpStatus(EthIndex, BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning, BMCInst);
  2487. // return sizeof (SuspendBMCArpsRes_T);
  2488. // }
  2489. // /*---------------------------------------------------
  2490. // * GetIPUDPRMCPStats
  2491. // *---------------------------------------------------*/
  2492. // int
  2493. // GetIPUDPRMCPStats (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
  2494. // {
  2495. // _NEAR_ GetIPUDPRMCPStatsReq_T* pGetIPUDPRMCPStatsReq = (_NEAR_ GetIPUDPRMCPStatsReq_T*) pReq;
  2496. // _NEAR_ GetIPUDPRMCPStatsRes_T* pGetIPUDPRMCPStatsRes = (_NEAR_ GetIPUDPRMCPStatsRes_T*) pRes;
  2497. // _FAR_ BMCSharedMem_T* pSharedMem = BMC_GET_SHARED_MEM (BMCInst);
  2498. // FILE *fptr;
  2499. // char FDRead[512], FSRead[512];
  2500. // char *result = NULL;
  2501. // char **StrArray;
  2502. // int count = 0;
  2503. // int cStrings =0;
  2504. // if(pGetIPUDPRMCPStatsReq->ChannelNo & RESERVED_BITS_GETIPUDPRMCPSTATS_CH)
  2505. // {
  2506. // *pRes = CC_INV_DATA_FIELD;
  2507. // return sizeof(*pRes);
  2508. // }
  2509. // if(pGetIPUDPRMCPStatsReq->ClearStatus & RESERVED_BITS_GETIPUDPRMCPSTATS_CLRSTATE)
  2510. // {
  2511. // *pRes = CC_INV_DATA_FIELD;
  2512. // return sizeof(*pRes);
  2513. // }
  2514. // //Channel number [3:0] is valid.
  2515. // if ( !IsLANChannel(pGetIPUDPRMCPStatsReq->ChannelNo & CHANNEL_ID_MASK, BMCInst) )
  2516. // {
  2517. // pGetIPUDPRMCPStatsRes->CompletionCode = CC_INV_DATA_FIELD;
  2518. // return sizeof (*pRes);
  2519. // }
  2520. // //Clear the statistics if 1 is given in request.
  2521. // if ( pGetIPUDPRMCPStatsReq->ClearStatus & 0x01 )
  2522. // {
  2523. // /* <TBD BalaT>
  2524. // * Have to clear the already stored statistics when clear req is 1.
  2525. // */
  2526. // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
  2527. // return sizeof (INT8U);
  2528. // }
  2529. // //All Statistics values are initialised to 0.
  2530. // memset (pGetIPUDPRMCPStatsRes, 0, sizeof(GetIPUDPRMCPStatsRes_T) );
  2531. // //All the datas are taken from /proc/net/snmp file
  2532. // fptr = fopen ("/proc/net/snmp","r+");
  2533. // if (fptr == NULL)
  2534. // {
  2535. // pGetIPUDPRMCPStatsRes->CompletionCode = CC_COULD_NOT_PROVIDE_RESP;
  2536. // return sizeof (INT8U);
  2537. // }
  2538. // while( NULL != fgets(FDRead,512,fptr) )
  2539. // {
  2540. // if ( NULL != strstr (FDRead, "Ip: ") )
  2541. // {
  2542. // count++;
  2543. // if (count == 2)
  2544. // {
  2545. // //To find the no. of valid strings in a line.
  2546. // strcpy (FSRead, FDRead);
  2547. // result = strtok( FSRead, " " );
  2548. // while( result != NULL )
  2549. // {
  2550. // cStrings++;
  2551. // result = strtok( NULL, " " );
  2552. // }
  2553. // //Condition to check so that explode doesnt try to read the strings from unknown location.
  2554. // if ( cStrings == 20)
  2555. // {
  2556. // StrArray = explode (' ', FDRead);
  2557. // }
  2558. // else
  2559. // {
  2560. // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
  2561. // return sizeof (INT8U);
  2562. // }
  2563. // //All Statistics stops acumulating at FFFFh unless otherwise noted.
  2564. // //IP packets received.
  2565. // if ( atol((char *)StrArray[3]) > 0xffff)
  2566. // pGetIPUDPRMCPStatsRes->IPPacketsRecv = ( ( atol((char *)StrArray[3]) ) % 65535);
  2567. // else
  2568. // pGetIPUDPRMCPStatsRes->IPPacketsRecv = atoi((char *)StrArray[3]);
  2569. // //IP Header Error.
  2570. // pGetIPUDPRMCPStatsRes->IPHeaderErr = atoi((char *)StrArray[4]);
  2571. // //IP Address Error.
  2572. // if ( atol((char *)StrArray[5]) > 0xffff)
  2573. // pGetIPUDPRMCPStatsRes->IPAddrErr = ( ( atol((char *)StrArray[5]) ) % 65535);
  2574. // else
  2575. // pGetIPUDPRMCPStatsRes->IPAddrErr = atoi((char *)StrArray[5]);
  2576. // //Fragmented IP Packets received.
  2577. // if ( atol((char *)StrArray[17]) > 0xffff)
  2578. // pGetIPUDPRMCPStatsRes->FragIPPacketsRecv = ( ( atol((char *)StrArray[17]) ) % 65535);
  2579. // else
  2580. // pGetIPUDPRMCPStatsRes->FragIPPacketsRecv = atoi((char *)StrArray[17]);
  2581. // //IP packets Transmitted.
  2582. // if ( atol((char *)StrArray[10]) > 0xffff)
  2583. // pGetIPUDPRMCPStatsRes->IPPacketsTrans = ( ( atol((char *)StrArray[10]) ) % 65535);
  2584. // else
  2585. // pGetIPUDPRMCPStatsRes->IPPacketsTrans = atoi((char *)StrArray[10]);
  2586. // count = 0;
  2587. // }
  2588. // }
  2589. // if ( NULL != strstr (FDRead, "Udp: ") )
  2590. // {
  2591. // count++;
  2592. // if (count == 2)
  2593. // {
  2594. // //To find the no. of valid strings in a line.
  2595. // cStrings = 0;
  2596. // strcpy (FSRead, FDRead);
  2597. // result = strtok( FSRead, " " );
  2598. // while( result != NULL )
  2599. // {
  2600. // cStrings++;
  2601. // result = strtok( NULL, " " );
  2602. // }
  2603. // //Condition to check so that explode doesnt try to read the strings beyond the valid location.
  2604. // if ( cStrings == 5)
  2605. // {
  2606. // StrArray = explode (' ', FDRead);
  2607. // }
  2608. // else
  2609. // {
  2610. // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
  2611. // return sizeof (INT8U);
  2612. // }
  2613. // //UDP packets received.
  2614. // if ( atol((char *)StrArray[1]) > 0xffff)
  2615. // pGetIPUDPRMCPStatsRes->UDPPacketsRecv = ( ( atol((char *)StrArray[1]) ) % 65535);
  2616. // else
  2617. // pGetIPUDPRMCPStatsRes->UDPPacketsRecv = atoi((char *)StrArray[1]);
  2618. // count = 0;
  2619. // }
  2620. // }
  2621. // }
  2622. // fclose(fptr);
  2623. // //Valid RMCP packets received.
  2624. // pGetIPUDPRMCPStatsRes->ValidRMCPPackets = pSharedMem->gIPUDPRMCPStats;
  2625. // //<TBD BalaT>To store the statistics across the system reset and power cycles
  2626. // pGetIPUDPRMCPStatsRes->CompletionCode = CC_NORMAL;
  2627. // return sizeof (GetIPUDPRMCPStatsRes_T);
  2628. // }
  2629. // /*-----------------------------------------------------
  2630. // * explode
  2631. // * Funntion to split the strings and store in an array
  2632. // *-----------------------------------------------------*/
  2633. // char **explode(char separator, char *string)
  2634. // {
  2635. // int start = 0, i, k = 1, count = 2;
  2636. // char **strarr;
  2637. // for (i = 0; string[i] != '\0'; i++)
  2638. // /* how many rows do we need for our array? */
  2639. // if (string[i] == separator)
  2640. // count++;
  2641. // /* count is at least 2 to make room for the entire string
  2642. // * * and the ending NULL */
  2643. // strarr = malloc(count * sizeof(char*));
  2644. // i = 0;
  2645. // while (*string++ != '\0')
  2646. // {
  2647. // if (*string == separator)
  2648. // {
  2649. // strarr[i] = malloc(k - start + 2);
  2650. // strncpy(strarr[i], string - k + start, k - start + 1);
  2651. // strarr[i][k - start + 1] = '\0'; /* guarantee null termination */
  2652. // start = k;
  2653. // i++;
  2654. // }
  2655. // k++;
  2656. // }
  2657. // /* copy the last part of the string after the last separator */
  2658. // strarr[i] = malloc(k - start);
  2659. // strncpy(strarr[i], string - k + start, k - start - 1);
  2660. // strarr[i][k - start - 1] = '\0'; /* guarantee null termination */
  2661. // strarr[++i] = NULL;
  2662. // return strarr;
  2663. // }
  2664. // /*----------------------------------------------
  2665. // * UpdateArpStatus
  2666. // *----------------------------------------------*/
  2667. // INT8U
  2668. // UpdateArpStatus (INT8U EthIndex,BOOL IsTimerRunning, int BMCInst)
  2669. // {
  2670. // INT8U GratArpSuspend;
  2671. // INT8U ArpSuspend;
  2672. // INT8U Status;
  2673. // BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
  2674. // char Cmds[50]={0}; // command string to perform BMC-generated ARP
  2675. // char IfcName[16];
  2676. // IPMI_DBG_PRINT_1 ("Timer - %x", IsTimerRunning);
  2677. // GratArpSuspend = ArpSuspend = 1;
  2678. // // Check Gratuitous ARP is Enabled
  2679. // if (0 == (pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl & GRATIUTOUS_ENABLE_MASK))
  2680. // {
  2681. // GratArpSuspend = 0;
  2682. // }
  2683. // // Check ARP Response is Enabled
  2684. // if (0 == (pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl & ENABLE_ARP_RESPONSES))
  2685. // {
  2686. // ArpSuspend = 0;
  2687. // }
  2688. // /*Disable ARP */
  2689. // if (TRUE == IsTimerRunning)
  2690. // {
  2691. // /* WDT is running, check and suspend ARP if necessary */
  2692. // if( (0 != (BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex] & SUSPEND_GRAT_ARP)) &&
  2693. // (0 < GratArpSuspend) )
  2694. // {
  2695. // GratArpSuspend--;
  2696. // }
  2697. // if( (0 != (BMC_GET_SHARED_MEM(BMCInst)->ArpSuspendStatus[EthIndex] & SUSPEND_ARP)) &&
  2698. // (0 < ArpSuspend) )
  2699. // {
  2700. // ArpSuspend--;
  2701. // }
  2702. // }
  2703. // memset(IfcName,0,sizeof(IfcName));
  2704. // if(GetIfcName(EthIndex, IfcName, BMCInst) != 0)
  2705. // {
  2706. // TCRIT("Error in getting Interface Name for the Lan Index :%d\n", EthIndex);
  2707. // }
  2708. // else
  2709. // {
  2710. // /* Perform commands for BMC-generated Arp */
  2711. // memset(Cmds, 0, sizeof(Cmds));
  2712. // sprintf(Cmds, "/usr/local/bin/ArpSwitch.sh %s %d", IfcName, (!ArpSuspend) ? ARP_IGNORE_ON : ARP_IGNORE_OFF);
  2713. // safe_system (Cmds);
  2714. // /* Perform commands for BMC-generated Arp ends */
  2715. // }
  2716. // /* Update Status */
  2717. // Status = ArpSuspend << 1;
  2718. // Status = Status | GratArpSuspend;
  2719. // return Status;
  2720. // }
  2721. // /**
  2722. // *@fn NwInterfacePresenceCheck
  2723. // *@brief This function is invoked to check network interface presence
  2724. // *@param Interface - Char Pointer to Interface for which interface to check
  2725. // *@return Returns 0 on success
  2726. // */
  2727. // static int
  2728. // NwInterfacePresenceCheck (char * Interface)
  2729. // {
  2730. // int r;
  2731. // int sockdes;
  2732. // struct ifreq Ifreq;
  2733. // unsigned char MAC[MAC_ADDR_LEN];
  2734. // IPMI_DBG_PRINT_1 ("Checking the presence of %s\n", Interface);
  2735. // sockdes = socket(PF_INET, SOCK_DGRAM, 0 );
  2736. // if ( sockdes < 0 )
  2737. // {
  2738. // IPMI_ERROR("can't open socket: %s\n",strerror(errno));
  2739. // return -1;
  2740. // }
  2741. // /* Get MAC address */
  2742. // memset(&Ifreq,0,sizeof(struct ifreq));
  2743. // memset(MAC, 0, MAC_ADDR_LEN);
  2744. // strcpy(Ifreq.ifr_name, Interface);
  2745. // Ifreq.ifr_hwaddr.sa_family = AF_INET;
  2746. // r = ioctl(sockdes, SIOCGIFHWADDR, &Ifreq);
  2747. // close (sockdes);
  2748. // if ( r < 0 )
  2749. // {
  2750. // //IPMI_ERROR("IOCTL to get MAC failed: %d\n",r);
  2751. // return -1;
  2752. // }
  2753. // IPMI_DBG_PRINT_1 (" %s Interface is present\n", Interface);
  2754. // return 0;
  2755. // }