Search the web
Sign In
New User? Sign Up
student-ipv6 · Student IPv6 Awareness Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
IPv6 programing help   Message List  
Reply | Forward Message #213 of 229 |
Hello! I have a problem and would like to know if any of you could
give me an answer. I am using C on a linux plataform, and I need to
compare 2 addreses to see which one is "bigger".


Using IPv4 I use the following code:

if(ntohl(max.s_addr) < ntohl(min.s_addr))
//swap both addresses


And I`m trying to do this with IPv6

if (max6.s6_addr32[0] < min6.s6_addr32[0] ||
(max6.s6_addr32[0] == min6.s6_addr32[0] &&
(max6.s6_addr32[1] < min6.s6_addr32[1] ||
(max6.s6_addr32[1] == min6.s6_addr32[1] &&
(max6.s6_addr32[2] < min6.s6_addr32[2] ||
(max6.s6_addr32[2] == min6.s6_addr32[3] &&
(max6.s6_addr32[3] < min6.s6_addr32[3])
))))))
//swap both addresses

But i think this is quite long. Do you know about some function that I
can use to make this simpler?

thanks in advance

Carlos Martinez






Thu Jul 24, 2003 7:01 pm

neocarlitos@...
Send Email Send Email

Forward
Message #213 of 229 |
Expand Messages Author Sort by Date

Hello! I have a problem and would like to know if any of you could give me an answer. I am using C on a linux plataform, and I need to compare 2 addreses to...
neocarlitos
neocarlitos@...
Send Email
Jul 25, 2003
1:28 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help