Date: Fri, 30 Nov 2007 17:00:25 -0800 From: Julian Elischer <julian@elischer.org> To: FreeBSD Net <freebsd-net@freebsd.org> Subject: dup code in in6.c Message-ID: <4750B229.6070507@elischer.org>
next in thread | raw e-mail | index | archive | help
The following diff removes some (whart looks to me to be) duplicate code. Anyone care to comment before I commit it? (I'm trying to imagine a case where it does something useful to do this twice but not really succeeding). Index: in6.c =================================================================== RCS file: /home/ncvs/src/sys/netinet6/in6.c,v retrieving revision 1.73 diff -u -r1.73 in6.c --- in6.c 5 Jul 2007 16:29:39 -0000 1.73 +++ in6.c 1 Dec 2007 00:56:25 -0000 @@ -1113,32 +1113,6 @@ */ rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL); if (rt) { - if (memcmp(&mltaddr.sin6_addr, - &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, - MLTMASK_LEN)) { - RTFREE_LOCKED(rt); - rt = NULL; - } - } - if (!rt) { - /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ - error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, - (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING, - (struct rtentry **)0); - if (error) - goto cleanup; - } else - RTFREE_LOCKED(rt); - - /* - * XXX: do we really need this automatic routes? - * We should probably reconsider this stuff. Most applications - * actually do not need the routes, since they usually specify - * the outgoing interface. - */ - rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL); - if (rt) { /* XXX: only works in !SCOPEDROUTING case. */ if (memcmp(&mltaddr.sin6_addr, &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, @@ -1148,6 +1122,7 @@ } } if (!rt) { + /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4750B229.6070507>