Skip to content

Commit

Permalink
FMET 4.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
butok committed Feb 16, 2021
1 parent f86658f commit 9e2764a
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 12 deletions.
4 changes: 4 additions & 0 deletions fnet_doc/doxygen/fnet_doc.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,10 @@ Press any key to continue . . .

FNET public releases:

- Version 4.7.1
- Broadcast a DHCP DECLINE message, instead of unicasting.
- Randomize TCP initial sequence number.

- Version 4.7.0
- Fix possible out of bounds read on a received malformed LLMNR, mDNS or IPv6 packet.
- Add null termination check for the input-name parameter of the LLMNR, mDNS and DNS services.
Expand Down
2 changes: 1 addition & 1 deletion fnet_doc/doxygen/fnet_gen_doc.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Embedded TCP/IP stack"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 4.7.0
PROJECT_NUMBER = 4.7.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion fnet_doc/doxygen/fnet_gen_doc_chm.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Embedded TCP/IP stack"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 4.7.0
PROJECT_NUMBER = 4.7.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Binary file modified fnet_doc/fnet_user_manual.chm
Binary file not shown.
2 changes: 1 addition & 1 deletion fnet_stack/fnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
* string.
* @showinitializer
******************************************************************************/
#define FNET_VERSION "4.7.0"
#define FNET_VERSION "4.7.1"

/*! @} */

Expand Down
2 changes: 1 addition & 1 deletion fnet_stack/service/dhcp/fnet_dhcp_cln.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ static void _fnet_dhcp_cln_send_message( fnet_dhcp_cln_if_t *dhcp )
message_type = FNET_DHCP_OPTION_MSG_TYPE_REQUEST;
break;
case FNET_DHCP_CLN_STATE_PROBING:
ip_address = dhcp->current_options.public_options.dhcp_server; /* Send REQUEST to leasing server*/
ip_address.s_addr = INADDR_BROADCAST; /* As the client does not have a valid network address, the client must broadcast the DHCPDECLINE message. */
message->header.ciaddr = dhcp->current_options.public_options.ip_address.s_addr;
message_type = FNET_DHCP_OPTION_MSG_TYPE_DECLINE; /* DHCPDECLINE - Client to server indicating network address is already in use.*/
break;
Expand Down
26 changes: 19 additions & 7 deletions fnet_stack/stack/fnet_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ static fnet_return_t _fnet_tcp_setsockopt( fnet_socket_if_t *sk, fnet_protocol_t
static fnet_return_t _fnet_tcp_getsockopt( fnet_socket_if_t *sk, fnet_protocol_t level, fnet_socket_options_t optname, void *optval, fnet_size_t *optlen );
static fnet_return_t _fnet_tcp_listen( fnet_socket_if_t *sk, fnet_size_t backlog );
static void _fnet_tcp_drain( void );
static void _fnet_tcp_initial_seq_number_update( void );

#if FNET_CFG_DEBUG_TRACE_TCP && FNET_CFG_DEBUG_TRACE
void _fnet_tcp_trace(fnet_uint8_t *str, fnet_tcp_header_t *tcp_hdr);
Expand All @@ -127,8 +128,8 @@ static void _fnet_tcp_drain( void );
/* Initial Sequence Number
* tcpcb_isntime is changed by STEPISN every 0.5 sec.
* Additionaly, each time a connection is established,
* tcpcb_isntime is also incremented by FNET_TCP_INITIAL_SEQ_NUMBER_STEP */
static fnet_uint32_t _fnet_tcp_initial_seq_number = 1u;
* tcpcb_isntime is also incremented by FNET_TCP_INITIAL_SEQ_NUMBER_STEP + random value */
static fnet_uint32_t _fnet_tcp_initial_seq_number;

/* Timers.*/
static fnet_timer_desc_t fnet_tcp_fasttimer;
Expand Down Expand Up @@ -174,15 +175,15 @@ fnet_prot_if_t fnet_tcp_prot_if =
*************************************************************************/
static fnet_return_t _fnet_tcp_init( void )
{
/* Create the slow timer.*/
/* Create the fast timer.*/
fnet_tcp_fasttimer = _fnet_timer_new(FNET_TCP_FAST_TIMER_PERIOD_MS, _fnet_tcp_fasttimo, 0u);

if(!fnet_tcp_fasttimer)
{
return FNET_ERR;
}

/* Create the fast timer.*/
/* Create the slow timer.*/
fnet_tcp_slowtimer = _fnet_timer_new(FNET_TCP_SLOW_TIMER_PERIOD_MS, _fnet_tcp_slowtimo, 0u);

if(!fnet_tcp_slowtimer)
Expand All @@ -192,6 +193,9 @@ static fnet_return_t _fnet_tcp_init( void )
return FNET_ERR;
}

/* Initialize ISN */
_fnet_tcp_initial_seq_number_update();

return FNET_OK;
}

Expand Down Expand Up @@ -437,6 +441,14 @@ static fnet_return_t _fnet_tcp_attach( fnet_socket_if_t *sk )
return FNET_OK;
}

/************************************************************************
* DESCRIPTION: This function updates TCP ISN.
*************************************************************************/
static void _fnet_tcp_initial_seq_number_update( void )
{
/* Increase Initial Sequence Number. */
_fnet_tcp_initial_seq_number += FNET_TCP_INITIAL_SEQ_NUMBER_STEP + fnet_rand() & 0xFF;
}
/************************************************************************
* DESCRIPTION: This function performs the connection termination.
*
Expand Down Expand Up @@ -591,7 +603,7 @@ static fnet_return_t _fnet_tcp_connect( fnet_socket_if_t *sk, struct fnet_sockad
sk->state = SS_CONNECTING;

/* Increase Initial Sequence Number.*/
_fnet_tcp_initial_seq_number += FNET_TCP_INITIAL_SEQ_NUMBER_STEP;
_fnet_tcp_initial_seq_number_update();

/* Initialize Abort Timer.*/
cb->tcpcb_timers.retransmission = cb->tcpcb_rto;
Expand Down Expand Up @@ -1790,7 +1802,7 @@ static fnet_bool_t _fnet_tcp_inputsk( fnet_socket_if_t *sk, fnet_netbuf_t *inseg
_fnet_tcp_send_headseg(psk, FNET_TCP_SGT_SYN | FNET_TCP_SGT_ACK, options, optionlen);

/* Increase ISN (Initial Sequence Number).*/
_fnet_tcp_initial_seq_number += FNET_TCP_INITIAL_SEQ_NUMBER_STEP;
_fnet_tcp_initial_seq_number_update();

/* Initialization the connection timer.*/
pcb->tcpcb_timers.connection = FNET_TCP_ABORT_INTERVAL_CON;
Expand Down Expand Up @@ -2745,7 +2757,7 @@ static void _fnet_tcp_slowtimo(fnet_uint32_t cookie)
sk = nextsk;
}

_fnet_tcp_initial_seq_number += FNET_TCP_INITIAL_SEQ_NUMBER_STEP;
_fnet_tcp_initial_seq_number_update();

fnet_isr_unlock();
}
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The stack provides following protocols and services:
- QCA4002 (GT202-GC3013-FRDM4-KIT board).
- QCA4004 (SX-ULPAN-2401-SHIELD board).
- Supported Compilers:
- IAR: Embedded Workbench for ARM, version 8.50
- IAR: Embedded Workbench for ARM, version 8.22
- GCC: Kinetis Design Studio, version 3.2
- Bare-metal TCP/IP stack. No underlying RTOS is required, although it can be used with it. FreeRTOS example is provided.
- Certified logos for:
Expand Down

0 comments on commit 9e2764a

Please sign in to comment.