dup code in in6.c
Julian Elischer
julian at elischer.org
Fri Nov 30 17:28:48 PST 2007
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,
More information about the freebsd-net
mailing list