@@ -446,6 +446,13 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
446
446
err_code= vio_getnameinfo (ip, hostname_buffer, NI_MAXHOST, NULL , 0 ,
447
447
NI_NAMEREQD);
448
448
449
+ /*
450
+ ===========================================================================
451
+ DEBUG code only (begin)
452
+ Simulate various output from vio_getnameinfo().
453
+ ===========================================================================
454
+ */
455
+
449
456
DBUG_EXECUTE_IF (" getnameinfo_error_noname" ,
450
457
{
451
458
strcpy (hostname_buffer, " <garbage>" );
@@ -488,6 +495,12 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
488
495
}
489
496
);
490
497
498
+ /*
499
+ ===========================================================================
500
+ DEBUG code only (end)
501
+ ===========================================================================
502
+ */
503
+
491
504
if (err_code)
492
505
{
493
506
// NOTE: gai_strerror() returns a string ending by a dot.
@@ -588,7 +601,8 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
588
601
589
602
/*
590
603
===========================================================================
591
- DBUG CODE (begin)
604
+ DEBUG code only (begin)
605
+ Simulate various output from getaddrinfo().
592
606
===========================================================================
593
607
*/
594
608
DBUG_EXECUTE_IF (" getaddrinfo_error_noname" ,
@@ -702,19 +716,43 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
702
716
debug_addr->sin6_family = AF_INET6;
703
717
ip6= & debug_addr->sin6_addr ;
704
718
/* inet_pton not available on Windows XP. */
705
- ip6->s6_addr32 [0 ] = htonl (0x20010db8 );
706
- ip6->s6_addr32 [1 ] = htonl (0x00000000 );
707
- ip6->s6_addr32 [2 ] = htonl (0x00000000 );
708
- ip6->s6_addr32 [3 ] = htonl (0x0006007e );
719
+ ip6->s6_addr [ 0 ] = 0x20 ;
720
+ ip6->s6_addr [ 1 ] = 0x01 ;
721
+ ip6->s6_addr [ 2 ] = 0x0d ;
722
+ ip6->s6_addr [ 3 ] = 0xb8 ;
723
+ ip6->s6_addr [ 4 ] = 0x00 ;
724
+ ip6->s6_addr [ 5 ] = 0x00 ;
725
+ ip6->s6_addr [ 6 ] = 0x00 ;
726
+ ip6->s6_addr [ 7 ] = 0x00 ;
727
+ ip6->s6_addr [ 8 ] = 0x00 ;
728
+ ip6->s6_addr [ 9 ] = 0x00 ;
729
+ ip6->s6_addr [10 ] = 0x00 ;
730
+ ip6->s6_addr [11 ] = 0x00 ;
731
+ ip6->s6_addr [12 ] = 0x00 ;
732
+ ip6->s6_addr [13 ] = 0x06 ;
733
+ ip6->s6_addr [14 ] = 0x00 ;
734
+ ip6->s6_addr [15 ] = 0x7e ;
709
735
710
736
/* Simulating ipv6 2001:DB8::6:7F */
711
737
debug_addr= & debug_sock_addr[1 ];
712
738
debug_addr->sin6_family = AF_INET6;
713
739
ip6= & debug_addr->sin6_addr ;
714
- ip6->s6_addr32 [0 ] = htonl (0x20010db8 );
715
- ip6->s6_addr32 [1 ] = htonl (0x00000000 );
716
- ip6->s6_addr32 [2 ] = htonl (0x00000000 );
717
- ip6->s6_addr32 [3 ] = htonl (0x0006007f );
740
+ ip6->s6_addr [ 0 ] = 0x20 ;
741
+ ip6->s6_addr [ 1 ] = 0x01 ;
742
+ ip6->s6_addr [ 2 ] = 0x0d ;
743
+ ip6->s6_addr [ 3 ] = 0xb8 ;
744
+ ip6->s6_addr [ 4 ] = 0x00 ;
745
+ ip6->s6_addr [ 5 ] = 0x00 ;
746
+ ip6->s6_addr [ 6 ] = 0x00 ;
747
+ ip6->s6_addr [ 7 ] = 0x00 ;
748
+ ip6->s6_addr [ 8 ] = 0x00 ;
749
+ ip6->s6_addr [ 9 ] = 0x00 ;
750
+ ip6->s6_addr [10 ] = 0x00 ;
751
+ ip6->s6_addr [11 ] = 0x00 ;
752
+ ip6->s6_addr [12 ] = 0x00 ;
753
+ ip6->s6_addr [13 ] = 0x06 ;
754
+ ip6->s6_addr [14 ] = 0x00 ;
755
+ ip6->s6_addr [15 ] = 0x7f ;
718
756
719
757
debug_addr_info[0 ].ai_addr = (struct sockaddr *) & debug_sock_addr[0 ];
720
758
debug_addr_info[0 ].ai_addrlen = sizeof (struct sockaddr_in6 );
@@ -748,19 +786,43 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
748
786
debug_addr= & debug_sock_addr[0 ];
749
787
debug_addr->sin6_family = AF_INET6;
750
788
ip6= & debug_addr->sin6_addr ;
751
- ip6->s6_addr32 [0 ] = htonl (0x20010db8 );
752
- ip6->s6_addr32 [1 ] = htonl (0x00000000 );
753
- ip6->s6_addr32 [2 ] = htonl (0x00000000 );
754
- ip6->s6_addr32 [3 ] = htonl (0x00060007 );
789
+ ip6->s6_addr [ 0 ] = 0x20 ;
790
+ ip6->s6_addr [ 1 ] = 0x01 ;
791
+ ip6->s6_addr [ 2 ] = 0x0d ;
792
+ ip6->s6_addr [ 3 ] = 0xb8 ;
793
+ ip6->s6_addr [ 4 ] = 0x00 ;
794
+ ip6->s6_addr [ 5 ] = 0x00 ;
795
+ ip6->s6_addr [ 6 ] = 0x00 ;
796
+ ip6->s6_addr [ 7 ] = 0x00 ;
797
+ ip6->s6_addr [ 8 ] = 0x00 ;
798
+ ip6->s6_addr [ 9 ] = 0x00 ;
799
+ ip6->s6_addr [10 ] = 0x00 ;
800
+ ip6->s6_addr [11 ] = 0x00 ;
801
+ ip6->s6_addr [12 ] = 0x00 ;
802
+ ip6->s6_addr [13 ] = 0x06 ;
803
+ ip6->s6_addr [14 ] = 0x00 ;
804
+ ip6->s6_addr [15 ] = 0x07 ;
755
805
756
806
/* Simulating ipv6 2001:DB8::6:6 */
757
807
debug_addr= & debug_sock_addr[1 ];
758
808
debug_addr->sin6_family = AF_INET6;
759
809
ip6= & debug_addr->sin6_addr ;
760
- ip6->s6_addr32 [0 ] = htonl (0x20010db8 );
761
- ip6->s6_addr32 [1 ] = htonl (0x00000000 );
762
- ip6->s6_addr32 [2 ] = htonl (0x00000000 );
763
- ip6->s6_addr32 [3 ] = htonl (0x00060006 );
810
+ ip6->s6_addr [ 0 ] = 0x20 ;
811
+ ip6->s6_addr [ 1 ] = 0x01 ;
812
+ ip6->s6_addr [ 2 ] = 0x0d ;
813
+ ip6->s6_addr [ 3 ] = 0xb8 ;
814
+ ip6->s6_addr [ 4 ] = 0x00 ;
815
+ ip6->s6_addr [ 5 ] = 0x00 ;
816
+ ip6->s6_addr [ 6 ] = 0x00 ;
817
+ ip6->s6_addr [ 7 ] = 0x00 ;
818
+ ip6->s6_addr [ 8 ] = 0x00 ;
819
+ ip6->s6_addr [ 9 ] = 0x00 ;
820
+ ip6->s6_addr [10 ] = 0x00 ;
821
+ ip6->s6_addr [11 ] = 0x00 ;
822
+ ip6->s6_addr [12 ] = 0x00 ;
823
+ ip6->s6_addr [13 ] = 0x06 ;
824
+ ip6->s6_addr [14 ] = 0x00 ;
825
+ ip6->s6_addr [15 ] = 0x06 ;
764
826
765
827
debug_addr_info[0 ].ai_addr = (struct sockaddr *) & debug_sock_addr[0 ];
766
828
debug_addr_info[0 ].ai_addrlen = sizeof (struct sockaddr_in6 );
@@ -779,7 +841,7 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
779
841
780
842
/*
781
843
===========================================================================
782
- DBUG CODE (end)
844
+ DEBUG code only (end)
783
845
===========================================================================
784
846
*/
785
847
0 commit comments