eth.cpp (5d789734ea04e1fd367de63cffc4ff3e578fad25) | eth.cpp (b69209b498bf9b1c009c528e40280d13e68f8dbd) |
---|---|
1/* 2 * Copyright 2018 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 --- 26 unchanged lines hidden (view full) --- 35} __attribute__((packed)); 36 37// TOOD(venture): The ipmid.h has this macro, which is a header we 38// can't normally access. 39#ifndef MAX_IPMI_BUFFER 40#define MAX_IPMI_BUFFER 64 41#endif 42 | 1/* 2 * Copyright 2018 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 --- 26 unchanged lines hidden (view full) --- 35} __attribute__((packed)); 36 37// TOOD(venture): The ipmid.h has this macro, which is a header we 38// can't normally access. 39#ifndef MAX_IPMI_BUFFER 40#define MAX_IPMI_BUFFER 64 41#endif 42 |
43ipmi_ret_t getEthDevice(const uint8_t*, uint8_t* replyBuf, size_t* dataLen, 44 const HandlerInterface* handler) | 43ipmi_ret_t getEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf, 44 size_t* dataLen, const HandlerInterface* handler) |
45{ 46 if ((*dataLen) < sizeof(struct EthDeviceRequest)) 47 { 48 std::fprintf(stderr, "Invalid command length: %u\n", 49 static_cast<uint32_t>(*dataLen)); 50 return IPMI_CC_REQ_DATA_LEN_INVALID; 51 } | 45{ 46 if ((*dataLen) < sizeof(struct EthDeviceRequest)) 47 { 48 std::fprintf(stderr, "Invalid command length: %u\n", 49 static_cast<uint32_t>(*dataLen)); 50 return IPMI_CC_REQ_DATA_LEN_INVALID; 51 } |
52 reqBuf += sizeof(struct EthDeviceRequest); 53 *dataLen -= sizeof(struct EthDeviceRequest); |
|
52 | 54 |
53 std::tuple<std::uint8_t, std::string> details = handler->getEthDetails(); | 55 std::tuple<std::uint8_t, std::string> details = handler->getEthDetails( 56 std::string(reinterpret_cast<const char*>(reqBuf), *dataLen)); |
54 55 std::string device = std::get<1>(details); 56 if (device.length() == 0) 57 { 58 std::fprintf(stderr, "Invalid eth string\n"); 59 return IPMI_CC_REQ_DATA_LEN_INVALID; 60 } 61 --- 20 unchanged lines hidden --- | 57 58 std::string device = std::get<1>(details); 59 if (device.length() == 0) 60 { 61 std::fprintf(stderr, "Invalid eth string\n"); 62 return IPMI_CC_REQ_DATA_LEN_INVALID; 63 } 64 --- 20 unchanged lines hidden --- |