AF_INET6 sockets and IPv4 connections, etc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I'm working on a patch to support QoS setting on an IPv4 connection, but I'm being out-clevered by the kernel.

The code is doing the following:

s = socket(AF_INET6, SOCK_STREAM);
...
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = ... // ::FFFF:<IPv4>  address

and then, as the man page says:

        IPv4 connections can be handled with the v6 API by using the v4-mapped-
        on-v6 address type; thus a program only needs to support this API  type
        to  support  both  protocols.   This  is  handled  transparently by the
        address handling functions in the C library.


so how can I tell in a couple of lines of code if the connection will result in IPv4?

The patch looked like:

+#if defined(SOL_IP)&&  defined(IP_TOS)
+                      if (d->d_addr.sa.sa_family == AF_INET&&  InetQoS != 0x00)
+                              (void) setsockopt(d->d_socket, SOL_IP,
+                                                IP_TOS, (char *)&InetQoS, sizeof(InetQoS));
+#endif


but it strikes me that this will not cover the above case.

Any ideas welcome.

Thanks,

-Philip



-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux