9 Replies
      Latest reply on May 15, 2019 1:03 AM by eskimo
      uagrawal Level 1 Level 1 (0 points)

        Hi,

         

        I know that in iOS device we have a mixture of ip address which contains ipv4 and ipv6 addresses. Now the ipv6 addresses can be of type permanent(based on device mac address) and temporary(used for outgoing connection).

         

        Is there a way we can differentiate between the two and actually find out which one is permanent and which one is temporary ipv6 address?

        • Re: How to retrieve the permanent and temporary ipv6 address of iOS device??
          eskimo Apple Staff Apple Staff (11,265 points)

          I don’t know of any way to determine whether an address is temporary on iOS [1].  Why does it matter to you?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          [1] On macOS you can see the state of the address using the ifconfig tool.  You can rummage through the ifconfig source code to see how that works, but it’s based on a mechanism (IN6_IFF_TEMPORARY) that’s only public API on macOS.

            • Re: How to retrieve the permanent and temporary ipv6 address of iOS device??
              uagrawal Level 1 Level 1 (0 points)

              I have a VOIP application, now in case of ipv6 only networks i.e T-Mobile , we need to be able to establish a socket connection with our device ipv6 ip, but we don't know if we are binding with the permanent one or the temporary one, we just get the list of addresses and bind with the 1st one now if at all that turns out to be permanent one that could turn out to be a security violation since permanent ip is made up of devices MAC address and we are exposing this permanent ip to the outside world which is not what we want, only the temporary addresses should be used for outgoing connections.

               

              So this was the reason i needed a point of differentiation b/w the 2 i.e permanent and temporary ipv6 addresses.

                • Re: How to retrieve the permanent and temporary ipv6 address of iOS device??
                  eskimo Apple Staff Apple Staff (11,265 points)

                  That’s a very interesting edge case.  In practice I don’t think this will make a difference because the permanent address does not contain the MAC address but a hash of the MAC address.  However, it’s still a valid concern.

                  we need to be able to establish a socket connection with our device ipv6 ip

                  What sort of connection are we talking about here?  Presumably this is UDP?  Is it an outgoing ‘connection’ or an ‘incoming’ one?

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                    • Re: How to retrieve the permanent and temporary ipv6 address of iOS device??
                      uagrawal Level 1 Level 1 (0 points)

                      What sort of connection are we talking about here?  Presumably this is UDP?  Is it an outgoing ‘connection’ or an ‘incoming’ one?

                      This is a TCP connection we are talking about and that too an outgoing one.

                        • Re: How to retrieve the permanent and temporary ipv6 address of iOS device??
                          eskimo Apple Staff Apple Staff (11,265 points)

                          This is a TCP connection we are talking about and that too an outgoing one.

                          You don’t need to worry about this for an outgoing TCP connection.  The system will choose a source address that’s appropriate automatically.

                          Share and Enjoy

                          Quinn “The Eskimo!”
                          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                          let myEmail = "eskimo" + "1" + "@apple.com"

                            • Re: How to retrieve the permanent and temporary ipv6 address of iOS device??
                              uagrawal Level 1 Level 1 (0 points)
                              You don’t need to worry about this for an outgoing TCP connection.  The system will choose a source address that’s appropriate automatically.

                               

                              On device, we have both Cellular data as well as wifi ON. And our application forces the traffic to go over cellular network instead of wifi.

                              To do that we are explicitly binding to an IPv6 address on a cellular network interface. In order to bind to the specific IPv6 address, wanted to understand if we are binding to right V6 address.

                                • Re: How to retrieve the permanent and temporary ipv6 address of iOS device??
                                  eskimo Apple Staff Apple Staff (11,265 points)

                                  And our application forces the traffic to go over cellular network …

                                  The best way to do this is using the Network framework.  It gives you explicit control over the interface uses by your connection.

                                  If you have to stick with BSD Sockets for some reason — say, you have a large existing source base that depends on it — you should check out the IP_BOUND_IF / IPV6_BOUND_IF socket options.  These let you force a connection to run over a specific interface.  I’ve never actually used it with TCP — most of the time folks ask this question in the context of UDP — but it should work.

                                  Share and Enjoy

                                  Quinn “The Eskimo!”
                                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                                  let myEmail = "eskimo" + "1" + "@apple.com"