Diff for /embedaddon/mtr/ui/asn.c between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2019/10/21 14:25:31 version 1.1.1.3, 2023/09/27 11:18:58
Line 11 Line 11
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.      GNU General Public License for more details.
   
    You should have received a copy of the GNU General Public License    You should have received a copy of the GNU General Public License along
    along with this program; if not, write to the Free Software    with this program; if not, write to the Free Software Foundation, Inc.,
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */  */
   
 #include "config.h"  #include "config.h"
Line 193  static char *split_txtrec( Line 193  static char *split_txtrec(
     if (i > ctl->ipinfo_max)      if (i > ctl->ipinfo_max)
         ctl->ipinfo_max = i;          ctl->ipinfo_max = i;
     if (ctl->ipinfo_no >= i) {      if (ctl->ipinfo_no >= i) {
         if (ctl->ipinfo_no >= ctl->ipinfo_max)  
             ctl->ipinfo_no = 0;  
         return (*items)[0];          return (*items)[0];
     } else      } else
         return (*items)[ctl->ipinfo_no];          return (*items)[ctl->ipinfo_no];
Line 209  static void reverse_host6( Line 207  static void reverse_host6(
 {  {
     int i;      int i;
     char *b = buff;      char *b = buff;
    for (i = (sizeof(*addr) / 2 - 1); i >= 0; i--, b += 4)      /* 64b portion */    // We need to process the top 64 bits, or 8 bytes.
     for (i = 8-1; i >= 0; i--, b += 4, buff_length -= 4)
         snprintf(b, buff_length,          snprintf(b, buff_length,
                  "%x.%x.", addr->s6_addr[i] & 0xf, addr->s6_addr[i] >> 4);                   "%x.%x.", addr->s6_addr[i] & 0xf, addr->s6_addr[i] >> 4);
    *--b = 0;
    buff[strlen(buff) - 1] = '\0'; 
 }  }
 #endif  #endif
   
Line 309  char *fmt_ipinfo( Line 307  char *fmt_ipinfo(
 int is_printii(  int is_printii(
     struct mtr_ctl *ctl)      struct mtr_ctl *ctl)
 {  {
    return ((ctl->ipinfo_no >= 0) && (ctl->ipinfo_no != ctl->ipinfo_max));    return (ctl->ipinfo_no >= 0);
 }  }
   
 void asn_open(  void asn_open(
     struct mtr_ctl *ctl)      struct mtr_ctl *ctl)
 {  {
    if (ctl->ipinfo_no >= 0) {    DEB_syslog(LOG_INFO, "hcreate(%d)", IIHASH_HI);
        DEB_syslog(LOG_INFO, "hcreate(%d)", IIHASH_HI);    if (!(iihash = hcreate(IIHASH_HI)))
        if (!(iihash = hcreate(IIHASH_HI)))        error(0, errno, "ipinfo hash");
            error(0, errno, "ipinfo hash"); 
    } 
 }  }
   
 void asn_close(  void asn_close(
     struct mtr_ctl *ctl)      struct mtr_ctl *ctl)
 {  {
    if ((ctl->ipinfo_no >= 0) && iihash) {    if (iihash) {
         DEB_syslog(LOG_INFO, "hdestroy()");          DEB_syslog(LOG_INFO, "hdestroy()");
         hdestroy();          hdestroy();
         iihash = 0;          iihash = 0;

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>