Deleted Added
full compact
sctp_bsd_addr.c (163953) sctp_bsd_addr.c (163996)
1/*-
2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

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

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

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

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 163953 2006-11-03 15:23:16Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 163996 2006-11-05 13:25:18Z rrs $");
35
36#include "opt_ipsec.h"
37#include "opt_compat.h"
38#include "opt_inet6.h"
39#include "opt_inet.h"
40#include "opt_sctp.h"
41#include <sys/param.h>
42#include <sys/systm.h>

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

807 }
808 if (ifn == rt->rt_ifp)
809 /* already looked at this guy */
810 continue;
811 num_prefered = sctp_count_v4_num_prefered_boundall(ifn, stcb, non_asoc_addr_ok,
812 loopscope, ipv4_scope, &sin_loop, &sin_local);
813#ifdef SCTP_DEBUG
814 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
35
36#include "opt_ipsec.h"
37#include "opt_compat.h"
38#include "opt_inet6.h"
39#include "opt_inet.h"
40#include "opt_sctp.h"
41#include <sys/param.h>
42#include <sys/systm.h>

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

807 }
808 if (ifn == rt->rt_ifp)
809 /* already looked at this guy */
810 continue;
811 num_prefered = sctp_count_v4_num_prefered_boundall(ifn, stcb, non_asoc_addr_ok,
812 loopscope, ipv4_scope, &sin_loop, &sin_local);
813#ifdef SCTP_DEBUG
814 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
815 printf("Found ifn:%x %d prefered source addresses\n", (uint32_t) ifn, num_prefered);
815 printf("Found ifn:%p %d prefered source addresses\n", ifn, num_prefered);
816 }
817#endif
818 if (num_prefered == 0) {
819 /*
820 * None on this interface.
821 */
822 continue;
823 }

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

1516 }
1517#endif
1518 sin6 = sctp_select_v6_nth_addr_from_ifn_boundall(ifn, stcb, non_asoc_addr_ok, loopscope,
1519 loc_scope, cur_addr_num, 0);
1520 }
1521 if (sin6) {
1522#ifdef SCTP_DEBUG
1523 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
816 }
817#endif
818 if (num_prefered == 0) {
819 /*
820 * None on this interface.
821 */
822 continue;
823 }

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

1516 }
1517#endif
1518 sin6 = sctp_select_v6_nth_addr_from_ifn_boundall(ifn, stcb, non_asoc_addr_ok, loopscope,
1519 loc_scope, cur_addr_num, 0);
1520 }
1521 if (sin6) {
1522#ifdef SCTP_DEBUG
1523 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1524 printf("Selected address %d ifn:%x for the route\n", cur_addr_num, (uint32_t) ifn);
1524 printf("Selected address %d ifn:%p for the route\n", cur_addr_num, ifn);
1525 }
1526#endif
1527 if (net) {
1528 /* store so we get the next one */
1529 if (cur_addr_num < 255)
1530 net->indx_of_eligible_next_to_use = cur_addr_num + 1;
1531 else
1532 net->indx_of_eligible_next_to_use = 0;

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

1542 * look at all the other interfaces EXCEPT rt->rt_ifp and do the
1543 * same game.
1544 */
1545 if (inp->next_ifn_touse == NULL) {
1546 started_at_beginning = 1;
1547 inp->next_ifn_touse = TAILQ_FIRST(&ifnet);
1548#ifdef SCTP_DEBUG
1549 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1525 }
1526#endif
1527 if (net) {
1528 /* store so we get the next one */
1529 if (cur_addr_num < 255)
1530 net->indx_of_eligible_next_to_use = cur_addr_num + 1;
1531 else
1532 net->indx_of_eligible_next_to_use = 0;

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

1542 * look at all the other interfaces EXCEPT rt->rt_ifp and do the
1543 * same game.
1544 */
1545 if (inp->next_ifn_touse == NULL) {
1546 started_at_beginning = 1;
1547 inp->next_ifn_touse = TAILQ_FIRST(&ifnet);
1548#ifdef SCTP_DEBUG
1549 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1550 printf("Start at first IFN:%x\n", (uint32_t) inp->next_ifn_touse);
1550 printf("Start at first IFN:%p\n", inp->next_ifn_touse);
1551 }
1552#endif
1553 } else {
1554 inp->next_ifn_touse = TAILQ_NEXT(inp->next_ifn_touse, if_list);
1555#ifdef SCTP_DEBUG
1556 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1551 }
1552#endif
1553 } else {
1554 inp->next_ifn_touse = TAILQ_NEXT(inp->next_ifn_touse, if_list);
1555#ifdef SCTP_DEBUG
1556 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1557 printf("Resume at IFN:%x\n", (uint32_t) inp->next_ifn_touse);
1557 printf("Resume at IFN:%p\n", inp->next_ifn_touse);
1558 }
1559#endif
1560 if (inp->next_ifn_touse == NULL) {
1561#ifdef SCTP_DEBUG
1562 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1563 printf("IFN Resets\n");
1564 }
1565#endif

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

1593 * Address rotation will only work when we are not rotating
1594 * sourced interfaces and are using the interface of the
1595 * route. We would need to have a per interface index in
1596 * order to do proper rotation.
1597 */
1598 num_eligible_addr = sctp_count_v6_num_eligible_boundall(ifn, stcb, non_asoc_addr_ok, loopscope, loc_scope);
1599#ifdef SCTP_DEBUG
1600 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1558 }
1559#endif
1560 if (inp->next_ifn_touse == NULL) {
1561#ifdef SCTP_DEBUG
1562 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1563 printf("IFN Resets\n");
1564 }
1565#endif

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

1593 * Address rotation will only work when we are not rotating
1594 * sourced interfaces and are using the interface of the
1595 * route. We would need to have a per interface index in
1596 * order to do proper rotation.
1597 */
1598 num_eligible_addr = sctp_count_v6_num_eligible_boundall(ifn, stcb, non_asoc_addr_ok, loopscope, loc_scope);
1599#ifdef SCTP_DEBUG
1600 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1601 printf("IFN:%x has %d eligible\n", (uint32_t) ifn, num_eligible_addr);
1601 printf("IFN:%p has %d eligible\n", ifn, num_eligible_addr);
1602 }
1603#endif
1604 if (num_eligible_addr == 0) {
1605 /* none we can use */
1606 continue;
1607 }
1608 /*
1609 * Ok we have num_eligible_addr set with how many we can

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

1624 */
1625 sin6 = sctp_select_v6_nth_addr_from_ifn_boundall(ifn, stcb, non_asoc_addr_ok, loopscope, loc_scope, 0, 0);
1626 if (sin6 == NULL)
1627 /* Hmm, can't find one in the interface now */
1628 continue;
1629 }
1630#ifdef SCTP_DEBUG
1631 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1602 }
1603#endif
1604 if (num_eligible_addr == 0) {
1605 /* none we can use */
1606 continue;
1607 }
1608 /*
1609 * Ok we have num_eligible_addr set with how many we can

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

1624 */
1625 sin6 = sctp_select_v6_nth_addr_from_ifn_boundall(ifn, stcb, non_asoc_addr_ok, loopscope, loc_scope, 0, 0);
1626 if (sin6 == NULL)
1627 /* Hmm, can't find one in the interface now */
1628 continue;
1629 }
1630#ifdef SCTP_DEBUG
1631 if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
1632 printf("Selected the %d'th address of ifn:%x\n",
1632 printf("Selected the %d'th address of ifn:%p\n",
1633 cur_addr_num,
1633 cur_addr_num,
1634 (uint32_t) ifn);
1634 ifn);
1635 }
1636#endif
1637 return (sin6);
1638 }
1639 if (started_at_beginning == 0) {
1640 /*
1641 * we have not been through all of them yet, force us to go
1642 * through them all.

--- 390 unchanged lines hidden ---
1635 }
1636#endif
1637 return (sin6);
1638 }
1639 if (started_at_beginning == 0) {
1640 /*
1641 * we have not been through all of them yet, force us to go
1642 * through them all.

--- 390 unchanged lines hidden ---