Linux IPv6 bind failure with Invalid Argument.

Linux IPv6 bind failure with Invalid Argument.

Post by Ari » Sun, 21 Apr 2002 03:37:18



Hello,
   Would you pls help me out in this regard. I am getting Bind failure
with error inValid argument Linux IPv6 machine(Kernel 2.4.7)
   Same code works in Solaris IPv6.
   Where is is bug?????
   Pls let me know if you need more info on this.

   Thanks in advance for your support.
   Arif

   /*-------------- code segment ------------------*/

   struct sockaddr_in6 addr6;      
   int size, sd;

   sd = socket(AF_INET6, SOCK_DGRAM, 0);

   if(sd == -1)
   {
      perror("socket()"); exit(1);
   }

   if(setsockopt(sd, SOL_SOCKET, SO_BSDCOMPAT, &enable,
sizeof(enable)) == -1)
   {
      perror("setsockopt()");
      exit(1);
   }

   if(setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &enable,
sizeof(enable)) == -1)
   {
      perror("setsockopt()");
      exit(1);
   }

   memset(&addr6, 0, sizeof(addr6));
   size = sizeof(struct sockaddr_in6);
   addr6.sin6_family = AF_INET6;
   addr6.sin6_port = htons(0);

   /* use this to bind to real address */
   if(inet_pton(AF_INET6, "FE80::250:DAFF:FECD:2DE2",
&addr6.sin6_addr)==0)
      perror("inet_pton call failed inside cmInetBind");

   /* when binding to loopback interface. THIS PORTION WORKS!!!! */
   /* memcpy(&addr6.sin6_addr, &in6addr_loopback,
sizeof(in6addr_loopback)); */

   if(bind(sd, (struct sockaddr *)&addr6, size) == -1)
   {
      perror("bind()"); exit(1);
   }

   ------------log of the Interface on linux IPv6 machine------------

eth0      Link encap:Ethernet  HWaddr 00:50:DA:CD:2D:E2  
          inet addr:10.242.101.18  Bcast:10.242.101.255
Mask:255.255.255.0
          inet6 addr: fe80::250:daff:fecd:2de2/10 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3109744 errors:0 dropped:0 overruns:136 frame:0
          TX packets:2470093 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0
          RX bytes:650222683 (620.1 Mb)  TX bytes:541913530 (516.8 Mb)

 
 
 

1. Linux IPv6 bind failure with Invalid Argument.

Hello,
   Would you pls help me out in this regard. I am getting Bind failure
with error inValid argument Linux IPv6 machine(Kernel 2.4.7)
   Same code works in Solaris IPv6.
   Where is is bug?????
   Pls let me know if you need more info on this.

   Thanks in advance for your support.
   Arif

   /*-------------- code segment ------------------*/

   struct sockaddr_in6 addr6;      
   int size, sd;

   sd = socket(AF_INET6, SOCK_DGRAM, 0);

   if(sd == -1)
   {
      perror("socket()"); exit(1);
   }

   if(setsockopt(sd, SOL_SOCKET, SO_BSDCOMPAT, &enable,
sizeof(enable)) == -1)
   {
      perror("setsockopt()");
      exit(1);
   }

   if(setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &enable,
sizeof(enable)) == -1)
   {
      perror("setsockopt()");
      exit(1);
   }

   memset(&addr6, 0, sizeof(addr6));
   size = sizeof(struct sockaddr_in6);
   addr6.sin6_family = AF_INET6;
   addr6.sin6_port = htons(0);

   /* use this to bind to real address */
   if(inet_pton(AF_INET6, "FE80::250:DAFF:FECD:2DE2",
&addr6.sin6_addr)==0)
      perror("inet_pton call failed inside cmInetBind");

   /* when binding to loopback interface. THIS PORTION WORKS!!!! */
   /* memcpy(&addr6.sin6_addr, &in6addr_loopback,
sizeof(in6addr_loopback)); */

   if(bind(sd, (struct sockaddr *)&addr6, size) == -1)
   {
      perror("bind()"); exit(1);
   }

   ------------log of the Interface on linux IPv6 machine------------

eth0      Link encap:Ethernet  HWaddr 00:50:DA:CD:2D:E2  
          inet addr:10.242.101.18  Bcast:10.242.101.255
Mask:255.255.255.0
          inet6 addr: fe80::250:daff:fecd:2de2/10 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3109744 errors:0 dropped:0 overruns:136 frame:0
          TX packets:2470093 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0
          RX bytes:650222683 (620.1 Mb)  TX bytes:541913530 (516.8 Mb)

2. Linuxppc: where is X configuration file?

3. IPv6: link-local address fails with invalid argument [kernel 2.4.3]

4. Printtool apparently not updating

5. TCP/IP sockets: runtime bind() error: invalid argument

6. fast emulated chroot - readlink?

7. CD-ROM mount failure: invalid argument

8. PPP question

9. Linux 2.1.30: SO_SNDBUF: Invalid argument

10. Apache (Oracle HTTP Server) mmap: Invalid argument on Linux system

11. error: Linux Error: 22: Invalid argument

12. Linux errmsg: SIOCADDRT: Invalid arguments