Menu ▾ ▴

#471 Enhance LAN Alert support to work with IPv6 addressing

version-1.8.18
open
nobody
None
5
2017-01-15
2016-10-22
No

"pef policy list" and "lan alert" commands enhanced to support IPv6 addresses as alert destination.

$src/ipmitool -I lan -H 172.17.10.132 -A none pef policy list
 1 | 1 | enabled | Try-next-set | 9 | 802.3 LAN | PET | public | 0 | 0 | 172.17.3.101 | 00:00:00:00:00:00
 2 | 2 | enabled | Try-next-entry | 9 | 802.3 LAN | PET | public | 0 | 0 | 2003::3
 3 | 0 | disabled | Match-always | 0 | IPMB (I2C) | 0
 4 | 0 | disabled | Match-always | 0 | IPMB (I2C) | 0
 5 | 0 | disabled | Match-always | 0 | IPMB (I2C) | 0
 6 | 0 | disabled | Match-always | 0 | IPMB (I2C) | 0
 7 | 0 | disabled | Match-always | 0 | IPMB (I2C) | 0
 8 | 0 | disabled | Match-always | 0 | IPMB (I2C) | 0
$src/ipmitool -I lan -H 172.17.10.132 -A none lan alert print 9 0
Alert Destination       : 0
Alert Acknowledge       : Unacknowledged
Destination Type        : PET Trap
Retry Interval          : 0
Number of Retries       : 0
Alert Gateway           : Default
Alert IP Address        : 0.0.0.0
Alert MAC Address       : 21:22:23:24:25:36

$src/ipmitool -I lan -H 172.17.10.132 -A none lan alert print 9 1
Alert Destination       : 1
Alert Acknowledge       : Unacknowledged
Destination Type        : PET Trap
Retry Interval          : 0
Number of Retries       : 0
Alert Gateway           : Default
Alert IP Address        : 172.17.3.101
Alert MAC Address       : 00:00:00:00:00:00

$src/ipmitool -I lan -H 172.17.10.132 -A none lan alert print 9 2
Alert Destination       : 2
Alert Acknowledge       : Unacknowledged
Destination Type        : PET Trap
Retry Interval          : 0
Number of Retries       : 0
Alert IP Address        : 2003::3

$src/ipmitool -I lan -H 172.17.10.132 -A none lan alert set 9 3 ipv6addr 1004::4.3.2.1
Setting LAN Alert 3 IP Address to 1004::403:201
1 Attachments

Discussion

  • Zdenek Styblik

    Zdenek Styblik - 2017-01-15

    Hello Dmitry,

    #define IPV6_ADDR_DATA_SIZE 18
    #define IPV4_ADDR_DATA_SIZE 13
    

    Please, put these into A-Z order. Also, shouldn't these be used later on or is it just a coincidence?

    } else if (((rsp->data[2] & 0xF0) == 0x00) && rsp->data_len >= 13) {
    [...]
    } else if (((rsp->data[2] & 0xF0) == 0x10) && rsp->data_len >= 18) {
    

    What's the meaning of 2? Please, can you create a (local) #define for it?

    || lp_ptr->data_len < 2) {
    

    Wouldn't it be worth to create #define for the following?

    data[1] = 0x10; /* IPv6 */
    

    I see mix of tabs and spaces used for indentation. Please, fix it as well.

    I didn't try to compile patch and comments are based on read-through.

    Thanks,
    Z.

     
    • Dmitry Rakhchev

      Dmitry Rakhchev - 2017-01-31

      Fixed.

      #define IPV6_ADDR_DATA_SIZE 18
      #define IPV4_ADDR_DATA_SIZE 13
      

      Please, put these into A-Z order. Also, shouldn't these be used later on or is it just a coincidence?

      } else if (((rsp->data[2] & 0xF0) == 0x00) && rsp->data_len >= 13) {
      [...]
      } else if (((rsp->data[2] & 0xF0) == 0x10) && rsp->data_len >= 18) {
      

      That was not coincedence. I have duplicated defines with the same name in ipmi_pef.c and used them. This is not perfect, but ipmi_pef.c already duplicates enough such stuff from ipmi_lanp.c Sometimes with different names. E.g. for Get LAN Configuration command code:

      $git grep -n LAN_GET_CONFIG
      include/ipmitool/ipmi_lanp.h:39:#define IPMI_LAN_GET_CONFIG 0x02
      include/ipmitool/ipmi_pef.h:947:#define IPMI_CMD_LAN_GET_CONFIG 0x02
      lib/hpm2.c:66:#define IPMI_LAN_GET_CONFIG   0x02
      lib/hpm2.c:210: req.msg.cmd = IPMI_LAN_GET_CONFIG;
      lib/ipmi_lanp.c:161:    req.msg.cmd      = IPMI_LAN_GET_CONFIG;
      lib/ipmi_pef.c:678: req.msg.cmd = IPMI_CMD_LAN_GET_CONFIG;
      
       
      • Zdenek Styblik

        Zdenek Styblik - 2017-01-31

        I agree with duplicate defines and mess, but that wasn't my point. Applogies. My point was whether the code shouldn't be like:

        } else if (((rsp->data[2] & 0xF0) == 0x00) && rsp->data_len >= IPV4_ADDR_DATA_SIZE) {
        

        Thanks,
        Z.

         

Log in to post a comment.