blob: 32ed993104cbe17582c11c6161916228017e6a84 [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
tomjose26e17732016-03-03 08:52:51 -060026char new_ipaddr [INET_ADDRSTRLEN] = "";
27char new_netmask [INET_ADDRSTRLEN] = "";
28char new_gateway [INET_ADDRSTRLEN] = "";
Hariharasubramanian R83951912016-01-20 07:06:36 -060029
tomjose26e17732016-03-03 08:52:51 -060030const uint8_t SET_COMPLETE = 0;
31const uint8_t SET_IN_PROGRESS = 1;
32const uint8_t SET_COMMIT_WRITE = 2; //Optional
33const uint8_t SET_IN_PROGRESS_RESERVED = 3; //Reserved
34
35// Status of Set-In-Progress Parameter (# 0)
36uint8_t lan_set_in_progress = SET_COMPLETE;
37
38
Hariharasubramanian R83951912016-01-20 07:06:36 -060039
Adriana Kobylak5d6481f2015-10-29 21:44:55 -050040void register_netfn_transport_functions() __attribute__((constructor));
41
tomjose26e17732016-03-03 08:52:51 -060042// Helper Function to get IP Address/NetMask/Gateway from Network Manager or Cache
43// based on Set-In-Progress State
44ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t * data)
45{
46 sd_bus *bus = ipmid_get_sd_bus_connection();
47 sd_bus_message *reply = NULL;
48 sd_bus_error error = SD_BUS_ERROR_NULL;
49 int family;
50 unsigned char prefixlen;
51 char* ipaddr = NULL;
52 unsigned long mask = 0xFFFFFFFF;
53 char* gateway = NULL;
54 int r = 0;
55 ipmi_ret_t rc = IPMI_CC_OK;
Sergey Solomineb9b8142016-08-23 09:07:28 -050056 char *app = NULL;
tomjose26e17732016-03-03 08:52:51 -060057
Sergey Solomineb9b8142016-08-23 09:07:28 -050058 r = mapper_get_service(bus, obj, &app);
59 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -040060 fprintf(stderr, "Failed to get %s bus name: %s\n",
61 obj, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -050062 goto cleanup;
63 }
tomjose26e17732016-03-03 08:52:51 -060064 r = sd_bus_call_method(bus, app, obj, ifc, "GetAddress4", &error,
65 &reply, "s", nwinterface);
66 if(r < 0)
67 {
68 fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r));
69 rc = IPMI_CC_UNSPECIFIED_ERROR;
70 goto cleanup;
71 }
72
73 r = sd_bus_message_read(reply, "iyss", &family, &prefixlen, &ipaddr, &gateway);
74 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
81 printf("N/W data from HW %s:%d:%s:%s\n", family==AF_INET?"IPv4":"IPv6", prefixlen, ipaddr,gateway);
82 printf("N/W data from Cache: %s:%s:%s\n", new_ipaddr, new_netmask, new_gateway);
83
84 if(lan_param == LAN_PARM_IP)
85 {
86 if(lan_set_in_progress == SET_COMPLETE)
87 {
88 std::string ipaddrstr(ipaddr);
89 inet_pton(AF_INET, ipaddrstr.c_str(),(void *)data);
90 }
91 else if(lan_set_in_progress == SET_IN_PROGRESS)
92 {
93 inet_pton(AF_INET, new_ipaddr, (void *)data);
94 }
95 }
96 else if(lan_param == LAN_PARM_SUBNET)
97 {
98 if(lan_set_in_progress == SET_COMPLETE)
99 {
100 mask = htonl(mask<<(32-prefixlen));
101 memcpy(data, &mask, 4);
102 }
103 else if(lan_set_in_progress == SET_IN_PROGRESS)
104 {
105 inet_pton(AF_INET, new_netmask, (void *)data);
106 }
107 }
108 else if(lan_param == LAN_PARM_GATEWAY)
109 {
110 if(lan_set_in_progress == SET_COMPLETE)
111 {
112 std::string gatewaystr(gateway);
113 inet_pton(AF_INET, gatewaystr.c_str(), (void *)data);
114 }
115 else if(lan_set_in_progress == SET_IN_PROGRESS)
116 {
117 inet_pton(AF_INET, new_gateway,(void *)data);
118 }
119 }
120 else
121 {
122 rc = IPMI_CC_PARM_OUT_OF_RANGE;
123 }
124
125cleanup:
126 sd_bus_error_free(&error);
127 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500128 free(app);
tomjose26e17732016-03-03 08:52:51 -0600129
130 return rc;
131}
132
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500133ipmi_ret_t ipmi_transport_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
134 ipmi_request_t request, ipmi_response_t response,
135 ipmi_data_len_t data_len, ipmi_context_t context)
136{
137 printf("Handling TRANSPORT WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
138 // Status code.
Nan Li70aa8d92016-08-29 00:11:10 +0800139 ipmi_ret_t rc = IPMI_CC_INVALID;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500140 *data_len = 0;
141 return rc;
142}
143
144struct set_lan_t {
145 uint8_t channel;
146 uint8_t parameter;
147 uint8_t data[8]; // Per IPMI spec, not expecting more than this size
148} __attribute__ ((packed));
149
150ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
151 ipmi_request_t request, ipmi_response_t response,
152 ipmi_data_len_t data_len, ipmi_context_t context)
153{
154 ipmi_ret_t rc = IPMI_CC_OK;
155 *data_len = 0;
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600156 sd_bus *bus = ipmid_get_sd_bus_connection();
vishwa1eaea4f2016-02-26 11:57:40 -0600157 sd_bus_message *reply = NULL;
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600158 sd_bus_error error = SD_BUS_ERROR_NULL;
159 int r = 0;
Sergey Solomineb9b8142016-08-23 09:07:28 -0500160 char *app = NULL;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500161
162 printf("IPMI SET_LAN\n");
163
164 set_lan_t *reqptr = (set_lan_t*) request;
165
166 // TODO Use dbus interface once available. For now use cmd line.
167 // TODO Add the rest of the parameters like setting auth type
168 // TODO Add error handling
169
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600170 if (reqptr->parameter == LAN_PARM_IP)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500171 {
tomjose26e17732016-03-03 08:52:51 -0600172 snprintf(new_ipaddr, INET_ADDRSTRLEN, "%d.%d.%d.%d",
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600173 reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500174 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600175 else if (reqptr->parameter == LAN_PARM_MAC)
Adriana Kobylakd54a9dd2016-02-03 17:25:54 -0600176 {
tomjose26e17732016-03-03 08:52:51 -0600177 char mac[SIZE_MAC];
Adriana Kobylakd54a9dd2016-02-03 17:25:54 -0600178
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600179 snprintf(mac, SIZE_MAC, "%02x:%02x:%02x:%02x:%02x:%02x",
Adriana Kobylakd54a9dd2016-02-03 17:25:54 -0600180 reqptr->data[0],
181 reqptr->data[1],
182 reqptr->data[2],
183 reqptr->data[3],
184 reqptr->data[4],
185 reqptr->data[5]);
186
Sergey Solomineb9b8142016-08-23 09:07:28 -0500187 r = mapper_get_service(bus, obj, &app);
188 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400189 fprintf(stderr, "Failed to get %s bus name: %s\n",
190 obj, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500191 goto finish;
192 }
tomjose26e17732016-03-03 08:52:51 -0600193 r = sd_bus_call_method(bus, app, obj, ifc, "SetHwAddress", &error,
194 &reply, "ss", nwinterface, mac);
195 if(r < 0)
196 {
197 fprintf(stderr, "Failed to call the method: %s\n", strerror(-r));
198 rc = IPMI_CC_UNSPECIFIED_ERROR;
Adriana Kobylakd54a9dd2016-02-03 17:25:54 -0600199 }
200 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600201 else if (reqptr->parameter == LAN_PARM_SUBNET)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500202 {
tomjose26e17732016-03-03 08:52:51 -0600203 snprintf(new_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]);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500205 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600206 else if (reqptr->parameter == LAN_PARM_GATEWAY)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500207 {
tomjose26e17732016-03-03 08:52:51 -0600208 snprintf(new_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]);
Hariharasubramanian R83951912016-01-20 07:06:36 -0600210 }
tomjose26e17732016-03-03 08:52:51 -0600211 else if (reqptr->parameter == LAN_PARM_INPROGRESS)
Hariharasubramanian R83951912016-01-20 07:06:36 -0600212 {
tomjose26e17732016-03-03 08:52:51 -0600213 if(reqptr->data[0] == SET_COMPLETE) // Set Complete
Hariharasubramanian R83951912016-01-20 07:06:36 -0600214 {
tomjose26e17732016-03-03 08:52:51 -0600215 lan_set_in_progress = SET_COMPLETE;
216 // Apply the IP settings once IP Address, Netmask and Gateway is set
217 if (!strcmp(new_ipaddr, "") || !strcmp (new_netmask, "") || !strcmp (new_gateway, ""))
218 {
219 printf("ERROR: Incomplete LAN Parameters\n");
220 }
221 else
222 {
Hariharasubramanian R83951912016-01-20 07:06:36 -0600223
tomjose26e17732016-03-03 08:52:51 -0600224 r = sd_bus_call_method(bus, // On the System Bus
225 app, // Service to contact
226 obj, // Object path
227 ifc, // Interface name
228 "SetAddress4", // Method to be called
229 &error, // object to return error
230 &reply, // Response message on success
231 "ssss", // input message (Interface, IP Address, Netmask, Gateway)
232 nwinterface, // eth0
233 new_ipaddr,
234 new_netmask,
235 new_gateway);
236 if(r < 0)
237 {
238 fprintf(stderr, "Failed to set network data %s:%s:%s %s\n", new_ipaddr, new_netmask, new_gateway, error.message);
239 rc = IPMI_CC_UNSPECIFIED_ERROR;
240 }
241 memset(new_ipaddr, 0, INET_ADDRSTRLEN);
242 memset(new_netmask, 0, INET_ADDRSTRLEN);
243 memset(new_gateway, 0, INET_ADDRSTRLEN);
244 }
Hariharasubramanian R83951912016-01-20 07:06:36 -0600245 }
tomjose26e17732016-03-03 08:52:51 -0600246 else if(reqptr->data[0] == SET_IN_PROGRESS) // Set In Progress
Hariharasubramanian R83951912016-01-20 07:06:36 -0600247 {
tomjose26e17732016-03-03 08:52:51 -0600248 lan_set_in_progress = SET_IN_PROGRESS;
vishwa1eaea4f2016-02-26 11:57:40 -0600249 }
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500250 }
251 else
252 {
253 fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
vishwa1eaea4f2016-02-26 11:57:40 -0600254 rc = IPMI_CC_PARM_NOT_SUPPORTED;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500255 }
256
Sergey Solomineb9b8142016-08-23 09:07:28 -0500257finish:
vishwa1eaea4f2016-02-26 11:57:40 -0600258 sd_bus_error_free(&error);
259 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500260 free(app);
vishwa1eaea4f2016-02-26 11:57:40 -0600261
tomjose26e17732016-03-03 08:52:51 -0600262 return rc;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500263}
264
265struct get_lan_t {
266 uint8_t rev_channel;
267 uint8_t parameter;
268 uint8_t parameter_set;
269 uint8_t parameter_block;
270} __attribute__ ((packed));
271
272ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
273 ipmi_request_t request, ipmi_response_t response,
274 ipmi_data_len_t data_len, ipmi_context_t context)
275{
276 ipmi_ret_t rc = IPMI_CC_OK;
277 *data_len = 0;
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600278 sd_bus *bus = ipmid_get_sd_bus_connection();
vishwa1eaea4f2016-02-26 11:57:40 -0600279 sd_bus_message *reply = NULL;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600280 sd_bus_error error = SD_BUS_ERROR_NULL;
281 int r = 0;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500282 const uint8_t current_revision = 0x11; // Current rev per IPMI Spec 2.0
tomjose26e17732016-03-03 08:52:51 -0600283 int i = 0;
Sergey Solomineb9b8142016-08-23 09:07:28 -0500284 char *app = NULL;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500285
286 printf("IPMI GET_LAN\n");
287
288 get_lan_t *reqptr = (get_lan_t*) request;
289
290 if (reqptr->rev_channel & 0x80) // Revision is bit 7
291 {
292 // Only current revision was requested
293 *data_len = sizeof(current_revision);
294 memcpy(response, &current_revision, *data_len);
295 return IPMI_CC_OK;
296 }
297
298 // TODO Use dbus interface once available. For now use ip cmd.
299 // TODO Add the rest of the parameters, like gateway
300
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600301 if (reqptr->parameter == LAN_PARM_INPROGRESS)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500302 {
tomjose26e17732016-03-03 08:52:51 -0600303 uint8_t buf[] = {current_revision, lan_set_in_progress};
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500304 *data_len = sizeof(buf);
305 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500306 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600307 else if (reqptr->parameter == LAN_PARM_AUTHSUPPORT)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500308 {
309 uint8_t buf[] = {current_revision,0x04};
310 *data_len = sizeof(buf);
311 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500312 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600313 else if (reqptr->parameter == LAN_PARM_AUTHENABLES)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500314 {
315 uint8_t buf[] = {current_revision,0x04,0x04,0x04,0x04,0x04};
316 *data_len = sizeof(buf);
317 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500318 }
tomjose26e17732016-03-03 08:52:51 -0600319 else if ((reqptr->parameter == LAN_PARM_IP) || (reqptr->parameter == LAN_PARM_SUBNET) || (reqptr->parameter == LAN_PARM_GATEWAY))
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500320 {
tomjose26e17732016-03-03 08:52:51 -0600321 uint8_t buf[5];
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500322
tomjose26e17732016-03-03 08:52:51 -0600323 *data_len = sizeof(current_revision);
324 memcpy(buf, &current_revision, *data_len);
325
326 if(getNetworkData(reqptr->parameter, &buf[1]) == IPMI_CC_OK)
vishwa1eaea4f2016-02-26 11:57:40 -0600327 {
tomjose26e17732016-03-03 08:52:51 -0600328 *data_len = sizeof(buf);
329 memcpy(response, &buf, *data_len);
Adriana Kobylak342df102016-02-10 13:48:16 -0600330 }
tomjose26e17732016-03-03 08:52:51 -0600331 else
Hariharasubramanian R83951912016-01-20 07:06:36 -0600332 {
tomjose26e17732016-03-03 08:52:51 -0600333 rc = IPMI_CC_UNSPECIFIED_ERROR;
Hariharasubramanian R83951912016-01-20 07:06:36 -0600334 }
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500335 }
Adriana Kobylake08fbc62016-02-09 16:17:23 -0600336 else if (reqptr->parameter == LAN_PARM_MAC)
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500337 {
338 //string to parse: link/ether xx:xx:xx:xx:xx:xx
tomjose26e17732016-03-03 08:52:51 -0600339 uint8_t buf[7];
Adriana Kobylak9355f612016-02-08 17:30:37 -0600340 char *eaddr1 = NULL;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500341
Sergey Solomineb9b8142016-08-23 09:07:28 -0500342 r = mapper_get_service(bus, obj, &app);
343 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400344 fprintf(stderr, "Failed to get %s bus name: %s\n",
345 obj, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500346 goto cleanup;
347 }
tomjose26e17732016-03-03 08:52:51 -0600348 r = sd_bus_call_method(bus, app, obj, ifc, "GetHwAddress", &error,
349 &reply, "s", nwinterface);
350 if(r < 0)
vishwa1eaea4f2016-02-26 11:57:40 -0600351 {
tomjose26e17732016-03-03 08:52:51 -0600352 fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r));
353 rc = IPMI_CC_UNSPECIFIED_ERROR;
354 goto cleanup;
Hariharasubramanian R83951912016-01-20 07:06:36 -0600355 }
tomjose26e17732016-03-03 08:52:51 -0600356
Adriana Kobylak9355f612016-02-08 17:30:37 -0600357 r = sd_bus_message_read(reply, "s", &eaddr1);
vishwa1eaea4f2016-02-26 11:57:40 -0600358 if (r < 0)
359 {
Adriana Kobylak9355f612016-02-08 17:30:37 -0600360 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
tomjose26e17732016-03-03 08:52:51 -0600361 rc = IPMI_CC_UNSPECIFIED_ERROR;
362 goto cleanup;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600363 }
364 if (eaddr1 == NULL)
365 {
366 fprintf(stderr, "Failed to get a valid response: %s", strerror(-r));
tomjose26e17732016-03-03 08:52:51 -0600367 rc = IPMI_CC_UNSPECIFIED_ERROR;
368 goto cleanup;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600369 }
Hariharasubramanian R83951912016-01-20 07:06:36 -0600370
371 memcpy((void*)&buf[0], &current_revision, 1);
Adriana Kobylak9355f612016-02-08 17:30:37 -0600372
373 char *tokptr = NULL;
374 char* digit = strtok_r(eaddr1, ":", &tokptr);
375 if (digit == NULL)
376 {
377 fprintf(stderr, "Unexpected MAC format: %s", eaddr1);
vishwa1eaea4f2016-02-26 11:57:40 -0600378 rc = IPMI_CC_RESPONSE_ERROR;
tomjose26e17732016-03-03 08:52:51 -0600379 goto cleanup;
Adriana Kobylak9355f612016-02-08 17:30:37 -0600380 }
381
382 i=0;
383 while (digit != NULL)
384 {
385 int resp_byte = strtoul(digit, NULL, 16);
386 memcpy((void*)&buf[i+1], &resp_byte, 1);
387 i++;
388 digit = strtok_r(NULL, ":", &tokptr);
389 }
Hariharasubramanian R83951912016-01-20 07:06:36 -0600390
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500391 *data_len = sizeof(buf);
392 memcpy(response, &buf, *data_len);
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500393 }
394 else
395 {
396 fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
vishwa1eaea4f2016-02-26 11:57:40 -0600397 rc = IPMI_CC_PARM_NOT_SUPPORTED;
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500398 }
399
tomjose26e17732016-03-03 08:52:51 -0600400cleanup:
vishwa1eaea4f2016-02-26 11:57:40 -0600401 sd_bus_error_free(&error);
402 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500403 free(app);
vishwa1eaea4f2016-02-26 11:57:40 -0600404
Adriana Kobylak5d6481f2015-10-29 21:44:55 -0500405 return rc;
406}
407
408void register_netfn_transport_functions()
409{
410 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_WILDCARD);
411 ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_WILDCARD, NULL, ipmi_transport_wildcard);
412
413 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_SET_LAN);
414 ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_SET_LAN, NULL, ipmi_transport_set_lan);
415
416 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_GET_LAN);
417 ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_GET_LAN, NULL, ipmi_transport_get_lan);
418
419 return;
420}