transporthandler: fix ipmid crash

The ipmid crashes when the set LAN configuration command is executed,
and the journal log shows the following messages.

```
/usr/include/c++/14.2.0/optional:475: constexpr _Tp&
std::_Optional_base_impl<_Tp, _Dp>::_M_get() [with _Tp =
ipmi::transport::IfAddr<2>; _Dp =
std::_Optional_base<ipmi::transport::IfAddr<2>, false, false>]:
Assertion 'this->_M_is_engaged()' failed.
```

Add checks to ensure that the return value of getIfAddr or getIfAddr4 is
not null.

Tested:
1. Change to static source and set satatic IP
ipmitool lan set 1 ipsrc static; ipmitool lan set 1 ipaddr 10.0.0.10;
ipmitool lan set 1 netmask 255.255.255.0; ipmitool lan set 1 defgw
ipaddr 10.0.0.254

2. Check the IP Lan print.
ipmitool lan print 1

Expect the IP address and IP source address report accordingly.

Change-Id: I1ddfcf0addbed466a385b1e6b9e232154c440262
Signed-off-by: Vince Chang <vince_chang@aspeedtech.com>
1 file changed
tree: 2b7d0dccba81e003347a4fbc3744f8179091b505
  1. app/
  2. dbus-sdr/
  3. docs/
  4. include/
  5. libipmid/
  6. scripts/
  7. softoff/
  8. subprojects/
  9. test/
  10. user_channel/
  11. xyz/
  12. .build.sh
  13. .clang-format
  14. .gitignore
  15. .shellcheck
  16. .travis.yml
  17. apphandler.cpp
  18. apphandler.hpp
  19. chassishandler.cpp
  20. chassishandler.hpp
  21. dcmihandler.cpp
  22. dcmihandler.hpp
  23. error-HostEvent.hpp
  24. fruread.hpp
  25. generate_whitelist.sh
  26. generate_whitelist_create.sh
  27. globalhandler.cpp
  28. globalhandler.hpp
  29. groupext.cpp
  30. host-cmd-manager.cpp
  31. host-cmd-manager.hpp
  32. host-interface.cpp
  33. host-interface.hpp
  34. host-ipmid-whitelist.conf
  35. ipmi_fru_info_area.cpp
  36. ipmi_fru_info_area.hpp
  37. ipmiallowlist.hpp
  38. ipmid-new.cpp
  39. ipmisensor.cpp
  40. LICENSE
  41. meson.build
  42. meson.options
  43. OWNERS
  44. read_fru_data.cpp
  45. read_fru_data.hpp
  46. README.md
  47. selutility.cpp
  48. selutility.hpp
  49. sensordatahandler.cpp
  50. sensordatahandler.hpp
  51. sensorhandler.cpp
  52. sensorhandler.hpp
  53. settings.cpp
  54. settings.hpp
  55. storageaddsel.cpp
  56. storageaddsel.hpp
  57. storagehandler.cpp
  58. storagehandler.hpp
  59. sys_info_param.cpp
  60. sys_info_param.hpp
  61. systemintfcmds.cpp
  62. systemintfcmds.hpp
  63. transportconstants.hpp
  64. transporthandler.cpp
  65. transporthandler.hpp
  66. whitelist-filter.cpp
README.md

phosphor-host-ipmid

Compile ipmid with default options

meson builddir
ninja -C builddir

Compile ipmid with yocto defaults

meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled
ninja -C builddir

If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in ipmid/subprojects.

Enable/Disable meson wrap feature

meson builddir -Dwrap_mode=nofallback
ninja -C builddir

Enable debug traces

meson builddir -Dbuildtype=debug
ninja -C builddir

Generate test coverage report

meson builddir -Db_coverage=true -Dtests=enabled
ninja -C builddir test
ninja -C builddir coverage