Deleted Added
full compact
ip6_output.c (79426) ip6_output.c (83130)
1/* $FreeBSD: head/sys/netinet6/ip6_output.c 79426 2001-07-08 18:06:03Z ume $ */
1/* $FreeBSD: head/sys/netinet6/ip6_output.c 83130 2001-09-06 02:40:43Z jlemon $ */
2/* $KAME: ip6_output.c,v 1.180 2001/05/21 05:37:50 jinmei Exp $ */
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 598 unchanged lines hidden (view full) ---

608 ip6->ip6_hlim = ip6_defmcasthlim;
609
610 /*
611 * See if the caller provided the outgoing interface
612 * as an ancillary data.
613 * Boundary check for ifindex is assumed to be already done.
614 */
615 if (opt && opt->ip6po_pktinfo && opt->ip6po_pktinfo->ipi6_ifindex)
2/* $KAME: ip6_output.c,v 1.180 2001/05/21 05:37:50 jinmei Exp $ */
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 598 unchanged lines hidden (view full) ---

608 ip6->ip6_hlim = ip6_defmcasthlim;
609
610 /*
611 * See if the caller provided the outgoing interface
612 * as an ancillary data.
613 * Boundary check for ifindex is assumed to be already done.
614 */
615 if (opt && opt->ip6po_pktinfo && opt->ip6po_pktinfo->ipi6_ifindex)
616 ifp = ifindex2ifnet[opt->ip6po_pktinfo->ipi6_ifindex];
616 ifp = ifnet_byindex(opt->ip6po_pktinfo->ipi6_ifindex);
617
618 /*
619 * If the destination is a node-local scope multicast,
620 * the packet should be loop-backed only.
621 */
622 if (IN6_IS_ADDR_MC_NODELOCAL(&ip6->ip6_dst)) {
623 /*
624 * If the outgoing interface is already specified,

--- 165 unchanged lines hidden (view full) ---

790 * field of the structure here.
791 * We rely on the consistency between two scope zone ids
792 * of source add destination, which should already be assured
793 * larger scopes than link will be supported in the near
794 * future.
795 */
796 origifp = NULL;
797 if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src))
617
618 /*
619 * If the destination is a node-local scope multicast,
620 * the packet should be loop-backed only.
621 */
622 if (IN6_IS_ADDR_MC_NODELOCAL(&ip6->ip6_dst)) {
623 /*
624 * If the outgoing interface is already specified,

--- 165 unchanged lines hidden (view full) ---

790 * field of the structure here.
791 * We rely on the consistency between two scope zone ids
792 * of source add destination, which should already be assured
793 * larger scopes than link will be supported in the near
794 * future.
795 */
796 origifp = NULL;
797 if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src))
798 origifp = ifindex2ifnet[ntohs(ip6->ip6_src.s6_addr16[1])];
798 origifp = ifnet_byindex(ntohs(ip6->ip6_src.s6_addr16[1]));
799 else if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst))
799 else if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst))
800 origifp = ifindex2ifnet[ntohs(ip6->ip6_dst.s6_addr16[1])];
800 origifp = ifnet_byindex(ntohs(ip6->ip6_dst.s6_addr16[1]));
801 /*
802 * XXX: origifp can be NULL even in those two cases above.
803 * For example, if we remove the (only) link-local address
804 * from the loopback interface, and try to send a link-local
805 * address without link-id information. Then the source
806 * address is ::1, and the destination address is the
807 * link-local address with its s6_addr16[1] being zero.
808 * What is worse, if the packet goes to the loopback interface

--- 1115 unchanged lines hidden (view full) ---

1924 error = EINVAL;
1925 break;
1926 }
1927 bcopy(mtod(m, u_int *), &ifindex, sizeof(ifindex));
1928 if (ifindex < 0 || if_index < ifindex) {
1929 error = ENXIO; /* XXX EINVAL? */
1930 break;
1931 }
801 /*
802 * XXX: origifp can be NULL even in those two cases above.
803 * For example, if we remove the (only) link-local address
804 * from the loopback interface, and try to send a link-local
805 * address without link-id information. Then the source
806 * address is ::1, and the destination address is the
807 * link-local address with its s6_addr16[1] being zero.
808 * What is worse, if the packet goes to the loopback interface

--- 1115 unchanged lines hidden (view full) ---

1924 error = EINVAL;
1925 break;
1926 }
1927 bcopy(mtod(m, u_int *), &ifindex, sizeof(ifindex));
1928 if (ifindex < 0 || if_index < ifindex) {
1929 error = ENXIO; /* XXX EINVAL? */
1930 break;
1931 }
1932 ifp = ifindex2ifnet[ifindex];
1932 ifp = ifnet_byindex(ifindex);
1933 if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) {
1934 error = EADDRNOTAVAIL;
1935 break;
1936 }
1937 im6o->im6o_multicast_ifp = ifp;
1938 break;
1939
1940 case IPV6_MULTICAST_HOPS:

--- 92 unchanged lines hidden (view full) ---

2033 if (ro.ro_rt == NULL) {
2034 error = EADDRNOTAVAIL;
2035 break;
2036 }
2037 ifp = ro.ro_rt->rt_ifp;
2038 rtfree(ro.ro_rt);
2039 }
2040 } else
1933 if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) {
1934 error = EADDRNOTAVAIL;
1935 break;
1936 }
1937 im6o->im6o_multicast_ifp = ifp;
1938 break;
1939
1940 case IPV6_MULTICAST_HOPS:

--- 92 unchanged lines hidden (view full) ---

2033 if (ro.ro_rt == NULL) {
2034 error = EADDRNOTAVAIL;
2035 break;
2036 }
2037 ifp = ro.ro_rt->rt_ifp;
2038 rtfree(ro.ro_rt);
2039 }
2040 } else
2041 ifp = ifindex2ifnet[mreq->ipv6mr_interface];
2041 ifp = ifnet_byindex(mreq->ipv6mr_interface);
2042
2043 /*
2044 * See if we found an interface, and confirm that it
2045 * supports multicast
2046 */
2047 if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) {
2048 error = EADDRNOTAVAIL;
2049 break;

--- 59 unchanged lines hidden (view full) ---

2109 * If an interface address was specified, get a pointer
2110 * to its ifnet structure.
2111 */
2112 if (mreq->ipv6mr_interface < 0
2113 || if_index < mreq->ipv6mr_interface) {
2114 error = ENXIO; /* XXX EINVAL? */
2115 break;
2116 }
2042
2043 /*
2044 * See if we found an interface, and confirm that it
2045 * supports multicast
2046 */
2047 if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) {
2048 error = EADDRNOTAVAIL;
2049 break;

--- 59 unchanged lines hidden (view full) ---

2109 * If an interface address was specified, get a pointer
2110 * to its ifnet structure.
2111 */
2112 if (mreq->ipv6mr_interface < 0
2113 || if_index < mreq->ipv6mr_interface) {
2114 error = ENXIO; /* XXX EINVAL? */
2115 break;
2116 }
2117 ifp = ifindex2ifnet[mreq->ipv6mr_interface];
2117 ifp = ifnet_byindex(mreq->ipv6mr_interface);
2118 /*
2119 * Put interface index into the multicast address,
2120 * if the address has link-local scope.
2121 */
2122 if (IN6_IS_ADDR_MC_LINKLOCAL(&mreq->ipv6mr_multiaddr)) {
2123 mreq->ipv6mr_multiaddr.s6_addr16[1]
2124 = htons(mreq->ipv6mr_interface);
2125 }

--- 435 unchanged lines hidden ---
2118 /*
2119 * Put interface index into the multicast address,
2120 * if the address has link-local scope.
2121 */
2122 if (IN6_IS_ADDR_MC_LINKLOCAL(&mreq->ipv6mr_multiaddr)) {
2123 mreq->ipv6mr_multiaddr.s6_addr16[1]
2124 = htons(mreq->ipv6mr_interface);
2125 }

--- 435 unchanged lines hidden ---