1 Commits
#2 ... issues#5

Author SHA1 Message Date
Wei, Jing
c354909d4a [ issues #5 ] 80系统bond配置模式3时运行程序出现段错误问题
1. 增加对目录的过滤,当目标为目录时退出线程。

提交的变更:
	修改:     code/build.sh
	重命名:   code/dep/libman.so -> code/dep/42/libman.so
	修改:     code/dep/42/run.sh
	修改:     code/dep/90/run.sh
	新文件:   code/dep/Makefile
	新文件:   code/dep/README
	删除:     code/dep/dotconf#1.0.13-1.pkg.tar.gz
	修改:     code/dep/libproc_common.so
	删除:     code/dep/old/libman.so
	修改:     code/dep/proc_common.cpp
	修改:     code/dep/run.sh
	删除:     code/sys_nicmonitor-code.tar.gz
	修改:     code/sys_nicmonitor/Makefile
	修改:     code/sys_nicmonitor/README
	修改:     code/sys_nicmonitor/mnic.c
	修改:     code/sys_nicmonitor/version.h

Signed-off-by: Wei, Jing <jwei@linx-info.com>
2021-12-01 10:55:05 +08:00
16 changed files with 83 additions and 12 deletions

View File

@@ -1,3 +1,5 @@
#!/bin/bash
verstr=`grep version ./sys_nicmonitor/version.h | cut -d "=" -f 2`
echo $verstr
worksrc=sys_nicmonitor-$verstr

4
code/dep/42/run.sh Normal file → Executable file
View File

@@ -1,2 +1,6 @@
#!/bin/bash
pkgadd dotconf#1.0.13-1.pkg.tar.gz
cp ../libproc_common.so /usr/lib64/
# cp ../libproc_common.so /usr/lib/

8
code/dep/90/run.sh Normal file → Executable file
View File

@@ -2,11 +2,11 @@
arch=`uname -m`
if [ "x$arch" == "x86_64" ]; then
dpkg -i libdotconf0_1.3-0.2_amd64.deb
dpkg -i libdotconf-dev_1.3-0.2_amd64.deb
dpkg -i libdotconf0_1.3-0.2_amd64.deb
dpkg -i libdotconf-dev_1.3-0.2_amd64.deb
elif [ "x$arch" == "aarch64" ]; then
dpkg -i libdotconf0_1.3-0.2_arm64.deb
dpkg -i libdotconf-dev_1.3-0.2_arm64.deb
dpkg -i libdotconf0_1.3-0.2_arm64.deb
dpkg -i libdotconf-dev_1.3-0.2_arm64.deb
fi
cp ../libproc_common.so /usr/lib/

11
code/dep/Makefile Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/make -f
all: libproc_common.so
libproc_common.so:
g++ -fPIC -shared -I ../sys_nicmonitor/include proc_common.cpp -o libproc_common.so
install:
cp libproc_common.so /usr/lib
clean:
rm -rf libproc_common.so

7
code/dep/README Normal file
View File

@@ -0,0 +1,7 @@
编译网卡监视程序前需安装依赖库和科东接口库。
依赖库ibdotconf.so (软件源中安装对应软件包)
科东接口库libproc_common.so (需要在当前目录编译生成make)
执行run.sh自动安装依赖。

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -12,7 +12,8 @@ NS_SYSADMIN::CProcCommon::~CProcCommon()
printf("NS_SYSADMIN::CProcCommon::~CProcCommon\n");
}
int NS_SYSADMIN::CProcCommon::proc_init(const char* scn_name, const char* subscn_name,char* process_name, const char* label = NULL, const char* subscn_lable = NULL)
// int NS_SYSADMIN::CProcCommon::proc_init(const char* scn_name, const char* subscn_name,char* process_name, const char* label = NULL, const char* subscn_lable = NULL)
int NS_SYSADMIN::CProcCommon::proc_init(const char* scn_name, const char* subscn_name,char* process_name, const char* label, const char* subscn_lable)
{
printf("NS_SYSADMIN::CProcCommon::proc_init\n");
return 0;

31
code/dep/run.sh Normal file → Executable file
View File

@@ -1,2 +1,29 @@
pkgadd dotconf#1.0.13-1.pkg.tar.gz
cp ./libman.so /usr/lib64/
#!/bin/bash
#
#*************************************************************
# Author: Wei, Jing
# Mail: jwei@linx-info.com
# Date: 2021-11-30
# FileName: run.sh
# Use: ./run.sh
# Description:
#
#
#*************************************************************
make
if [ `grep -q 42 /etc/issue; echo $?` -eq 0 ]; then
DIR=42
elif [ `grep -q 90 /etc/issue; echo $?` -eq 0 ]; then
DIR=90
else
echo "Failed to install dependency"
exit 1
fi
pushd $DIR
bash run.sh
popd
exit 0

Binary file not shown.

View File

@@ -7,8 +7,8 @@ include $(DEFAULTS)
all:sys_nicmonitor libnic_shm.so test
#CFLAGS += -D TESTINTERVAL -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0 -g
CFLAGS += -I ./include -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0
#CFLAGS += -I ./include -D USER_NUSP -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0
# CFLAGS += -I ./include -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0
CFLAGS += -I ./include -D USER_NUSP -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0
sys_nicmonitor:mnic.o read_netcard.o send_alarm.o
$(CC) $(CFLAGS) -lproc_common -ldotconf -lpthread -o $@ $^

View File

@@ -1,6 +1,12 @@
=======
版本说明:
--V1.22 --
--V2.1 --
2021-11-30
1) 解决bond模式为3时出现段错误问题。
问题描述:网卡监视程序启动过程中存在段错误
问题分析bond模式3由于对bond模块源码进行了修改导致/proc/net/bonding/目录下新增LINXNETHA目录。程序在处理时没有处理目标为目录情况导致出现空指针情况之后在对比字符串strncmp使用空指针从而导致段错误。
解决办法:增加对目录的过滤,当目标为目录时退出线程。
--V2.0 --
2020-07-09
1根本南瑞郭海龙要求进行接口的修改
取消之前libman.so动态库和proc_inv.h头文件改为新的libproc_common.so动态库同时增加include头文件目录

View File

@@ -885,6 +885,19 @@ static void *check_inc_switch(void *ptr)
char error_str[200];
char *str = NULL;
char *retp = NULL;
struct stat filestat;
if(0 != stat(arg->bond_file_path, &filestat)){
snprintf(error_str, sizeof(error_str), "EMERG: %s is not found\n", arg->bond_file_path);
free(ptr);
return NULL;
// pthread_exit((void *)0);
}
if(S_ISDIR(filestat.st_mode)){
snprintf(error_str, sizeof(error_str), "EMERG: Ignore directory %s\n", arg->bond_file_path);
free(ptr);
return NULL;
}
if((fp = fopen(arg->bond_file_path, "r")) == NULL){
snprintf(error_str, sizeof(error_str), "EMERG: fopen():%s\n", strerror(errno));

View File

@@ -1,5 +1,5 @@
// version=2.0
// version=2.1
#ifndef MNIC_VERSION
#define MNIC_VERSION "2.0"
#define MNIC_VERSION "2.1"
#endif