]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/icmp6.c
xnu-6153.121.1.tar.gz
[apple/xnu.git] / bsd / netinet6 / icmp6.c
index a7376b6861c486ece41cddd955a173e3ec73fdfd..042244b8364664991f7248efdbd7c420ac8893c9 100644 (file)
@@ -3157,8 +3157,6 @@ icmp6_dgram_send(struct socket *so, int flags, struct mbuf *m,
 #pragma unused(flags, p)
        int error = 0;
        struct inpcb *inp = sotoinpcb(so);
-       struct sockaddr_in6 tmp;
-       struct sockaddr_in6 *dst = (struct sockaddr_in6 *)(void *)nam;
        struct icmp6_hdr *icmp6;
 
        if (inp == NULL
@@ -3174,28 +3172,6 @@ icmp6_dgram_send(struct socket *so, int flags, struct mbuf *m,
                return rip6_output(m, so, SIN6(nam), control, 0);
        }
 
-       /* always copy sockaddr to avoid overwrites */
-       if (so->so_state & SS_ISCONNECTED) {
-               if (nam != NULL) {
-                       error = EISCONN;
-                       goto bad;
-               }
-               /* XXX */
-               bzero(&tmp, sizeof(tmp));
-               tmp.sin6_family = AF_INET6;
-               tmp.sin6_len = sizeof(struct sockaddr_in6);
-               bcopy(&inp->in6p_faddr, &tmp.sin6_addr,
-                   sizeof(struct in6_addr));
-               dst = &tmp;
-       } else {
-               if (nam == NULL) {
-                       error = ENOTCONN;
-                       goto bad;
-               }
-               tmp = *(struct sockaddr_in6 *)(void *)nam;
-               dst = &tmp;
-       }
-
        /*
         * For an ICMPv6 packet, we should know its type and code
         */
@@ -3224,13 +3200,7 @@ icmp6_dgram_send(struct socket *so, int flags, struct mbuf *m,
                }
        }
 
-#if ENABLE_DEFAULT_SCOPE
-       if (dst->sin6_scope_id == 0) {  /* not change if specified  */
-               dst->sin6_scope_id = scope6_addr2default(&dst->sin6_addr);
-       }
-#endif
-
-       return rip6_output(m, so, dst, control, 0);
+       return rip6_output(m, so, SIN6(nam), control, 0);
 bad:
        VERIFY(error != 0);