mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-28 23:00:50 +00:00
Compare commits
1 Commits
3d206b130a
...
4b2d402cec
Author | SHA1 | Date | |
---|---|---|---|
|
4b2d402cec |
6
.github/workflows/codeql-buildscript.sh
vendored
6
.github/workflows/codeql-buildscript.sh
vendored
@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
sudo apt-get install check ninja-build doxygen
|
|
||||||
cp contrib/examples/example_app/lwipcfg.h.ci contrib/examples/example_app/lwipcfg.h
|
|
||||||
make -C contrib/ports/unix/check
|
|
||||||
mkdir build && cd build && cmake .. -G Ninja && cmake --build .
|
|
126
.github/workflows/codeql.yml
vendored
126
.github/workflows/codeql.yml
vendored
@ -1,126 +0,0 @@
|
|||||||
# For most projects, this workflow file will not need changing; you simply need
|
|
||||||
# to commit it to your repository.
|
|
||||||
#
|
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
|
||||||
# or to provide custom queries or build logic.
|
|
||||||
#
|
|
||||||
# ******** NOTE ********
|
|
||||||
# We have attempted to detect the languages in your repository. Please check
|
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
|
||||||
# supported CodeQL languages.
|
|
||||||
#
|
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
|
||||||
# push:
|
|
||||||
# branches: [ "main", "master" ]
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0 * * *'
|
|
||||||
pull_request:
|
|
||||||
branches: '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
|
||||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
|
||||||
# - https://gh.io/supported-runners-and-hardware-resources
|
|
||||||
# - https://gh.io/using-larger-runners
|
|
||||||
# Consider using larger runners for possible analysis time improvements.
|
|
||||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-20.04' }}
|
|
||||||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: [ 'cpp' ]
|
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
|
|
||||||
# Use only 'java' to analyze code written in Java, Kotlin or both
|
|
||||||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
|
||||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
|
|
||||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
||||||
# queries: security-extended,security-and-quality
|
|
||||||
queries: security-and-quality
|
|
||||||
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
#- name: Autobuild
|
|
||||||
# uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
||||||
|
|
||||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
||||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
./.github/workflows/codeql-buildscript.sh
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
with:
|
|
||||||
category: "/language:${{matrix.language}}"
|
|
||||||
upload: false
|
|
||||||
id: step1
|
|
||||||
|
|
||||||
# Filter out rules with low severity or high false positve rate
|
|
||||||
# Also filter out warnings in third-party code
|
|
||||||
- name: Filter out unwanted errors and warnings
|
|
||||||
uses: advanced-security/filter-sarif@v1
|
|
||||||
with:
|
|
||||||
patterns: |
|
|
||||||
-**:cpp/path-injection
|
|
||||||
-**:cpp/world-writable-file-creation
|
|
||||||
-**:cpp/poorly-documented-function
|
|
||||||
-**:cpp/potentially-dangerous-function
|
|
||||||
-**:cpp/use-of-goto
|
|
||||||
-**:cpp/integer-multiplication-cast-to-long
|
|
||||||
-**:cpp/comparison-with-wider-type
|
|
||||||
-**:cpp/leap-year/*
|
|
||||||
-**:cpp/ambiguously-signed-bit-field
|
|
||||||
-**:cpp/suspicious-pointer-scaling
|
|
||||||
-**:cpp/suspicious-pointer-scaling-void
|
|
||||||
-**:cpp/unsigned-comparison-zero
|
|
||||||
-**/cmake*/Modules/**
|
|
||||||
input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
|
||||||
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
|
||||||
|
|
||||||
- name: Upload CodeQL results to code scanning
|
|
||||||
uses: github/codeql-action/upload-sarif@v2
|
|
||||||
with:
|
|
||||||
sarif_file: ${{ steps.step1.outputs.sarif-output }}
|
|
||||||
category: "/language:${{matrix.language}}"
|
|
||||||
|
|
||||||
- name: Upload CodeQL results as an artifact
|
|
||||||
if: success() || failure()
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: codeql-results
|
|
||||||
path: ${{ steps.step1.outputs.sarif-output }}
|
|
||||||
retention-days: 5
|
|
||||||
|
|
||||||
- name: Fail if an error is found
|
|
||||||
run: |
|
|
||||||
./.github/workflows/fail_on_error.py \
|
|
||||||
${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
|
34
.github/workflows/fail_on_error.py
vendored
34
.github/workflows/fail_on_error.py
vendored
@ -1,34 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Return whether SARIF file contains error-level results
|
|
||||||
def codeql_sarif_contain_error(filename):
|
|
||||||
with open(filename, 'r') as f:
|
|
||||||
s = json.load(f)
|
|
||||||
|
|
||||||
for run in s.get('runs', []):
|
|
||||||
rules_metadata = run['tool']['driver']['rules']
|
|
||||||
if not rules_metadata:
|
|
||||||
rules_metadata = run['tool']['extensions'][0]['rules']
|
|
||||||
|
|
||||||
for res in run.get('results', []):
|
|
||||||
if 'ruleIndex' in res:
|
|
||||||
rule_index = res['ruleIndex']
|
|
||||||
elif 'rule' in res and 'index' in res['rule']:
|
|
||||||
rule_index = res['rule']['index']
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
rule_level = rules_metadata[rule_index]['defaultConfiguration']['level']
|
|
||||||
except IndexError as e:
|
|
||||||
print(e, rule_index, len(rules_metadata))
|
|
||||||
else:
|
|
||||||
if rule_level == 'error':
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if codeql_sarif_contain_error(sys.argv[1]):
|
|
||||||
sys.exit(1)
|
|
@ -40,7 +40,6 @@
|
|||||||
#if LWIP_DNS && LWIP_SOCKET
|
#if LWIP_DNS && LWIP_SOCKET
|
||||||
|
|
||||||
#include "lwip/err.h"
|
#include "lwip/err.h"
|
||||||
#include "lwip/errno.h"
|
|
||||||
#include "lwip/mem.h"
|
#include "lwip/mem.h"
|
||||||
#include "lwip/memp.h"
|
#include "lwip/memp.h"
|
||||||
#include "lwip/ip_addr.h"
|
#include "lwip/ip_addr.h"
|
||||||
@ -383,9 +382,7 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
|
|||||||
/* set up sockaddr */
|
/* set up sockaddr */
|
||||||
inet6_addr_from_ip6addr(&sa6->sin6_addr, ip_2_ip6(&addr));
|
inet6_addr_from_ip6addr(&sa6->sin6_addr, ip_2_ip6(&addr));
|
||||||
sa6->sin6_family = AF_INET6;
|
sa6->sin6_family = AF_INET6;
|
||||||
#if LWIP_SOCKET_HAVE_SA_LEN
|
|
||||||
sa6->sin6_len = sizeof(struct sockaddr_in6);
|
sa6->sin6_len = sizeof(struct sockaddr_in6);
|
||||||
#endif /* LWIP_SOCKET_HAVE_SA_LEN */
|
|
||||||
sa6->sin6_port = lwip_htons((u16_t)port_nr);
|
sa6->sin6_port = lwip_htons((u16_t)port_nr);
|
||||||
sa6->sin6_scope_id = ip6_addr_zone(ip_2_ip6(&addr));
|
sa6->sin6_scope_id = ip6_addr_zone(ip_2_ip6(&addr));
|
||||||
ai->ai_family = AF_INET6;
|
ai->ai_family = AF_INET6;
|
||||||
@ -396,9 +393,7 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
|
|||||||
/* set up sockaddr */
|
/* set up sockaddr */
|
||||||
inet_addr_from_ip4addr(&sa4->sin_addr, ip_2_ip4(&addr));
|
inet_addr_from_ip4addr(&sa4->sin_addr, ip_2_ip4(&addr));
|
||||||
sa4->sin_family = AF_INET;
|
sa4->sin_family = AF_INET;
|
||||||
#if LWIP_SOCKET_HAVE_SA_LEN
|
|
||||||
sa4->sin_len = sizeof(struct sockaddr_in);
|
sa4->sin_len = sizeof(struct sockaddr_in);
|
||||||
#endif /* LWIP_SOCKET_HAVE_SA_LEN */
|
|
||||||
sa4->sin_port = lwip_htons((u16_t)port_nr);
|
sa4->sin_port = lwip_htons((u16_t)port_nr);
|
||||||
ai->ai_family = AF_INET;
|
ai->ai_family = AF_INET;
|
||||||
#endif /* LWIP_IPV4 */
|
#endif /* LWIP_IPV4 */
|
||||||
|
@ -68,20 +68,11 @@ sys_mutex_t lock_tcpip_core;
|
|||||||
static void tcpip_thread_handle_msg(struct tcpip_msg *msg);
|
static void tcpip_thread_handle_msg(struct tcpip_msg *msg);
|
||||||
|
|
||||||
#if !LWIP_TIMERS
|
#if !LWIP_TIMERS
|
||||||
|
/* wait for a message with timers disabled (e.g. pass a timer-check trigger into tcpip_thread) */
|
||||||
/** Wait for a message with timers disabled (e.g. pass a timer-check trigger into tcpip_thread) */
|
#define TCPIP_MBOX_FETCH(mbox, msg) sys_mbox_fetch(mbox, msg)
|
||||||
static void
|
|
||||||
tcpip_mbox_fetch(sys_mbox_t* mbox, void** msg)
|
|
||||||
{
|
|
||||||
LWIP_ASSERT_CORE_LOCKED();
|
|
||||||
|
|
||||||
UNLOCK_TCPIP_CORE();
|
|
||||||
sys_mbox_fetch(mbox, msg);
|
|
||||||
LOCK_TCPIP_CORE();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !LWIP_TIMERS */
|
#else /* !LWIP_TIMERS */
|
||||||
|
/* wait for a message, timeouts are processed while waiting */
|
||||||
|
#define TCPIP_MBOX_FETCH(mbox, msg) tcpip_timeouts_mbox_fetch(mbox, msg)
|
||||||
/**
|
/**
|
||||||
* Wait (forever) for a message to arrive in an mbox.
|
* Wait (forever) for a message to arrive in an mbox.
|
||||||
* While waiting, timeouts are processed.
|
* While waiting, timeouts are processed.
|
||||||
@ -90,7 +81,7 @@ tcpip_mbox_fetch(sys_mbox_t* mbox, void** msg)
|
|||||||
* @param msg the place to store the message
|
* @param msg the place to store the message
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
tcpip_mbox_fetch(sys_mbox_t *mbox, void **msg)
|
tcpip_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg)
|
||||||
{
|
{
|
||||||
u32_t sleeptime, res;
|
u32_t sleeptime, res;
|
||||||
|
|
||||||
@ -148,7 +139,7 @@ tcpip_thread(void *arg)
|
|||||||
while (1) { /* MAIN Loop */
|
while (1) { /* MAIN Loop */
|
||||||
LWIP_TCPIP_THREAD_ALIVE();
|
LWIP_TCPIP_THREAD_ALIVE();
|
||||||
/* wait for a message, timeouts are processed while waiting */
|
/* wait for a message, timeouts are processed while waiting */
|
||||||
tcpip_mbox_fetch(&tcpip_mbox, (void **)&msg);
|
TCPIP_MBOX_FETCH(&tcpip_mbox, (void **)&msg);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: NULL\n"));
|
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: NULL\n"));
|
||||||
LWIP_ASSERT("tcpip_thread: invalid message", 0);
|
LWIP_ASSERT("tcpip_thread: invalid message", 0);
|
||||||
|
@ -21,7 +21,7 @@ while($file = <FILES>) {
|
|||||||
print(HEADER "HTTP/1.0 200 OK\r\n");
|
print(HEADER "HTTP/1.0 200 OK\r\n");
|
||||||
}
|
}
|
||||||
print(HEADER "Server: lwIP/pre-0.6 (http://www.sics.se/~adam/lwip/)\r\n");
|
print(HEADER "Server: lwIP/pre-0.6 (http://www.sics.se/~adam/lwip/)\r\n");
|
||||||
if($file =~ /\.s?html?$/) {
|
if($file =~ /\.html$/) {
|
||||||
print(HEADER "Content-type: text/html\r\n");
|
print(HEADER "Content-type: text/html\r\n");
|
||||||
} elsif($file =~ /\.gif$/) {
|
} elsif($file =~ /\.gif$/) {
|
||||||
print(HEADER "Content-type: image/gif\r\n");
|
print(HEADER "Content-type: image/gif\r\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user