Menu

#319 Interface safe re-open.

version-1.8.16
closed-fixed
None
5
2015-03-11
2014-04-15
No

Currently, interface-management code in the ipmitool does not allow safe interface re-opening (i.e. closing and opening again). It is because the session is allocated in the interface setup callback while is freed in the close callback. So, normal re-opening of the interface, which can be required for example durng the HPM.1 upgrade, leads to segmentation fault. That's why in the ipmi_hpmfwupg.c instead of normal closing interface, directly access the interface data for subsequent re-opening.
The proposed patch splits the session data into parameters part, which is setup once per ipmitool lauch, and the actual session part, which is allocated and initialized during open and freed/uninitialized during closing of the interface. This make it safe to close and open interface several times.

1 Attachments

Discussion

  • Zdenek Styblik

    Zdenek Styblik - 2014-05-20

    Ticket moved from /p/ipmitool/patches/95/

     
  • Zdenek Styblik

    Zdenek Styblik - 2014-05-20
    • Group: version-cvs --> version-1.8.15
     
  • Dmitry Bazhenov

    Dmitry Bazhenov - 2014-06-18

    Hello, Zdenek,

    Do you want me to rebase the patch against the latest trunk?

    Regards,
    Dmitry

     
  • Dmitry Bazhenov

    Dmitry Bazhenov - 2014-11-11

    Rebased against the top of branch.

     
    • Zdenek Styblik

      Zdenek Styblik - 2015-01-17

      I got bunch of .rej :\

       
    • Zdenek Styblik

      Zdenek Styblik - 2015-01-17

      I wish this patch wasn't so big :(

       
  • Dmitry Bazhenov

    Dmitry Bazhenov - 2015-02-05

    Rebased against the top of trunk. Removed irrelevant changes (will post them as separate bug-fixes).

     
    • Zdenek Styblik

      Zdenek Styblik - 2015-02-06

      Patch introduces three new issues pointed out by Coverity(attached). Also:

      /* ??? What's the point of having this around if it's commented out? */
      +   //session->v2_data.console_id       = 0x00;
      +   //session->v2_data.bmc_id           = 0x00;
      +   //memset(session->v2_data.sik, 0, IPMI_SIK_BUFFER_SIZE);
      

      And don't put #define in the middle of struct declaration.

       
  • Dmitry Bazhenov

    Dmitry Bazhenov - 2015-02-06

    Addressed review comments.

     

    Last edit: Dmitry Bazhenov 2015-02-06
    • Zdenek Styblik

      Zdenek Styblik - 2015-02-17

      lan.c ~ 2071 - use of uninitialized addr as a source in memcpy() is still there. Can I do the following to fix it?

      memset(&add, 0, sizeof(addr));
      
       
  • Dmitry Bazhenov

    Dmitry Bazhenov - 2015-02-18

    Hello, Zdenek,

    While this ->addr field is mostly useless, it is not correctly initialized. Thanks for noticing.
    The best way to resolve the issue is to replace the memcpy with the following code:
    - memcpy(&s->addr, &addr, sizeof (s->addr));
    + s->addrlen = sizeof(s->addr);
    + getsocketname(intf->fd, &s->addr, &s->addrlen);

    This will fill the addr and addrlen fields with the actual socket name disregarding whether it IPv4 or IPv6.

    Regards,
    Dmitry

     
  • Zdenek Styblik

    Zdenek Styblik - 2015-03-11
    • status: open --> closed-fixed
    • assigned_to: Zdenek Styblik
    • Group: version-1.8.15 --> version-1.8.16
     
  • Zdenek Styblik

    Zdenek Styblik - 2015-03-11

    Committed into Git. Thanks.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.