Unix Technical Forum

in6_localaddr function in netinet6/in6.h

This is a discussion on in6_localaddr function in netinet6/in6.h within the mailing.openbsd.tech forums, part of the OpenBSD category; --> I noticed that in6_localaddr function is defined in netinet6/in6.h, but is not implemented anywhere. I also noticed that it ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-14-2008, 05:42 PM
Prabhu Gurumurthy
 
Posts: n/a
Default in6_localaddr function in netinet6/in6.h

I noticed that in6_localaddr function is defined in netinet6/in6.h, but is not
implemented anywhere. I also noticed that it is currently not used anywhere,
hence the build does not break, but when it is tried to use, "undefined
reference" error is produced.

Following is patch (from freebsd) for the same.

$ sudo cvs diff
cvs server: Diffing .
Index: in6.c
================================================== =================
RCS file: /cvs/src/sys/netinet6/in6.c,v
retrieving revision 1.77
diff -u -p -r1.77 in6.c
- --- in6.c 11 Jun 2008 19:00:50 -0000 1.77
+++ in6.c 8 Jul 2008 02:04:25 -0000
@@ -2602,3 +2602,20 @@ in6_domifdetach(struct ifnet *ifp, void
~ free(ext->icmp6_ifstat, M_IFADDR);
~ free(ext, M_IFADDR);
~ }
+
+int
+in6_localaddr(struct in6_addr *in6)
+{
+ struct in6_ifaddr *ia;
+
+ if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6))
+ return 1;
+
+ for (ia = in6_ifaddr; ia; ia = ia->ia_next)
+ if (IN6_ARE_MASKED_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr,
+ &ia->ia_prefixmask.sin6_addr))
+ return 1;
+
+
+ return 0;
+}

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com