Skip to content
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

add IPv6 #43

Closed
wants to merge 2 commits into from
Closed

add IPv6 #43

wants to merge 2 commits into from

Conversation

imguoliwei
Copy link
Contributor

添加了处理IPv6的代码,用户可以定义SELECT_IPV6,选择编译IPv6的版本,否则默认编译IPv4的版本
由于我不太清楚如何将IPv6添加到ipset,所以我没有写出这些代码,不过这并不会导致不能编译运行
此外,NFQUEUE可以将数据包分配到多个队列实现负载均衡
iptables -t mangle -A POSTROUTING -o pppoe-wan -p tcp -j NFQUEUE --queue-balance 10010:10013
因此可以直接多进程而不是多线程,降低代码编写难度
我已经实现并实际运行了多进程的代码,我自己主要运行维护这个版本

@Zxilly
Copy link
Owner

Zxilly commented Mar 6, 2022

谢谢,但是就我个人来说的话,我可能会期望在单个程序里同时完成ipv4和v6的处理。刚刚稍微查了一下,应该是可以实现的。
https://serverfault.com/questions/480299/inject-packet-to-a-different-nfqueue
如果您有空的话可以帮忙修改一下,或者说我回头再来完善一下。

@imguoliwei
Copy link
Contributor Author

我也发现这应该可以实现,不过我可能要几天后才有时间进行测试了

@Zxilly Zxilly added enhancement New feature or request question Further information is requested labels Mar 7, 2022
@imguoliwei
Copy link
Contributor Author

已经实现了,ua2f-mix.cpp
由于我想为每种网络协议分别记录修改UA的数量,我发现用C++写比较方便,暂时没有写C的版本
之前的代码有一个返回值处理不正确,我在我的fork提交了修复

@Zxilly
Copy link
Owner

Zxilly commented Mar 7, 2022

迁移到C++也可以,我没什么问题

@imguoliwei
Copy link
Contributor Author

我并不经常研究OpenWRT,我有两个问题
OpenWRT运行C++程序会不会有问题,比如缺少相关的库
coolsnowwolf的LEDE默认不编译ipv6helper,那么在这种情况下会不会无法编译,或者运行出错。或许有必要保留这个单独编译IPv4/v6的版本

@Zxilly
Copy link
Owner

Zxilly commented Mar 7, 2022

我看了一下,会把libstdc++引进来,我不知道这个的体积是不是能接受,要测试一下

@imguoliwei
Copy link
Contributor Author

我已经在PHICOMM K2成功运行了我的程序。libstdcpp6的大小为329kB

@imguoliwei
Copy link
Contributor Author

看起来在一个程序同时处理IPv4/v6并没有什么问题,我关闭这个PR了

@imguoliwei imguoliwei closed this Mar 10, 2022
@Zxilly Zxilly mentioned this pull request Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants