aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/protocol.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-03-18 03:37:55 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-18 03:37:55 -0400
commit577f99c1d08cf9cbdafd4e858dd13ff04d855090 (patch)
tree0f726bbda9b18d311d4c95198bbd96cb7ac01db0 /net/sctp/protocol.c
parent26c0f03f6b77c513cb7bc37b73a06819bdbb791b (diff)
parent2f633928cbba8a5858bb39b11e7219a41b0fbef5 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/rt2x00/rt2x00dev.c net/8021q/vlan_dev.c
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r--net/sctp/protocol.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 87512f14cf71..25be8f04de6e 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -337,14 +337,14 @@ static int sctp_v4_cmp_addr(const union sctp_addr *addr1,
337static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port) 337static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port)
338{ 338{
339 addr->v4.sin_family = AF_INET; 339 addr->v4.sin_family = AF_INET;
340 addr->v4.sin_addr.s_addr = INADDR_ANY; 340 addr->v4.sin_addr.s_addr = htonl(INADDR_ANY);
341 addr->v4.sin_port = port; 341 addr->v4.sin_port = port;
342} 342}
343 343
344/* Is this a wildcard address? */ 344/* Is this a wildcard address? */
345static int sctp_v4_is_any(const union sctp_addr *addr) 345static int sctp_v4_is_any(const union sctp_addr *addr)
346{ 346{
347 return INADDR_ANY == addr->v4.sin_addr.s_addr; 347 return htonl(INADDR_ANY) == addr->v4.sin_addr.s_addr;
348} 348}
349 349
350/* This function checks if the address is a valid address to be used for 350/* This function checks if the address is a valid address to be used for
@@ -375,7 +375,7 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
375 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr); 375 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr);
376 376
377 377
378 if (addr->v4.sin_addr.s_addr != INADDR_ANY && 378 if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) &&
379 ret != RTN_LOCAL && 379 ret != RTN_LOCAL &&
380 !sp->inet.freebind && 380 !sp->inet.freebind &&
381 !sysctl_ip_nonlocal_bind) 381 !sysctl_ip_nonlocal_bind)
@@ -628,6 +628,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
628 struct in_ifaddr *ifa = (struct in_ifaddr *)ptr; 628 struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
629 struct sctp_sockaddr_entry *addr = NULL; 629 struct sctp_sockaddr_entry *addr = NULL;
630 struct sctp_sockaddr_entry *temp; 630 struct sctp_sockaddr_entry *temp;
631 int found = 0;
631 632
632 if (ifa->ifa_dev->dev->nd_net != &init_net) 633 if (ifa->ifa_dev->dev->nd_net != &init_net)
633 return NOTIFY_DONE; 634 return NOTIFY_DONE;
@@ -650,13 +651,14 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
650 list_for_each_entry_safe(addr, temp, 651 list_for_each_entry_safe(addr, temp,
651 &sctp_local_addr_list, list) { 652 &sctp_local_addr_list, list) {
652 if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) { 653 if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) {
654 found = 1;
653 addr->valid = 0; 655 addr->valid = 0;
654 list_del_rcu(&addr->list); 656 list_del_rcu(&addr->list);
655 break; 657 break;
656 } 658 }
657 } 659 }
658 spin_unlock_bh(&sctp_local_addr_lock); 660 spin_unlock_bh(&sctp_local_addr_lock);
659 if (addr && !addr->valid) 661 if (found)
660 call_rcu(&addr->rcu, sctp_local_addr_free); 662 call_rcu(&addr->rcu, sctp_local_addr_free);
661 break; 663 break;
662 } 664 }
@@ -786,8 +788,8 @@ static int sctp_inet_cmp_addr(const union sctp_addr *addr1,
786 /* PF_INET only supports AF_INET addresses. */ 788 /* PF_INET only supports AF_INET addresses. */
787 if (addr1->sa.sa_family != addr2->sa.sa_family) 789 if (addr1->sa.sa_family != addr2->sa.sa_family)
788 return 0; 790 return 0;
789 if (INADDR_ANY == addr1->v4.sin_addr.s_addr || 791 if (htonl(INADDR_ANY) == addr1->v4.sin_addr.s_addr ||
790 INADDR_ANY == addr2->v4.sin_addr.s_addr) 792 htonl(INADDR_ANY) == addr2->v4.sin_addr.s_addr)
791 return 1; 793 return 1;
792 if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr) 794 if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr)
793 return 1; 795 return 1;