Skip to content

Merge lwip 2.0.2 stable #4814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions features/FEATURE_LWIP/lwip-interface/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Description

This document describes how to update the Arm Mbed OS LWIP stack. The Mbed OS LWIP stack is a copy of the LWIP master repository. Stack is located in `FEATURE_LWIP/lwip-interface/lwip` directory.

When you add new releases or single commits from the LWIP master repository, you must fetch them using the Mbed OS LWIP fork repository. Use the repository to rename LWIP source files with the `lwip_` prefix to make them compatible with the Mbed OS build system.

* The LWIP master repository is part of the [LWIP project](https://savannah.nongnu.org/projects/lwip).
* The Mbed OS LWIP fork repository is part of [`ARMmbed`](https://github.com/ARMmbed/lwip).

## How to integrate a release from the LWIP master repository to the Mbed OS

You can integrate a new release using the following steps.

* Fetch the release to the Mbed OS LWIP fork.
* Prefix files in the Mbed OS LWIP fork with the `lwip_` prefix.
* Merge the release to the Mbed OS repository.

### Fetching the release to the Mbed OS LWIP fork and prefixing files

1. Clone the Mbed OS LWIP fork repository.

`git clone [email protected]:ARMmbed/lwip.git`

2. Go to the Mbed OS LWIP fork root directory, and add the LWIP master repository as remote.

`git remote add <remote name> https://git.savannah.nongnu.org/git/lwip.git`

`e.g. git remote add lwip https://git.savannah.nongnu.org/git/lwip.git`

3. Pull the release from the LWIP master repository using the release tag. You can find tags [here](<https://savannah.nongnu.org/projects/lwip>).

`git pull <remote name> <tag>`

`e.g. git pull lwip STABLE-2_0_2_RELEASE_VER`

4. Push the tag to the Mbed OS LWIP fork repository to keep the fork in sync.

`git push origin <tag>`

`e.g. git push origin STABLE-2_0_2_RELEASE_VER`

5. Create a branch for release. Use the same naming convention as previous branches.

`git branch <branch name> <tag>`

`e.g. git branch mbed-os-lwip-stable-2_0_2 STABLE-2_0_2_RELEASE_VER`

6. Push the branch to the Mbed OS LWIP fork repository to keep the fork in sync.

`git push origin <branch name>`

`e.g. git push origin mbed-os-lwip-stable-2_0_2`

7. Fetch the previous prefixed branch from the Mbed OS LWIP fork repository.

`git fetch <remote name> <remote branch>:<local branch>`

`e.g. git fetch origin mbed-os-lwip-stable-2_0_1-prefixed:mbed-os-lwip-stable-2_0_1-prefixed`

8. Checkout the latest prefixed branch.

`git checkout <prefixed branch>`

`e.g. git checkout mbed-os-lwip-stable-2_0_1-prefixed`

9. Merge the new branch to the prefixed branch.

`git merge <branch name>`

`e.g. git merge mbed-os-lwip-stable-2_0_2`

10. Check if there are any new or colliding files.

If there are new c-files rename those with `lwip_` prefix and make a commit about changes to the prefixed branch. Also, check that LWIP stack header file names do not collide with headers under the Mbed OS directory tree. If there are collisions, rename the colliding LWIP headers with `lwip_` prefix.

If needed, rename files, and make a commit. Update the C-files to include any renamed header files.

`git mv <old filename> <new filename>`

`git commit`

11. Rename the local prefixed branch to the new version. (Do not change branch names on remotes.)

`git branch -m <new prefixed branch>`

`e.g. git branch -m mbed-os-lwip-stable-2_0_2-prefixed`

12. Push the new local prefixed branch to the Mbed OS LWIP fork repository.

`git push origin <new prefixed branch>`

`e.g. git push origin mbed-os-lwip-stable-2_0_2-prefixed`

### Merging the prefixed release to the Mbed OS repository

1. Clone the Mbed OS repository.

`git clone [email protected]:ARMmbed/mbed-os.git`

2. Go to the Mbed OS root directory, and add the Mbed OS LWIP fork repository as remote. Fetch branches from fork.

`git remote add <remote name> https://github.com/ARMmbed/lwip.git`

`e.g. git remote add lwip-fork https://github.com/ARMmbed/lwip.git`

`git fetch <remote name>`

`e.g. git fetch lwip-fork`

3. Do a subtree pull for LWIP prefixed branch in the Mbed OS root directory.

`git subtree pull --squash -P features/FEATURE_LWIP/lwip-interface/lwip <remote name> <new prefixed branch> -m "<commit message>"`

`e.g. git subtree pull --squash -P features/FEATURE_LWIP/lwip-interface/lwip lwip-fork mbed-os-lwip-stable-2_0_2-prefixed -m "Merged lwip 2.0.2 stable"`

After this step, there is a new commit visible in the Mbed OS master branch that contains the changes.

4. Verify that changes in the new commit are correct, and create a new branch. Push the branch to your Mbed OS fork for GitHub review.
81 changes: 78 additions & 3 deletions features/FEATURE_LWIP/lwip-interface/lwip/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,82 @@ HISTORY
(git master)

* [Enter new changes just after this line - do not remove this line]


(STABLE-2.0.2)

++ New features:

2017-02-10: Dirk Ziegelmeier
* Implement task #14367: Hooks need a better place to be defined:
We now have a #define for a header file name that is #included in every .c
file that provides hooks.

++ Bugfixes:

2017-03-08
* tcp: do not keep sending SYNs when getting ACKs

2017-03-08: Joel Cunningham
* tcp: Initialize ssthresh to TCP_SND_BUF (bug #50476)

2017-03-01: Simon Goldschmidt
* httpd: LWIP_HTTPD_POST_MANUAL_WND: fixed double-free when httpd_post_data_recved
is called nested from httpd_post_receive_data() (bug #50424)

2017-02-28: David van Moolenbroek/Simon Goldschmidt
* tcp: fixed bug #50418: LWIP_EVENT_API: fix invalid calbacks for SYN_RCVD pcb

2017-02-17: Simon Goldschmidt
* dns: Improved DNS_LOCAL_HOSTLIST interface (bug #50325)

2017-02-16: Simon Goldschmidt
* LWIP_NETCONN_FULLDUPLEX: fixed shutdown during write (bug #50274)

2017-02-13: Simon Goldschmidt/Dirk Ziegelmeier
* For tiny targtes, LWIP_RAND is optional (fix compile time checks)

2017-02-10: Simon Goldschmidt
* tcp: Fixed bug #47485 (tcp_close() should not fail on memory error) by retrying
to send FIN from tcp_fasttmr

2017-02-09: Simon Goldschmidt
* sockets: Fixed bug #44032 (LWIP_NETCONN_FULLDUPLEX: select might work on
invalid/reused socket) by not allowing to reallocate a socket that has
"select_waiting != 0"

2017-02-09: Simon Goldschmidt
* httpd: Fixed bug #50059 (httpd LWIP_HTTPD_SUPPORT_11_KEEPALIVE vs.
LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED)

2017-02-08: Dirk Ziegelmeier
* Rename "IPv6 mapped IPv4 addresses" to their correct name from RFC4191:
"IPv4-mapped IPv6 address"

2017-02-08: Luc Revardel
* mld6.c: Fix bug #50220 (mld6_leavegroup does not send ICMP6_TYPE_MLD, even
if last reporter)

2017-02-08: David van Moolenbroek
* ip6.c: Patch #9250: fix source substitution in ip6_output_if()

2017-02-08: Simon Goldschmidt
* tcp_out.c: Fixed bug #50090 (last_unsent->oversize_left can become wrong value
in tcp_write error path)

2017-02-02: Dirk Ziegelmeier
* Fix bug #50206: UDP Netconn bind to IP6_ADDR_ANY fails

2017-01-18: Dirk Ziegelmeier
* Fix zero-copy RX, see bug bug #50064. PBUF_REFs were not supported as ARP requests.

2017-01-15: Axel Lin, Dirk Ziegelmeier
* minor bug fixes in mqtt

2017-01-11: Knut Andre Tidemann
* sockets/netconn: fix broken default ICMPv6 handling of checksums

(STABLE-2.0.1)

++ New features:

2016-12-31: Simon Goldschmidt
Expand Down Expand Up @@ -43,7 +118,7 @@ HISTORY

2016-12-05: Dirk Ziegelmeier
* fixed compiling with IPv4 disabled (IPv6 only case)

2016-11-28: Simon Goldschmidt
* api_lib.c: fixed bug #49725 (send-timeout: netconn_write() can return
ERR_OK without all bytes being written)
Expand Down Expand Up @@ -72,7 +147,7 @@ HISTORY
2016-11-11: Dirk Ziegelmeier
* sockets.c: fixed bug #49578 (dropping multicast membership does not work
with LWIP_SOCKET_OFFSET)

(STABLE-2.0.0)

++ New features:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "lwIP"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "2.0.1"
PROJECT_NUMBER = "2.0.2"

# 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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
* @verbinclude "UPGRADING"
*/

/**
* @page changelog Changelog
* @verbinclude "CHANGELOG"
*/

/**
* @page contrib How to contribute to lwIP
* @verbinclude "contrib.txt"
Expand Down
18 changes: 14 additions & 4 deletions features/FEATURE_LWIP/lwip-interface/lwip/src/api/lwip_api_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,13 @@ pcb_new(struct api_msg *msg)
case NETCONN_RAW:
msg->conn->pcb.raw = raw_new_ip_type(iptype, msg->msg.n.proto);
if (msg->conn->pcb.raw != NULL) {
#if LWIP_IPV6
/* ICMPv6 packets should always have checksum calculated by the stack as per RFC 3542 chapter 3.1 */
if (NETCONNTYPE_ISIPV6(msg->conn->type) && msg->conn->pcb.raw->protocol == IP6_NEXTH_ICMP6) {
msg->conn->pcb.raw->chksum_reqd = 1;
msg->conn->pcb.raw->chksum_offset = 2;
}
#endif /* LWIP_IPV6 */
raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn);
}
break;
Expand Down Expand Up @@ -1777,25 +1784,28 @@ lwip_netconn_do_close(void *m)
#if LWIP_NETCONN_FULLDUPLEX
if (msg->msg.sd.shut & NETCONN_SHUT_WR) {
/* close requested, abort running write */
sys_sem_t* op_completed_sem;
sys_sem_t* write_completed_sem;
LWIP_ASSERT("msg->conn->current_msg != NULL", msg->conn->current_msg != NULL);
op_completed_sem = LWIP_API_MSG_SEM(msg->conn->current_msg);
write_completed_sem = LWIP_API_MSG_SEM(msg->conn->current_msg);
msg->conn->current_msg->err = ERR_CLSD;
msg->conn->current_msg = NULL;
msg->conn->write_offset = 0;
msg->conn->state = NETCONN_NONE;
state = NETCONN_NONE;
NETCONN_SET_SAFE_ERR(msg->conn, ERR_CLSD);
sys_sem_signal(op_completed_sem);
sys_sem_signal(write_completed_sem);
} else {
LWIP_ASSERT("msg->msg.sd.shut == NETCONN_SHUT_RD", msg->msg.sd.shut == NETCONN_SHUT_RD);
/* In this case, let the write continue and do not interfere with
conn->current_msg or conn->state! */
msg->err = tcp_shutdown(msg->conn->pcb.tcp, 1, 0);
}
}
if (state == NETCONN_NONE) {
#else /* LWIP_NETCONN_FULLDUPLEX */
msg->err = ERR_INPROGRESS;
#endif /* LWIP_NETCONN_FULLDUPLEX */
} else {
#endif /* LWIP_NETCONN_FULLDUPLEX */
if (msg->msg.sd.shut & NETCONN_SHUT_RD) {
/* Drain and delete mboxes */
netconn_drain(msg->conn);
Expand Down
Loading