PERFORCE change 143785 for review
Gleb Kurtsou
gk at FreeBSD.org
Thu Jun 19 20:20:52 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143785
Change 143785 by gk at gk_h1 on 2008/06/19 20:20:05
IFC
Affected files ...
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_tap.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_tun.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_asconf.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_auth.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_bsd_addr.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_bsd_addr.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_cc_functions.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_header.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_indata.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_input.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_lock_bsd.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_os_bsd.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_output.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_pcb.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_pcb.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_peeloff.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_sysctl.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_sysctl.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_timer.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_uio.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_usrreq.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_var.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctputil.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_lro.c#1 branch
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_lro.h#1 branch
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_syncache.c#2 integrate
Differences ...
==== //depot/projects/soc2008/gk_l2filter/sys-net/if_tap.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
*/
/*
- * $FreeBSD: src/sys/net/if_tap.c,v 1.72 2008/04/15 16:54:39 emax Exp $
+ * $FreeBSD: src/sys/net/if_tap.c,v 1.73 2008/06/11 18:55:19 ed Exp $
* $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $
*/
@@ -132,7 +132,7 @@
static struct cdevsw tap_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_PSEUDO | D_NEEDGIANT,
+ .d_flags = D_PSEUDO | D_NEEDGIANT | D_NEEDMINOR,
.d_open = tapopen,
.d_close = tapclose,
.d_read = tapread,
==== //depot/projects/soc2008/gk_l2filter/sys-net/if_tun.c#2 (text+ko) ====
@@ -13,7 +13,7 @@
* UCL. This driver is based much more on read/write/poll mode of
* operation though.
*
- * $FreeBSD: src/sys/net/if_tun.c,v 1.164 2007/10/24 19:03:57 rwatson Exp $
+ * $FreeBSD: src/sys/net/if_tun.c,v 1.165 2008/06/11 18:55:19 ed Exp $
*/
#include "opt_atalk.h"
@@ -162,7 +162,7 @@
static struct cdevsw tun_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_PSEUDO | D_NEEDGIANT,
+ .d_flags = D_PSEUDO | D_NEEDGIANT | D_NEEDMINOR,
.d_open = tunopen,
.d_close = tunclose,
.d_read = tunread,
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp.h#2 (text+ko) ====
@@ -30,13 +30,16 @@
/* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $ */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp.h,v 1.24 2008/05/20 13:47:44 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp.h,v 1.25 2008/06/14 07:58:05 rrs Exp $");
#ifndef _NETINET_SCTP_H_
#define _NETINET_SCTP_H_
#include <sys/types.h>
+
+#define SCTP_PACKED __attribute__((packed))
+
/*
* SCTP protocol - RFC2960.
*/
@@ -46,27 +49,25 @@
uint32_t v_tag; /* verification tag of packet */
uint32_t checksum; /* Adler32 C-Sum */
/* chunks follow... */
-}
+} SCTP_PACKED;
-__attribute__((packed));
-
/*
* SCTP Chunks
*/
- struct sctp_chunkhdr {
- uint8_t chunk_type; /* chunk type */
- uint8_t chunk_flags; /* chunk flags */
- uint16_t chunk_length; /* chunk length */
- /* optional params follow */
- } __attribute__((packed));
+struct sctp_chunkhdr {
+ uint8_t chunk_type; /* chunk type */
+ uint8_t chunk_flags; /* chunk flags */
+ uint16_t chunk_length; /* chunk length */
+ /* optional params follow */
+} SCTP_PACKED;
/*
* SCTP chunk parameters
*/
- struct sctp_paramhdr {
- uint16_t param_type; /* parameter type */
- uint16_t param_length; /* parameter length */
- } __attribute__((packed));
+struct sctp_paramhdr {
+ uint16_t param_type; /* parameter type */
+ uint16_t param_length; /* parameter length */
+} SCTP_PACKED;
/*
* user socket options: socket API defined
@@ -303,49 +304,42 @@
/*
* error cause parameters (user visisble)
*/
- struct sctp_error_cause {
- uint16_t code;
- uint16_t length;
- /* optional cause-specific info may follow */
- } __attribute__((packed));
+struct sctp_error_cause {
+ uint16_t code;
+ uint16_t length;
+ /* optional cause-specific info may follow */
+} SCTP_PACKED;
- struct sctp_error_invalid_stream {
- struct sctp_error_cause cause; /* code=SCTP_ERROR_INVALID_STRE
- * AM */
- uint16_t stream_id; /* stream id of the DATA in error */
- uint16_t reserved;
- } __attribute__((packed));
+struct sctp_error_invalid_stream {
+ struct sctp_error_cause cause; /* code=SCTP_ERROR_INVALID_STREAM */
+ uint16_t stream_id; /* stream id of the DATA in error */
+ uint16_t reserved;
+} SCTP_PACKED;
- struct sctp_error_missing_param {
- struct sctp_error_cause cause; /* code=SCTP_ERROR_MISSING_PARA
- * M */
- uint32_t num_missing_params; /* number of missing
- * parameters */
- /* uint16_t param_type's follow */
- } __attribute__((packed));
+struct sctp_error_missing_param {
+ struct sctp_error_cause cause; /* code=SCTP_ERROR_MISSING_PARAM */
+ uint32_t num_missing_params; /* number of missing parameters */
+ /* uint16_t param_type's follow */
+} SCTP_PACKED;
- struct sctp_error_stale_cookie {
- struct sctp_error_cause cause; /* code=SCTP_ERROR_STALE_COOKIE
- * */
- uint32_t stale_time; /* time in usec of staleness */
- } __attribute__((packed));
+struct sctp_error_stale_cookie {
+ struct sctp_error_cause cause; /* code=SCTP_ERROR_STALE_COOKIE */
+ uint32_t stale_time; /* time in usec of staleness */
+} SCTP_PACKED;
- struct sctp_error_out_of_resource {
- struct sctp_error_cause cause; /* code=SCTP_ERROR_OUT_OF_RESOU
- * RCES */
- } __attribute__((packed));
+struct sctp_error_out_of_resource {
+ struct sctp_error_cause cause; /* code=SCTP_ERROR_OUT_OF_RESOURCES */
+} SCTP_PACKED;
- struct sctp_error_unresolv_addr {
- struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRESOLVABLE
- * _ADDR */
+struct sctp_error_unresolv_addr {
+ struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRESOLVABLE_ADDR */
- } __attribute__((packed));
+} SCTP_PACKED;
- struct sctp_error_unrecognized_chunk {
- struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRECOG_CHUN
- * K */
- struct sctp_chunkhdr ch; /* header from chunk in error */
- } __attribute__((packed));
+struct sctp_error_unrecognized_chunk {
+ struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRECOG_CHUNK */
+ struct sctp_chunkhdr ch;/* header from chunk in error */
+} SCTP_PACKED;
/*
* Main SCTP chunk types we place these here so natd and f/w's in user land
@@ -401,18 +395,18 @@
* in sat */
/* Data Chuck Specific Flags */
-#define SCTP_DATA_FRAG_MASK 0x03
-#define SCTP_DATA_MIDDLE_FRAG 0x00
-#define SCTP_DATA_LAST_FRAG 0x01
-#define SCTP_DATA_FIRST_FRAG 0x02
-#define SCTP_DATA_NOT_FRAG 0x03
-#define SCTP_DATA_UNORDERED 0x04
-
+#define SCTP_DATA_FRAG_MASK 0x03
+#define SCTP_DATA_MIDDLE_FRAG 0x00
+#define SCTP_DATA_LAST_FRAG 0x01
+#define SCTP_DATA_FIRST_FRAG 0x02
+#define SCTP_DATA_NOT_FRAG 0x03
+#define SCTP_DATA_UNORDERED 0x04
+#define SCTP_DATA_SACK_IMMEDIATELY 0x08
/* ECN Nonce: SACK Chunk Specific Flags */
-#define SCTP_SACK_NONCE_SUM 0x01
+#define SCTP_SACK_NONCE_SUM 0x01
/* CMT DAC algorithm SACK flag */
-#define SCTP_SACK_CMT_DAC 0x80
+#define SCTP_SACK_CMT_DAC 0x80
/*
* PCB flags (in sctp_flags bitmask).
@@ -541,4 +535,6 @@
+#undef SCTP_PACKED
+
#endif /* !_NETINET_SCTP_H_ */
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_asconf.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
/* $KAME: sctp_asconf.c,v 1.24 2005/03/06 16:04:16 itojun Exp $ */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_asconf.c,v 1.36 2008/05/20 13:47:44 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_asconf.c,v 1.37 2008/06/14 07:58:05 rrs Exp $");
#include <netinet/sctp_os.h>
#include <netinet/sctp_var.h>
#include <netinet/sctp_sysctl.h>
@@ -264,7 +264,7 @@
} /* end switch */
/* if 0.0.0.0/::0, add the source address instead */
- if (zero_address && sctp_nat_friendly) {
+ if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) {
sa = (struct sockaddr *)&sa_source;
sctp_asconf_get_source_ip(m, sa);
SCTPDBG(SCTP_DEBUG_ASCONF1,
@@ -416,7 +416,7 @@
return m_reply;
}
/* if deleting 0.0.0.0/::0, delete all addresses except src addr */
- if (zero_address && sctp_nat_friendly) {
+ if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) {
result = sctp_asconf_del_remote_addrs_except(stcb,
(struct sockaddr *)&sa_source);
@@ -534,7 +534,7 @@
}
/* if 0.0.0.0/::0, use the source address instead */
- if (zero_address && sctp_nat_friendly) {
+ if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) {
sa = (struct sockaddr *)&sa_source;
sctp_asconf_get_source_ip(m, sa);
SCTPDBG(SCTP_DEBUG_ASCONF1,
@@ -667,7 +667,7 @@
if (ack->data != NULL) {
sctp_m_freem(ack->data);
}
- SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asconf_ack, ack);
+ SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asconf_ack), ack);
ack = ack_next;
}
}
@@ -814,7 +814,7 @@
send_reply:
ack_cp->ch.chunk_length = htons(ack_cp->ch.chunk_length);
/* save the ASCONF-ACK reply */
- ack = SCTP_ZONE_GET(sctppcbinfo.ipi_zone_asconf_ack,
+ ack = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_asconf_ack),
struct sctp_asconf_ack);
if (ack == NULL) {
sctp_m_freem(m_ack);
@@ -1392,7 +1392,7 @@
TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
#ifdef SCTP_DEBUG
- if (sctp_debug_on && SCTP_DEBUG_ASCONF2) {
+ if (SCTP_BASE_SYSCTL(sctp_debug_on) && SCTP_DEBUG_ASCONF2) {
if (type == SCTP_ADD_IP_ADDRESS) {
SCTP_PRINTF("asconf_queue_mgmt: inserted asconf ADD_IP_ADDRESS: ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF2, sa);
@@ -1479,7 +1479,7 @@
net->error_count = 0;
}
stcb->asoc.overall_error_count = 0;
- if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
stcb->asoc.overall_error_count,
0,
@@ -2336,7 +2336,7 @@
ifa->localifa_flags &= ~SCTP_ADDR_DEFER_USE;
}
sctp_free_ifa(ifa);
- SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_laddr, l);
+ SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_laddr), l);
SCTP_DECR_LADDR_COUNT();
l = l_next;
}
@@ -2392,7 +2392,7 @@
struct sctp_inpcb *inp;
/* go through all our PCB's */
- LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
+ LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
struct sctp_tcb *stcb;
/* process for all associations for this endpoint */
@@ -3188,7 +3188,7 @@
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, ENOMEM);
return (ENOMEM);
}
- wi = SCTP_ZONE_GET(sctppcbinfo.ipi_zone_laddr,
+ wi = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_laddr),
struct sctp_laddr);
if (wi == NULL) {
SCTP_FREE(asc, SCTP_M_ASC_IT);
@@ -3203,7 +3203,7 @@
if (inp->laddr_count < 2) {
/* can't delete the last local address */
SCTP_FREE(asc, SCTP_M_ASC_IT);
- SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_laddr, wi);
+ SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_laddr), wi);
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, EINVAL);
return (EINVAL);
}
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_auth.c#2 (text+ko) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_auth.c,v 1.19 2008/01/28 10:31:12 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_auth.c,v 1.20 2008/06/14 07:58:05 rrs Exp $");
#include <netinet/sctp_os.h>
#include <netinet/sctp.h>
@@ -43,8 +43,8 @@
#include <netinet/sctp_auth.h>
#ifdef SCTP_DEBUG
-#define SCTP_AUTH_DEBUG (sctp_debug_on & SCTP_DEBUG_AUTH1)
-#define SCTP_AUTH_DEBUG2 (sctp_debug_on & SCTP_DEBUG_AUTH2)
+#define SCTP_AUTH_DEBUG (SCTP_BASE_SYSCTL(sctp_debug_on) & SCTP_DEBUG_AUTH1)
+#define SCTP_AUTH_DEBUG2 (SCTP_BASE_SYSCTL(sctp_debug_on) & SCTP_DEBUG_AUTH2)
#endif /* SCTP_DEBUG */
@@ -1988,7 +1988,7 @@
"SCTP: peer sent chunk list w/o AUTH\n");
return (-1);
}
- if (!sctp_asconf_auth_nochk && peer_supports_asconf &&
+ if (!SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) && peer_supports_asconf &&
!peer_supports_auth) {
SCTPDBG(SCTP_DEBUG_AUTH1,
"SCTP: peer supports ASCONF but not AUTH\n");
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_bsd_addr.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
/* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_bsd_addr.c,v 1.18 2008/04/16 17:24:18 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_bsd_addr.c,v 1.19 2008/06/14 07:58:05 rrs Exp $");
#include <netinet/sctp_os.h>
#include <netinet/sctp_var.h>
@@ -48,7 +48,6 @@
#include <netinet/sctp_indata.h>
#include <sys/unistd.h>
-
/* Declare all of our malloc named types */
/* Note to Michael/Peter for mac-os,
@@ -85,17 +84,17 @@
void
sctp_wakeup_iterator(void)
{
- wakeup(&sctppcbinfo.iterator_running);
+ wakeup(&SCTP_BASE_INFO(iterator_running));
}
static void
sctp_iterator_thread(void *v)
{
SCTP_IPI_ITERATOR_WQ_LOCK();
- sctppcbinfo.iterator_running = 0;
+ SCTP_BASE_INFO(iterator_running) = 0;
while (1) {
- msleep(&sctppcbinfo.iterator_running,
- &sctppcbinfo.ipi_iterator_wq_mtx,
+ msleep(&SCTP_BASE_INFO(iterator_running),
+ &SCTP_BASE_INFO(ipi_iterator_wq_mtx),
0, "waiting_for_work", 0);
sctp_iterator_worker();
}
@@ -108,7 +107,7 @@
ret = kproc_create(sctp_iterator_thread,
(void *)NULL,
- &sctppcbinfo.thread_proc,
+ &SCTP_BASE_INFO(thread_proc),
RFPROC,
SCTP_KTHREAD_PAGES,
SCTP_KTRHEAD_NAME);
@@ -172,6 +171,7 @@
case IFT_PPP:
case IFT_LOOP:
case IFT_SLIP:
+ case IFT_GIF:
case IFT_IP:
case IFT_IPOVERCDLC:
case IFT_IPOVERCLAW:
@@ -185,6 +185,7 @@
return (result);
}
+
static void
sctp_init_ifns_for_vrf(int vrfid)
{
@@ -204,20 +205,16 @@
if (ifa->ifa_addr == NULL) {
continue;
}
- if ((ifa->ifa_addr->sa_family != AF_INET) &&
- (ifa->ifa_addr->sa_family != AF_INET6)
- ) {
+ if ((ifa->ifa_addr->sa_family != AF_INET) && (ifa->ifa_addr->sa_family != AF_INET6)) {
/* non inet/inet6 skip */
continue;
}
if (ifa->ifa_addr->sa_family == AF_INET6) {
- ifa6 = (struct in6_ifaddr *)ifa;
- ifa_flags = ifa6->ia6_flags;
if (IN6_IS_ADDR_UNSPECIFIED(&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr)) {
/* skip unspecifed addresses */
continue;
}
- } else if (ifa->ifa_addr->sa_family == AF_INET) {
+ } else {
if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == 0) {
continue;
}
@@ -226,26 +223,23 @@
/* non desired type */
continue;
}
- if ((ifa->ifa_addr->sa_family == AF_INET6) ||
- (ifa->ifa_addr->sa_family == AF_INET)) {
- if (ifa->ifa_addr->sa_family == AF_INET6) {
- ifa6 = (struct in6_ifaddr *)ifa;
- ifa_flags = ifa6->ia6_flags;
- } else {
- ifa_flags = 0;
- }
- sctp_ifa = sctp_add_addr_to_vrf(vrfid,
- (void *)ifn,
- ifn->if_index,
- ifn->if_type,
- ifn->if_xname,
- (void *)ifa,
- ifa->ifa_addr,
- ifa_flags, 0
- );
- if (sctp_ifa) {
- sctp_ifa->localifa_flags &= ~SCTP_ADDR_DEFER_USE;
- }
+ if (ifa->ifa_addr->sa_family == AF_INET6) {
+ ifa6 = (struct in6_ifaddr *)ifa;
+ ifa_flags = ifa6->ia6_flags;
+ } else {
+ ifa_flags = 0;
+ }
+ sctp_ifa = sctp_add_addr_to_vrf(vrfid,
+ (void *)ifn,
+ ifn->if_index,
+ ifn->if_type,
+ ifn->if_xname,
+ (void *)ifa,
+ ifa->ifa_addr,
+ ifa_flags,
+ 0);
+ if (sctp_ifa) {
+ sctp_ifa->localifa_flags &= ~SCTP_ADDR_DEFER_USE;
}
}
}
@@ -269,24 +263,20 @@
sctp_init_ifns_for_vrf(vrfid);
}
-static uint8_t first_time = 0;
-
-
void
sctp_addr_change(struct ifaddr *ifa, int cmd)
{
struct sctp_ifa *ifap = NULL;
uint32_t ifa_flags = 0;
- struct in6_ifaddr *ifa6;
/*
* BSD only has one VRF, if this changes we will need to hook in the
* right things here to get the id to pass to the address managment
* routine.
*/
- if (first_time == 0) {
+ if (SCTP_BASE_VAR(first_time) == 0) {
/* Special test to see if my ::1 will showup with this */
- first_time = 1;
+ SCTP_BASE_VAR(first_time) = 1;
sctp_init_ifns_for_vrf(SCTP_DEFAULT_VRFID);
}
if ((cmd != RTM_ADD) && (cmd != RTM_DELETE)) {
@@ -296,24 +286,22 @@
if (ifa->ifa_addr == NULL) {
return;
}
- if ((ifa->ifa_addr->sa_family != AF_INET) &&
- (ifa->ifa_addr->sa_family != AF_INET6)
- ) {
+ if ((ifa->ifa_addr->sa_family != AF_INET) && (ifa->ifa_addr->sa_family != AF_INET6)) {
/* non inet/inet6 skip */
return;
}
if (ifa->ifa_addr->sa_family == AF_INET6) {
- ifa6 = (struct in6_ifaddr *)ifa;
- ifa_flags = ifa6->ia6_flags;
+ ifa_flags = ((struct in6_ifaddr *)ifa)->ia6_flags;
if (IN6_IS_ADDR_UNSPECIFIED(&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr)) {
/* skip unspecifed addresses */
return;
}
- } else if (ifa->ifa_addr->sa_family == AF_INET) {
+ } else {
if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == 0) {
return;
}
}
+
if (sctp_is_desired_interface_type(ifa) == 0) {
/* non desired type */
return;
@@ -323,7 +311,7 @@
ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type,
ifa->ifa_ifp->if_xname,
(void *)ifa, ifa->ifa_addr, ifa_flags, 1);
- } else if (cmd == RTM_DELETE) {
+ } else {
sctp_del_addr_from_vrf(SCTP_DEFAULT_VRFID, ifa->ifa_addr,
ifa->ifa_ifp->if_index,
@@ -336,6 +324,21 @@
}
}
+void
+ sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add){
+ struct ifnet *ifn;
+ struct ifaddr *ifa;
+
+ TAILQ_FOREACH(ifn, &ifnet, if_list) {
+ if (!(*pred) (ifn)) {
+ continue;
+ }
+ TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) {
+ sctp_addr_change(ifa, add ? RTM_ADD : RTM_DELETE);
+ }
+ }
+}
+
struct mbuf *
sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header,
int how, int allonebuf, int type)
@@ -368,7 +371,7 @@
SCTP_BUF_NEXT(m) = NULL;
}
#ifdef SCTP_MBUF_LOGGING
- if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
if (SCTP_BUF_IS_EXTENDED(m)) {
sctp_log_mb(m, SCTP_MBUF_IALLOC);
}
@@ -379,12 +382,6 @@
#ifdef SCTP_PACKET_LOGGING
-
-int packet_log_writers = 0;
-int packet_log_end = 0;
-uint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE];
-
-
void
sctp_packet_log(struct mbuf *m, int length)
{
@@ -406,40 +403,40 @@
/* Can't log this packet I have not a buffer big enough */
return;
}
- if (length < (SCTP_MIN_V4_OVERHEAD + sizeof(struct sctp_cookie_ack_chunk))) {
+ if (length < (int)(SCTP_MIN_V4_OVERHEAD + sizeof(struct sctp_cookie_ack_chunk))) {
return;
}
- atomic_add_int(&packet_log_writers, 1);
+ atomic_add_int(&SCTP_BASE_VAR(packet_log_writers), 1);
try_again:
- if (packet_log_writers > SCTP_PKTLOG_WRITERS_NEED_LOCK) {
+ if (SCTP_BASE_VAR(packet_log_writers) > SCTP_PKTLOG_WRITERS_NEED_LOCK) {
SCTP_IP_PKTLOG_LOCK();
grabbed_lock = 1;
again_locked:
- value = packet_log_end;
- newval = packet_log_end + total_len;
+ value = SCTP_BASE_VAR(packet_log_end);
+ newval = SCTP_BASE_VAR(packet_log_end) + total_len;
if (newval >= SCTP_PACKET_LOG_SIZE) {
/* we wrapped */
thisbegin = 0;
thisend = total_len;
} else {
- thisbegin = packet_log_end;
+ thisbegin = SCTP_BASE_VAR(packet_log_end);
thisend = newval;
}
- if (!(atomic_cmpset_int(&packet_log_end, value, thisend))) {
+ if (!(atomic_cmpset_int(&SCTP_BASE_VAR(packet_log_end), value, thisend))) {
goto again_locked;
}
} else {
- value = packet_log_end;
- newval = packet_log_end + total_len;
+ value = SCTP_BASE_VAR(packet_log_end);
+ newval = SCTP_BASE_VAR(packet_log_end) + total_len;
if (newval >= SCTP_PACKET_LOG_SIZE) {
/* we wrapped */
thisbegin = 0;
thisend = total_len;
} else {
- thisbegin = packet_log_end;
+ thisbegin = SCTP_BASE_VAR(packet_log_end);
thisend = newval;
}
- if (!(atomic_cmpset_int(&packet_log_end, value, thisend))) {
+ if (!(atomic_cmpset_int(&SCTP_BASE_VAR(packet_log_end), value, thisend))) {
goto try_again;
}
}
@@ -448,14 +445,14 @@
printf("Insanity stops a log thisbegin:%d thisend:%d writers:%d lock:%d end:%d\n",
thisbegin,
thisend,
- packet_log_writers,
+ SCTP_BASE_VAR(packet_log_writers),
grabbed_lock,
- packet_log_end);
- packet_log_end = 0;
+ SCTP_BASE_VAR(packet_log_end));
+ SCTP_BASE_VAR(packet_log_end) = 0;
goto no_log;
}
- lenat = (int *)&packet_log_buffer[thisbegin];
+ lenat = (int *)&SCTP_BASE_VAR(packet_log_buffer)[thisbegin];
*lenat = total_len;
lenat++;
*lenat = value;
@@ -465,7 +462,7 @@
*tick_tock = sctp_get_tick_count();
copyto = (void *)lenat;
thisone = thisend - sizeof(int);
- lenat = (int *)&packet_log_buffer[thisone];
+ lenat = (int *)&SCTP_BASE_VAR(packet_log_buffer)[thisone];
*lenat = thisbegin;
if (grabbed_lock) {
SCTP_IP_PKTLOG_UNLOCK();
@@ -476,7 +473,7 @@
if (grabbed_lock) {
SCTP_IP_PKTLOG_UNLOCK();
}
- atomic_subtract_int(&packet_log_writers, 1);
+ atomic_subtract_int(&SCTP_BASE_VAR(packet_log_writers), 1);
}
@@ -492,14 +489,14 @@
int did_delay = 0;
tocopy = length;
- if (length < (2 * sizeof(int))) {
+ if (length < (int)(2 * sizeof(int))) {
/* not enough room */
return (0);
}
if (SCTP_PKTLOG_WRITERS_NEED_LOCK) {
- atomic_add_int(&packet_log_writers, SCTP_PKTLOG_WRITERS_NEED_LOCK);
+ atomic_add_int(&SCTP_BASE_VAR(packet_log_writers), SCTP_PKTLOG_WRITERS_NEED_LOCK);
again:
- if ((did_delay == 0) && (packet_log_writers != SCTP_PKTLOG_WRITERS_NEED_LOCK)) {
+ if ((did_delay == 0) && (SCTP_BASE_VAR(packet_log_writers) != SCTP_PKTLOG_WRITERS_NEED_LOCK)) {
/*
* we delay here for just a moment hoping the
* writer(s) that were present when we entered will
@@ -515,12 +512,12 @@
}
SCTP_IP_PKTLOG_LOCK();
lenat = (int *)target;
- *lenat = packet_log_end;
+ *lenat = SCTP_BASE_VAR(packet_log_end);
lenat++;
this_copy = min((length - sizeof(int)), SCTP_PACKET_LOG_SIZE);
- memcpy((void *)lenat, (void *)packet_log_buffer, this_copy);
+ memcpy((void *)lenat, (void *)SCTP_BASE_VAR(packet_log_buffer), this_copy);
if (SCTP_PKTLOG_WRITERS_NEED_LOCK) {
- atomic_subtract_int(&packet_log_writers,
+ atomic_subtract_int(&SCTP_BASE_VAR(packet_log_writers),
SCTP_PKTLOG_WRITERS_NEED_LOCK);
}
SCTP_IP_PKTLOG_UNLOCK();
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_bsd_addr.h#2 (text+ko) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_bsd_addr.h,v 1.7 2008/04/16 17:24:18 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_bsd_addr.h,v 1.8 2008/06/14 07:58:05 rrs Exp $");
#ifndef __sctp_bsd_addr_h__
#define __sctp_bsd_addr_h__
@@ -58,5 +58,7 @@
void sctp_addr_change(struct ifaddr *ifa, int cmd);
+void sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add);
+
#endif
#endif
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_cc_functions.c#2 (text+ko) ====
@@ -43,7 +43,7 @@
#include <netinet/sctp_asconf.h>
#include <netinet/sctp_cc_functions.h>
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_cc_functions.c,v 1.5 2008/05/20 13:47:44 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_cc_functions.c,v 1.6 2008/06/14 07:58:05 rrs Exp $");
void
sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net)
{
@@ -55,7 +55,7 @@
net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND));
net->ssthresh = stcb->asoc.peers_rwnd;
- if (sctp_logging_level & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) {
sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION);
}
}
@@ -71,7 +71,7 @@
* (net->fast_retran_loss_recovery == 0)))
*/
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
- if ((asoc->fast_retran_loss_recovery == 0) || (sctp_cmt_on_off == 1)) {
+ if ((asoc->fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) {
/* out of a RFC2582 Fast recovery window? */
if (net->net_ack > 0) {
/*
@@ -88,7 +88,7 @@
net->ssthresh = 2 * net->mtu;
}
net->cwnd = net->ssthresh;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd),
SCTP_CWND_LOG_FROM_FR);
}
@@ -165,7 +165,7 @@
}
}
#endif
- if (sctp_early_fr) {
+ if (SCTP_BASE_SYSCTL(sctp_early_fr)) {
/*
* So, first of all do we need to have a Early FR
* timer running?
@@ -201,7 +201,7 @@
}
/* if nothing was acked on this destination skip it */
if (net->net_ack == 0) {
- if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK);
}
continue;
@@ -232,10 +232,11 @@
*
* Should we stop any running T3 timer here?
*/
- if (sctp_cmt_on_off && sctp_cmt_pf && ((net->dest_state & SCTP_ADDR_PF) ==
- SCTP_ADDR_PF)) {
+ if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) &&
+ SCTP_BASE_SYSCTL(sctp_cmt_pf) &&
+ ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) {
net->dest_state &= ~SCTP_ADDR_PF;
- net->cwnd = net->mtu * sctp_cmt_pf;
+ net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf);
SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n",
net, net->cwnd);
/*
@@ -259,7 +260,7 @@
*/
#endif
- if (asoc->fast_retran_loss_recovery && will_exit == 0 && sctp_cmt_on_off == 0) {
+ if (asoc->fast_retran_loss_recovery && will_exit == 0 && SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) {
/*
* If we are in loss recovery we skip any cwnd
* update
@@ -270,26 +271,26 @@
* CMT: CUC algorithm. Update cwnd if pseudo-cumack has
* moved.
*/
- if (accum_moved || (sctp_cmt_on_off && net->new_pseudo_cumack)) {
+ if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && net->new_pseudo_cumack)) {
/* If the cumulative ack moved we can proceed */
if (net->cwnd <= net->ssthresh) {
/* We are in slow start */
if (net->flight_size + net->net_ack >= net->cwnd) {
- if (net->net_ack > (net->mtu * sctp_L2_abc_variable)) {
- net->cwnd += (net->mtu * sctp_L2_abc_variable);
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (net->net_ack > (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable))) {
+ net->cwnd += (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable));
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->mtu,
SCTP_CWND_LOG_FROM_SS);
}
} else {
net->cwnd += net->net_ack;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->net_ack,
SCTP_CWND_LOG_FROM_SS);
}
}
} else {
- if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, net->net_ack,
SCTP_CWND_LOG_NOADV_SS);
}
@@ -305,19 +306,19 @@
(net->partial_bytes_acked >= net->cwnd)) {
net->partial_bytes_acked -= net->cwnd;
net->cwnd += net->mtu;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->mtu,
SCTP_CWND_LOG_FROM_CA);
}
} else {
- if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, net->net_ack,
SCTP_CWND_LOG_NOADV_CA);
}
}
}
} else {
- if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, net->mtu,
SCTP_CWND_LOG_NO_CUMACK);
}
@@ -351,7 +352,7 @@
net->cwnd = net->mtu;
net->partial_bytes_acked = 0;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX);
}
}
@@ -369,7 +370,7 @@
net->RTO <<= 1;
}
net->cwnd = net->ssthresh;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
}
}
@@ -478,7 +479,7 @@
}
if (net->cwnd - old_cwnd != 0) {
/* log only changes */
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd),
SCTP_CWND_LOG_FROM_SAT);
}
@@ -495,7 +496,7 @@
net->ssthresh = net->cwnd;
net->cwnd = (net->flight_size + (burst_limit * net->mtu));
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST);
}
}
@@ -516,7 +517,7 @@
if (net->cwnd < net->ssthresh)
/* still in SS move to CA */
net->ssthresh = net->cwnd - 1;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (old_cwnd - net->cwnd), SCTP_CWND_LOG_FROM_FR);
}
}
@@ -619,12 +620,12 @@
/* normal mode */
if (net->net_ack > net->mtu) {
net->cwnd += net->mtu;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->mtu, SCTP_CWND_LOG_FROM_SS);
}
} else {
net->cwnd += net->net_ack;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->net_ack, SCTP_CWND_LOG_FROM_SS);
}
}
@@ -638,7 +639,7 @@
net->last_hs_used = indx;
incr = ((sctp_cwnd_adjust[indx].increase) << 10);
net->cwnd += incr;
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, incr, SCTP_CWND_LOG_FROM_SS);
}
}
@@ -680,7 +681,7 @@
net->last_hs_used = indx;
}
}
- if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_FR);
}
}
@@ -696,7 +697,7 @@
* (net->fast_retran_loss_recovery == 0)))
*/
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
- if ((asoc->fast_retran_loss_recovery == 0) || (sctp_cmt_on_off == 1)) {
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list