mirror of https://github.com/F-Stack/f-stack.git
Fixed #426, F-stack compile error in Red Hat 8.0 with gcc 8.2.1.
This commit is contained in:
parent
ca4eb0b672
commit
b99e7124e8
|
@ -3,7 +3,7 @@
|
|||
If you have a Redhat7.3 EC2 instance,and then execute the following cmds, you will get the F-Stack server in one minute
|
||||
|
||||
sudo -i
|
||||
yum install -y git gcc openssl-devel kernel-devel-$(uname -r) bc numactl-devel mkdir make net-tools vim pciutils iproute pcre-devel zlib-devel
|
||||
yum install -y git gcc openssl-devel kernel-devel-$(uname -r) bc numactl-devel mkdir make net-tools vim pciutils iproute pcre-devel zlib-devel elfutils-libelf-devel vim
|
||||
|
||||
mkdir /data/f-stack
|
||||
git clone https://github.com/F-Stack/f-stack.git /data/f-stack
|
||||
|
|
|
@ -117,8 +117,9 @@ parse_lcore_mask(struct ff_config *cfg, const char *coremask)
|
|||
zero_num = idx >> 2;
|
||||
shift = idx & 0x3;
|
||||
memset(zero,'0',zero_num);
|
||||
sprintf(buf, "%llx%s", (unsigned long long)1<<shift, zero);
|
||||
cfg->dpdk.proc_mask = strdup(buf);
|
||||
snprintf(buf, sizeof(buf) - 1, "%llx%s",
|
||||
(unsigned long long)1<<shift, zero);
|
||||
cfg->dpdk.proc_mask = strdup(buf);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
@ -260,7 +261,7 @@ __parse_config_list(uint16_t *arr, int *sz, const char *value) {
|
|||
int nr_ele = 0;
|
||||
int max_ele = *sz;
|
||||
|
||||
strncpy(input, value, 4096);
|
||||
strncpy(input, value, sizeof(input) - 1);
|
||||
nTokens = rte_strsplit(input, sizeof(input), tokens, 128, ',');
|
||||
for (i = 0; i < nTokens; i++) {
|
||||
char *tok = tokens[i];
|
||||
|
@ -622,7 +623,7 @@ dpdk_args_setup(struct ff_config *cfg)
|
|||
{
|
||||
int n = 0, i;
|
||||
dpdk_argv[n++] = strdup("f-stack");
|
||||
char temp[DPDK_CONFIG_MAXLEN] = {0};
|
||||
char temp[DPDK_CONFIG_MAXLEN] = {0}, temp2[DPDK_CONFIG_MAXLEN] = {0};
|
||||
|
||||
if (cfg->dpdk.no_huge) {
|
||||
dpdk_argv[n++] = strdup("--no-huge");
|
||||
|
@ -654,20 +655,24 @@ dpdk_args_setup(struct ff_config *cfg)
|
|||
cfg->dpdk.vdev_cfgs[i].vdev_id,
|
||||
cfg->dpdk.vdev_cfgs[i].path);
|
||||
if (cfg->dpdk.vdev_cfgs[i].nb_queues) {
|
||||
sprintf(temp, "%s,queues=%u",
|
||||
temp, cfg->dpdk.vdev_cfgs[i].nb_queues);
|
||||
sprintf(temp2, ",queues=%u",
|
||||
cfg->dpdk.vdev_cfgs[i].nb_queues);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
if (cfg->dpdk.vdev_cfgs[i].nb_cq) {
|
||||
sprintf(temp, "%s,cq=%u",
|
||||
temp, cfg->dpdk.vdev_cfgs[i].nb_cq);
|
||||
sprintf(temp2, ",cq=%u",
|
||||
cfg->dpdk.vdev_cfgs[i].nb_cq);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
if (cfg->dpdk.vdev_cfgs[i].queue_size) {
|
||||
sprintf(temp, "%s,queue_size=%u",
|
||||
temp, cfg->dpdk.vdev_cfgs[i].queue_size);
|
||||
sprintf(temp2, ",queue_size=%u",
|
||||
cfg->dpdk.vdev_cfgs[i].queue_size);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
if (cfg->dpdk.vdev_cfgs[i].mac) {
|
||||
sprintf(temp, "%s,mac=%s",
|
||||
temp, cfg->dpdk.vdev_cfgs[i].mac);
|
||||
sprintf(temp2, ",mac=%s",
|
||||
cfg->dpdk.vdev_cfgs[i].mac);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
dpdk_argv[n++] = strdup(temp);
|
||||
}
|
||||
|
@ -687,38 +692,45 @@ dpdk_args_setup(struct ff_config *cfg)
|
|||
cfg->dpdk.bond_cfgs[i].slave);
|
||||
|
||||
if (cfg->dpdk.bond_cfgs[i].primary) {
|
||||
sprintf(temp, "%s,primary=%s",
|
||||
temp, cfg->dpdk.bond_cfgs[i].primary);
|
||||
sprintf(temp2, ",primary=%s",
|
||||
cfg->dpdk.bond_cfgs[i].primary);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
|
||||
if (cfg->dpdk.bond_cfgs[i].socket_id) {
|
||||
sprintf(temp, "%s,socket_id=%d",
|
||||
temp, cfg->dpdk.bond_cfgs[i].socket_id);
|
||||
sprintf(temp2, ",socket_id=%d",
|
||||
cfg->dpdk.bond_cfgs[i].socket_id);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
|
||||
if (cfg->dpdk.bond_cfgs[i].bond_mac) {
|
||||
sprintf(temp, "%s,mac=%s",
|
||||
temp, cfg->dpdk.bond_cfgs[i].bond_mac);
|
||||
sprintf(temp2, ",mac=%s",
|
||||
cfg->dpdk.bond_cfgs[i].bond_mac);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
|
||||
if (cfg->dpdk.bond_cfgs[i].xmit_policy) {
|
||||
sprintf(temp, "%s,xmit_policy=%s",
|
||||
temp, cfg->dpdk.bond_cfgs[i].xmit_policy);
|
||||
sprintf(temp2, ",xmit_policy=%s",
|
||||
cfg->dpdk.bond_cfgs[i].xmit_policy);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
|
||||
if (cfg->dpdk.bond_cfgs[i].lsc_poll_period_ms) {
|
||||
sprintf(temp, "%s,lsc_poll_period_ms=%d",
|
||||
temp, cfg->dpdk.bond_cfgs[i].lsc_poll_period_ms);
|
||||
sprintf(temp2, ",lsc_poll_period_ms=%d",
|
||||
cfg->dpdk.bond_cfgs[i].lsc_poll_period_ms);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
|
||||
if (cfg->dpdk.bond_cfgs[i].up_delay) {
|
||||
sprintf(temp, "%s,up_delay=%d",
|
||||
temp, cfg->dpdk.bond_cfgs[i].up_delay);
|
||||
sprintf(temp2, ",up_delay=%d",
|
||||
cfg->dpdk.bond_cfgs[i].up_delay);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
|
||||
if (cfg->dpdk.bond_cfgs[i].down_delay) {
|
||||
sprintf(temp, "%s,down_delay=%d",
|
||||
temp, cfg->dpdk.bond_cfgs[i].down_delay);
|
||||
sprintf(temp2, ",down_delay=%d",
|
||||
cfg->dpdk.bond_cfgs[i].down_delay);
|
||||
strcat(temp, temp2);
|
||||
}
|
||||
dpdk_argv[n++] = strdup(temp);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ static char* find_chars_or_comment(const char* s, const char* chars)
|
|||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
||||
{
|
||||
strncpy(dest, src, size);
|
||||
strncpy(dest, src, size - 1);
|
||||
dest[size - 1] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue