Loading... [tip type="red"]警告: 华为TOA内核模块存在严重问题,本篇所提出的解决方案**仅针对编译失败问题**讨论,如尝试本篇方案后仍然不可用,请您移步至我整理的[星河TOA模块](https://github.com/C4a15Wh/TOA_for_ecloud)[/tip] # 问题详情 **该TOA模块已经不再被推荐使用!!!** **该TOA模块已经不再被推荐使用!!!** **该TOA模块已经不再被推荐使用!!!** 即使按照本篇方案修改,修改后模块本身仍存在严重问题,导致TOA模块无法在Linux Kernel >= 4.17-rc1上工作,请您移步至我整理的[星河TOA模块](https://github.com/C4a15Wh/TOA_for_ecloud)。 ## 问题 编译TOA(TCP_option_address)内核模块失败 ## 代码位置 https://github.com/huaweicloud/elb-toa/ https://github.com/Huawei/TCP_option_address ## 复现背景 Linux Kernel >= 4.17-rc1 ## 症状  --- # 问题分析与解决 ## 分析 在Linux Kernel在v4.17-rc1的分支中,Kernel中“inet_getname”函数的第三项参数 uaddr_len 被删除了。[相关commit](https://github.com/torvalds/linux/commit/9b2c45d479d0fb8647c9e83359df69162b5fbe5f) 然而TOA插件是华为在2018年上传的,早已无人维护,这导致toa.c中对inet_getname函数和其相关逻辑仍保持四项参数的调用,两处报错代码分别位于[(toa.c#L114)](https://github.com/huaweicloud/elb-toa/blob/master/src/toa.c#L114)和[(toa.c#L103)](https://github.com/huaweicloud/elb-toa/blob/master/src/toa.c#L103)。 **若要编译TOA插件,则需要替换toa.c中这些有误的地方。** --- ## 解决 修改114和103行的代码: ### 114行 (Source) ``` /* call orginal one */ retval = inet_getname(sock, uaddr, uaddr_len, peer); ``` (Target) ``` /* call orginal one */ retval = inet_getname(sock, uaddr, peer); ``` ### 103行 (Source) ``` inet_getname_toa(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) ``` (Target) ``` inet_getname_toa(struct socket *sock, struct sockaddr *uaddr, int peer) ``` 更改后编译即可通过。  [tip type="red"]警告: 华为TOA内核模块存在严重问题,本篇所提出的解决方案**仅针对编译失败问题**讨论,如尝试本篇方案后仍然不可用,请您移步至我整理的[星河TOA模块](https://github.com/C4a15Wh/TOA_for_ecloud)[/tip] 最后修改:2025 年 01 月 15 日 © 允许规范转载 赞 如果这对你有用,我乐意之至。