Skip to content

Conversation

@xiaoniaoyou6hua
Copy link
Contributor

@xiaoniaoyou6hua xiaoniaoyou6hua commented Apr 21, 2023

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

在使用2.1.2版本lwip组件中,开启ipv6从编译到运行都遇到了问题,提供该修改策略。

你的解决方案是什么 (what is your solution)

首先声明,这不是一个充分解决ipv6问题的pr,算是一份必要不充分的修改。

- #define IP6_FRAG_HLEN    8
+ #define IP6_FRAG_HLEN    12

这里的修改是为了应对不同架构硬件平台指针大小size差异,出现ip6_frag.c line 115断言。

//components/net/lwip/lwip-2.1.2/src/core/ipv6/ip6_frag.c line 115

#if !IPV6_FRAG_COPYHEADER
  LWIP_ASSERT("sizeof(struct ip6_reass_helper) <= IP6_FRAG_HLEN, set IPV6_FRAG_COPYHEADER to 1",
    sizeof(struct ip6_reass_helper) <= IP6_FRAG_HLEN);
#endif /* !IPV6_FRAG_COPYHEADER */

其余说明可以参考issues #6985 中我个人的评论。
如果想让ipv6功能跑起来,还需要在components/net/lwip/port/lwipopts.h考量下面这两行代码的处理方式,这边的问题同样在上述 issues #6985 中提及,鉴于还没来得及找到比较好的处理方式,暂未处理。

//components/net/lwip/port/lwipopts.h line 645

#include "lwip/ip_addr.h"
struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);

在什么测试环境下测试通过 (what is the test environment)

将上述components/net/lwip/port/lwipopts.h中提及的两行代码注释掉,编译会出现警告,但是功能可以正常运行。
]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@CLAassistant
Copy link

CLAassistant commented Apr 21, 2023

CLA assistant check
All committers have signed the CLA.

@xiaoniaoyou6hua xiaoniaoyou6hua force-pushed the fix_ipv6 branch 2 times, most recently from 3627ea6 to b40606c Compare April 21, 2023 13:29
@BernardXiong BernardXiong requested a review from geniusgogo April 22, 2023 01:13
Copy link
Contributor

@geniusgogo geniusgogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将头文件包含引入的ipv6地址结构体不统一的问题一起考虑修复吧

@xiaoniaoyou6hua
Copy link
Contributor Author

现在将components/net/lwip/port/lwipopts.h中引起率先隐式包含造成宏缺失的关键两句做处理。

这里为了声明

struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);

需要ip4_addr_t结构体定义包含了lwip/ip_addr.h头文件,现将声明直接放置到lwip/ip_addr.h头文件下,虽然在components/net/lwip/port/lwipopts.h中宏替换

#define LWIP_HOOK_IP4_ROUTE_SRC(src, dest)  lwip_ip4_route_src(dest, src)

拿不到接口声明,但是在具体的.c调用中是拿得到的。

经编译烧录上板测试功能正常。

@geniusgogo geniusgogo added the +1 Agree +1 label Apr 25, 2023
@BernardXiong BernardXiong merged commit c34608b into RT-Thread:master Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+1 Agree +1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants