blob: 9cbae11669b2cf7b772d043da9e29edfed46361a [file] [log] [blame]
Adriana Kobylak5d6481f2015-10-29 21:44:55 -05001#include <stdio.h>
2#include <string.h>
3#include <stdint.h>
Hariharasubramanian R83951912016-01-20 07:06:36 -06004#include <arpa/inet.h>
tomjose26e17732016-03-03 08:52:51 -06005#include <string>
Adriana Kobylak5d6481f2015-10-29 21:44:55 -05006
Patrick Williams37af7332016-09-02 21:21:42 -05007#include "host-ipmid/ipmid-api.h"
Patrick Williams53a360e2016-08-12 22:01:02 -05008#include "ipmid.hpp"
Adriana Kobylak5d6481f2015-10-29 21:44:55 -05009#include "transporthandler.h"
10
Hariharasubramanian R83951912016-01-20 07:06:36 -060011#define SYSTEMD_NETWORKD_DBUS 1
12
13#ifdef SYSTEMD_NETWORKD_DBUS
14#include <systemd/sd-bus.h>
Sergey Solomineb9b8142016-08-23 09:07:28 -050015#include <mapper.h>
Hariharasubramanian R83951912016-01-20 07:06:36 -060016#endif
17
18// OpenBMC System Manager dbus framework
Hariharasubramanian R83951912016-01-20 07:06:36 -060019const char *obj = "/org/openbmc/NetworkManager/Interface";
20const char *ifc = "org.openbmc.NetworkManager";
21
tomjose26e17732016-03-03 08:52:51 -060022const char *nwinterface = "eth0";
23
Adriana Kobylake08fbc62016-02-09 16:17:23 -060024const int SIZE_MAC = 18; //xx:xx:xx:xx:xx:xx
Adriana Kobylake08fbc62016-02-09 16:17:23 -060025
Nan Li3d0df912016-10-18 19:51:41 +080026struct channel_config_t channel_config;
Hariharasubramanian R83951912016-01-20 07:06:36 -060027
tomjose26e17732016-03-03 08:52:51 -060028const uint8_t SET_COMPLETE = 0;
29const uint8_t SET_IN_PROGRESS = 1;
30const uint8_t SET_COMMIT_WRITE = 2; //Optional
31const uint8_t SET_IN_PROGRESS_RESERVED = 3; //Reserved
32
33// Status of Set-In-Progress Parameter (# 0)
34uint8_t lan_set_in_progress = SET_COMPLETE;
35
36
Hariharasubramanian R83951912016-01-20 07:06:36 -060037
Adriana Kobylak5d6481f2015-10-29 21:44:55 -050038void register_netfn_transport_functions() __attribute__((constructor));
39
Nan Li3d0df912016-10-18 19:51:41 +080040// Helper Function to get IP Address/NetMask/Gateway from Network Manager or
41// Cache based on Set-In-Progress State
tomjose26e17732016-03-03 08:52:51 -060042ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t * data)
43{
44 sd_bus *bus = ipmid_get_sd_bus_connection();
45 sd_bus_message *reply = NULL;
46 sd_bus_error error = SD_BUS_ERROR_NULL;
47 int family;
48 unsigned char prefixlen;
49 char* ipaddr = NULL;
50 unsigned long mask = 0xFFFFFFFF;
51 char* gateway = NULL;
52 int r = 0;
53 ipmi_ret_t rc = IPMI_CC_OK;
Sergey Solomineb9b8142016-08-23 09:07:28 -050054 char *app = NULL;
tomjose26e17732016-03-03 08:52:51 -060055
Sergey Solomineb9b8142016-08-23 09:07:28 -050056 r = mapper_get_service(bus, obj, &app);
57 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -040058 fprintf(stderr, "Failed to get %s bus name: %s\n",
59 obj, strerror(-r));
Nan Li3d0df912016-10-18 19:51:41 +080060 rc = IPMI_CC_UNSPECIFIED_ERROR;
Sergey Solomineb9b8142016-08-23 09:07:28 -050061 goto cleanup;
62 }
tomjose26e17732016-03-03 08:52:51 -060063 r = sd_bus_call_method(bus, app, obj, ifc, "GetAddress4", &error,
64 &reply, "s", nwinterface);
65 if(r < 0)
66 {
67 fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r));
68 rc = IPMI_CC_UNSPECIFIED_ERROR;
69 goto cleanup;
70 }
71
Nan Li3d0df912016-10-18 19:51:41 +080072 r = sd_bus_message_read(reply, "iyss",
73 &family, &prefixlen, &ipaddr, &gateway);
tomjose26e17732016-03-03 08:52:51 -060074 if(r < 0)
75 {
76 fprintf(stderr, "Failed to get a response: %s\n", strerror(-rc));
77 rc = IPMI_CC_RESPONSE_ERROR;
78 goto cleanup;
79 }
80
Nan Li3d0df912016-10-18 19:51:41 +080081 printf("N/W data from HW %s:%d:%s:%s\n",
82 family==AF_INET?"IPv4":"IPv6", prefixlen, ipaddr,gateway);
83 printf("N/W data from Cache: %s:%s:%s\n",
84 channel_config.new_ipaddr.c_str(),
85 channel_config.new_netmask.c_str(),
86 channel_config.new_gateway.c_str());
tomjose26e17732016-03-03 08:52:51 -060087
88 if(lan_param == LAN_PARM_IP)
89 {
90 if(lan_set_in_progress == SET_COMPLETE)
91 {
92 std::string ipaddrstr(ipaddr);
93 inet_pton(AF_INET, ipaddrstr.c_str(),(void *)data);
94 }
95 else if(lan_set_in_progress == SET_IN_PROGRESS)
96 {
Nan Li3d0df912016-10-18 19:51:41 +080097 inet_pton(AF_INET, channel_config.new_ipaddr.c_str(), (void *)data);
tomjose26e17732016-03-03 08:52:51 -060098 }
99 }
100 else if(lan_param == LAN_PARM_SUBNET)
101 {
102 if(lan_set_in_progress == SET_COMPLETE)
103 {
104 mask = htonl(mask<<(32-prefixlen));
105 memcpy(data, &mask, 4);
106 }
107 else if(lan_set_in_progress == SET_IN_PROGRESS)
108 {
Nan Li3d0df912016-10-18 19:51:41 +0800109 inet_pton(AF_INET, channel_config.new_netmask.c_str(), (void *)data);
tomjose26e17732016-03-03 08:52:51 -0600110 }
111 }
112 else if(lan_param == LAN_PARM_GATEWAY)
113 {
114 if(lan_set_in_progress == SET_COMPLETE)
115 {
116 std::string gatewaystr(gateway);
117 inet_pton(AF_INET, gatewaystr.c_str(), (void *)data);
118 }
119 else if(lan_set_in_progress == SET_IN_PROGRESS)
120 {
Nan Li3d0df912016-10-18 19:51:41 +0800121 inet_pton(AF_INET, channel_config.new_gateway.c_str(),(void *)data);
tomjose26e17732016-03-03 08:52:51 -0600122 }
123 }
124 else
125 {
126 rc = IPMI_CC_PARM_OUT_OF_RANGE;
127 }
128
129cleanup:
130 sd_bus_error_free(&error);
131 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500132 free(app);
tomjose26e17732016-03-03 08:52:51 -0600133
134 return rc;
135}
136
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500137ipmi_ret_t ipmi_transport_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
138 ipmi_request_t request, ipmi_response_t response,
139 ipmi_data_len_t data_len, ipmi_context_t context)
140{
141 printf("Handling TRANSPORT WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
142 // Status code.
Nan Li70aa8d92016-08-29 00:11:10 +0800143 ipmi_ret_t rc = IPMI_CC_INVALID;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500144 *data_len = 0;
145 return rc;
146}
147
148struct set_lan_t {
149 uint8_t channel;
150 uint8_t parameter;
151 uint8_t data[8]; // Per IPMI spec, not expecting more than this size
152} __attribute__ ((packed));
153
154ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
155 ipmi_request_t request, ipmi_response_t response,
156 ipmi_data_len_t data_len, ipmi_context_t context)
157{
158 ipmi_ret_t rc = IPMI_CC_OK;
159 *data_len = 0;
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600160 sd_bus *bus = ipmid_get_sd_bus_connection();
Nan Li3d0df912016-10-18 19:51:41 +0800161 sd_bus_message *reply = nullptr;
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600162 sd_bus_error error = SD_BUS_ERROR_NULL;
163 int r = 0;
Nan Li3d0df912016-10-18 19:51:41 +0800164 char *app = nullptr;
165
166 char tmp_ipaddr[INET_ADDRSTRLEN];
167 char tmp_netmask[INET_ADDRSTRLEN];
168 char tmp_gateway[INET_ADDRSTRLEN];
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500169
170 printf("IPMI SET_LAN\n");
171
172 set_lan_t *reqptr = (set_lan_t*) request;
173
Nan Li3d0df912016-10-18 19:51:41 +0800174 if (reqptr->parameter == LAN_PARM_IP) {
175 snprintf(tmp_ipaddr, INET_ADDRSTRLEN, "%d.%d.%d.%d",
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600176 reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]);
Nan Li3d0df912016-10-18 19:51:41 +0800177 channel_config.new_ipaddr.assign(tmp_ipaddr);
178 } else if (reqptr->parameter == LAN_PARM_MAC) {
tomjose26e17732016-03-03 08:52:51 -0600179 char mac[SIZE_MAC];
Adriana Kobylakd54a9dd2016-02-03 17:25:54 -0600180
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600181 snprintf(mac, SIZE_MAC, "%02x:%02x:%02x:%02x:%02x:%02x",
Adriana Kobylakd54a9dd2016-02-03 17:25:54 -0600182 reqptr->data[0],
183 reqptr->data[1],
184 reqptr->data[2],
185 reqptr->data[3],
186 reqptr->data[4],
187 reqptr->data[5]);
188
Sergey Solomineb9b8142016-08-23 09:07:28 -0500189 r = mapper_get_service(bus, obj, &app);
190 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400191 fprintf(stderr, "Failed to get %s bus name: %s\n",
192 obj, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500193 goto finish;
194 }
tomjose26e17732016-03-03 08:52:51 -0600195 r = sd_bus_call_method(bus, app, obj, ifc, "SetHwAddress", &error,
196 &reply, "ss", nwinterface, mac);
Nan Li3d0df912016-10-18 19:51:41 +0800197 if (r < 0) {
tomjose26e17732016-03-03 08:52:51 -0600198 fprintf(stderr, "Failed to call the method: %s\n", strerror(-r));
199 rc = IPMI_CC_UNSPECIFIED_ERROR;
Adriana Kobylakd54a9dd2016-02-03 17:25:54 -0600200 }
Nan Li3d0df912016-10-18 19:51:41 +0800201 } else if (reqptr->parameter == LAN_PARM_SUBNET)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500202 {
Nan Li3d0df912016-10-18 19:51:41 +0800203 snprintf(tmp_netmask, INET_ADDRSTRLEN, "%d.%d.%d.%d",
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600204 reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]);
Nan Li3d0df912016-10-18 19:51:41 +0800205 channel_config.new_netmask.assign(tmp_netmask);
206 } else if (reqptr->parameter == LAN_PARM_GATEWAY)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500207 {
Nan Li3d0df912016-10-18 19:51:41 +0800208 snprintf(tmp_gateway, INET_ADDRSTRLEN, "%d.%d.%d.%d",
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600209 reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]);
Nan Li3d0df912016-10-18 19:51:41 +0800210 channel_config.new_gateway.assign(tmp_gateway);
211 } else if (reqptr->parameter == LAN_PARM_INPROGRESS)
Hariharasubramanian R83951912016-01-20 07:06:36 -0600212 {
Nan Li3d0df912016-10-18 19:51:41 +0800213 if(reqptr->data[0] == SET_COMPLETE) {
tomjose26e17732016-03-03 08:52:51 -0600214 lan_set_in_progress = SET_COMPLETE;
Hariharasubramanian R83951912016-01-20 07:06:36 -0600215
Nan Li3d0df912016-10-18 19:51:41 +0800216 printf("N/W data from Cache: %s:%s:%s\n",
217 channel_config.new_ipaddr.c_str(),
218 channel_config.new_netmask.c_str(),
219 channel_config.new_gateway.c_str());
220 printf("Use Set Channel Access command to apply them\n");
221
222 } else if(reqptr->data[0] == SET_IN_PROGRESS) // Set In Progress
Hariharasubramanian R83951912016-01-20 07:06:36 -0600223 {
tomjose26e17732016-03-03 08:52:51 -0600224 lan_set_in_progress = SET_IN_PROGRESS;
vishwa1eaea4f2016-02-26 11:57:40 -0600225 }
Nan Li3d0df912016-10-18 19:51:41 +0800226 } else
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500227 {
228 fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
vishwa1eaea4f2016-02-26 11:57:40 -0600229 rc = IPMI_CC_PARM_NOT_SUPPORTED;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500230 }
231
Sergey Solomineb9b8142016-08-23 09:07:28 -0500232finish:
vishwa1eaea4f2016-02-26 11:57:40 -0600233 sd_bus_error_free(&error);
234 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500235 free(app);
vishwa1eaea4f2016-02-26 11:57:40 -0600236
tomjose26e17732016-03-03 08:52:51 -0600237 return rc;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500238}
239
240struct get_lan_t {
241 uint8_t rev_channel;
242 uint8_t parameter;
243 uint8_t parameter_set;
244 uint8_t parameter_block;
245} __attribute__ ((packed));
246
247ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
248 ipmi_request_t request, ipmi_response_t response,
249 ipmi_data_len_t data_len, ipmi_context_t context)
250{
251 ipmi_ret_t rc = IPMI_CC_OK;
252 *data_len = 0;
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600253 sd_bus *bus = ipmid_get_sd_bus_connection();
vishwa1eaea4f2016-02-26 11:57:40 -0600254 sd_bus_message *reply = NULL;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600255 sd_bus_error error = SD_BUS_ERROR_NULL;
256 int r = 0;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500257 const uint8_t current_revision = 0x11; // Current rev per IPMI Spec 2.0
tomjose26e17732016-03-03 08:52:51 -0600258 int i = 0;
Sergey Solomineb9b8142016-08-23 09:07:28 -0500259 char *app = NULL;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500260
261 printf("IPMI GET_LAN\n");
262
263 get_lan_t *reqptr = (get_lan_t*) request;
264
265 if (reqptr->rev_channel & 0x80) // Revision is bit 7
266 {
267 // Only current revision was requested
268 *data_len = sizeof(current_revision);
269 memcpy(response, &current_revision, *data_len);
270 return IPMI_CC_OK;
271 }
272
273 // TODO Use dbus interface once available. For now use ip cmd.
274 // TODO Add the rest of the parameters, like gateway
275
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600276 if (reqptr->parameter == LAN_PARM_INPROGRESS)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500277 {
tomjose26e17732016-03-03 08:52:51 -0600278 uint8_t buf[] = {current_revision, lan_set_in_progress};
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500279 *data_len = sizeof(buf);
280 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500281 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600282 else if (reqptr->parameter == LAN_PARM_AUTHSUPPORT)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500283 {
284 uint8_t buf[] = {current_revision,0x04};
285 *data_len = sizeof(buf);
286 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500287 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600288 else if (reqptr->parameter == LAN_PARM_AUTHENABLES)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500289 {
290 uint8_t buf[] = {current_revision,0x04,0x04,0x04,0x04,0x04};
291 *data_len = sizeof(buf);
292 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500293 }
tomjose26e17732016-03-03 08:52:51 -0600294 else if ((reqptr->parameter == LAN_PARM_IP) || (reqptr->parameter == LAN_PARM_SUBNET) || (reqptr->parameter == LAN_PARM_GATEWAY))
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500295 {
tomjose26e17732016-03-03 08:52:51 -0600296 uint8_t buf[5];
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500297
tomjose26e17732016-03-03 08:52:51 -0600298 *data_len = sizeof(current_revision);
299 memcpy(buf, &current_revision, *data_len);
300
301 if(getNetworkData(reqptr->parameter, &buf[1]) == IPMI_CC_OK)
vishwa1eaea4f2016-02-26 11:57:40 -0600302 {
tomjose26e17732016-03-03 08:52:51 -0600303 *data_len = sizeof(buf);
304 memcpy(response, &buf, *data_len);
Adriana Kobylak342df102016-02-10 13:48:16 -0600305 }
tomjose26e17732016-03-03 08:52:51 -0600306 else
Hariharasubramanian R83951912016-01-20 07:06:36 -0600307 {
tomjose26e17732016-03-03 08:52:51 -0600308 rc = IPMI_CC_UNSPECIFIED_ERROR;
Hariharasubramanian R83951912016-01-20 07:06:36 -0600309 }
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500310 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600311 else if (reqptr->parameter == LAN_PARM_MAC)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500312 {
313 //string to parse: link/ether xx:xx:xx:xx:xx:xx
tomjose26e17732016-03-03 08:52:51 -0600314 uint8_t buf[7];
Adriana Kobylak9355f612016-02-08 17:30:37 -0600315 char *eaddr1 = NULL;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500316
Sergey Solomineb9b8142016-08-23 09:07:28 -0500317 r = mapper_get_service(bus, obj, &app);
318 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400319 fprintf(stderr, "Failed to get %s bus name: %s\n",
320 obj, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500321 goto cleanup;
322 }
tomjose26e17732016-03-03 08:52:51 -0600323 r = sd_bus_call_method(bus, app, obj, ifc, "GetHwAddress", &error,
324 &reply, "s", nwinterface);
325 if(r < 0)
vishwa1eaea4f2016-02-26 11:57:40 -0600326 {
tomjose26e17732016-03-03 08:52:51 -0600327 fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r));
328 rc = IPMI_CC_UNSPECIFIED_ERROR;
329 goto cleanup;
Hariharasubramanian R83951912016-01-20 07:06:36 -0600330 }
tomjose26e17732016-03-03 08:52:51 -0600331
Adriana Kobylak9355f612016-02-08 17:30:37 -0600332 r = sd_bus_message_read(reply, "s", &eaddr1);
vishwa1eaea4f2016-02-26 11:57:40 -0600333 if (r < 0)
334 {
Adriana Kobylak9355f612016-02-08 17:30:37 -0600335 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
tomjose26e17732016-03-03 08:52:51 -0600336 rc = IPMI_CC_UNSPECIFIED_ERROR;
337 goto cleanup;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600338 }
339 if (eaddr1 == NULL)
340 {
341 fprintf(stderr, "Failed to get a valid response: %s", strerror(-r));
tomjose26e17732016-03-03 08:52:51 -0600342 rc = IPMI_CC_UNSPECIFIED_ERROR;
343 goto cleanup;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600344 }
Hariharasubramanian R83951912016-01-20 07:06:36 -0600345
346 memcpy((void*)&buf[0], &current_revision, 1);
Adriana Kobylak9355f612016-02-08 17:30:37 -0600347
348 char *tokptr = NULL;
349 char* digit = strtok_r(eaddr1, ":", &tokptr);
350 if (digit == NULL)
351 {
352 fprintf(stderr, "Unexpected MAC format: %s", eaddr1);
vishwa1eaea4f2016-02-26 11:57:40 -0600353 rc = IPMI_CC_RESPONSE_ERROR;
tomjose26e17732016-03-03 08:52:51 -0600354 goto cleanup;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600355 }
356
357 i=0;
358 while (digit != NULL)
359 {
360 int resp_byte = strtoul(digit, NULL, 16);
361 memcpy((void*)&buf[i+1], &resp_byte, 1);
362 i++;
363 digit = strtok_r(NULL, ":", &tokptr);
364 }
Hariharasubramanian R83951912016-01-20 07:06:36 -0600365
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500366 *data_len = sizeof(buf);
367 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500368 }
369 else
370 {
371 fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
vishwa1eaea4f2016-02-26 11:57:40 -0600372 rc = IPMI_CC_PARM_NOT_SUPPORTED;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500373 }
374
tomjose26e17732016-03-03 08:52:51 -0600375cleanup:
vishwa1eaea4f2016-02-26 11:57:40 -0600376 sd_bus_error_free(&error);
377 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500378 free(app);
vishwa1eaea4f2016-02-26 11:57:40 -0600379
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500380 return rc;
381}
382
383void register_netfn_transport_functions()
384{
Tom05732372016-09-06 17:21:23 +0530385 // <Wildcard Command>
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500386 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_WILDCARD);
Tom05732372016-09-06 17:21:23 +0530387 ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_WILDCARD, NULL, ipmi_transport_wildcard,
388 PRIVILEGE_USER);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500389
Tom05732372016-09-06 17:21:23 +0530390 // <Set LAN Configuration Parameters>
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500391 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_SET_LAN);
Tom05732372016-09-06 17:21:23 +0530392 ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_SET_LAN, NULL, ipmi_transport_set_lan,
393 PRIVILEGE_ADMIN);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500394
Tom05732372016-09-06 17:21:23 +0530395 // <Get LAN Configuration Parameters>
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500396 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_GET_LAN);
Tom05732372016-09-06 17:21:23 +0530397 ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_GET_LAN, NULL, ipmi_transport_get_lan,
398 PRIVILEGE_OPERATOR);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500399
400 return;
401}