1、问题复现方法
# step 1
ipset create foo hash:ip,port
# step 2
for i in `seq 100 241`; do ipset add foo 192.168.122.$i; done
# step 3
ipset list -o xml
2、问题分析结果
程序源码存在bug,导致ipset输出结果有误
3、补丁及下载地址
·银河麒麟高级服务器操作系统 V10 SP1
ipset(aarch64)软件包下载地址:
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/aarch64/Packages/ipset-7.3-2.p01.ky10.aarch64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/aarch64/Packages/ipset-devel-7.3-2.p01.ky10.aarch64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/aarch64/Packages/ipset-help-7.3-2.p01.ky10.noarch.rpm
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/aarch64/Packages/ipset-libs-7.3-2.p01.ky10.aarch64.rpm
ipset(x86_64)软件包下载地址:
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64/Packages/ipset-7.3-2.p01.ky10.x86_64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64/Packages/ipset-devel-7.3-2.p01.ky10.x86_64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64/Packages/ipset-help-7.3-2.p01.ky10.noarch.rpm
https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64/Packages/ipset-libs-7.3-2.p01.ky10.x86_64.rpm
·银河麒麟高级服务器操作系统 V10 SP2
ipset(aarch64)软件包下载地址:
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/aarch64/Packages/ipset-7.6-0.p01.ky10.aarch64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/aarch64/Packages/ipset-devel-7.6-0.p01.ky10.aarch64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/aarch64/Packages/ipset-help-7.6-0.p01.ky10.noarch.rpm
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/aarch64/Packages/ipset-libs-7.6-0.p01.ky10.aarch64.rpm
ipset(x86_64)软件包下载地址:
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/x86_64/Packages/ipset-7.6-0.p01.ky10.x86_64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/x86_64/Packages/ipset-devel-7.6-0.p01.ky10.x86_64.rpm
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/x86_64/Packages/ipset-help-7.6-0.p01.ky10.noarch.rpm
https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/x86_64/Packages/ipset-libs-7.6-0.p01.ky10.x86_64.rpm
4、修复和更新方法
修改程序源码中的SNPRINTF_FAILUR宏,当ipset_print_port()返回-1时,使ipset_print_elem()和ipset_print_proto_port()函数能够返回正确的结果,最终促使程序能够先输出和清空outbuf中的数据,之后再重新向outbuf中写入当前”ip,port”记录