Fix buf: freebsd sysctl config not work.

dev
logwang 2017-09-21 14:57:01 +08:00
parent 3b14d13555
commit 6dbdb4c147
2 changed files with 15 additions and 8 deletions

View File

@ -73,15 +73,14 @@ net.inet.tcp.fast_finwait2_recycle=1
net.inet.tcp.sendspace=16384
net.inet.tcp.recvspace=8192
net.inet.tcp.nolocaltimewait=1
net.inet.tcp.cc.algorithm=htcp
net.inet.tcp.cc.algorithm=cubic
net.inet.tcp.sendbuf_max=16777216
net.inet.tcp.recvbuf_max=16777216
net.inet.tcp.sendbuf_auto=1
net.inet.tcp.recvbuf_auto=1
net.inet.tcp.sendbuf_inc=16384
net.inet.tcp.recvbuf_inc=524288
net.inet.tcp.inflight.enable=0
net.inet.tcp.sack=1
net.inet.tcp.sack.enable=1
net.inet.tcp.blackhole=1
net.inet.tcp.msl=2000
net.inet.tcp.delayed_ack=0

View File

@ -169,10 +169,17 @@ freebsd_conf_handler(struct ff_config *cfg, const char *section,
cur = &cfg->freebsd.sysctl;
if (is_integer(value)) {
int *p = (int *)malloc(sizeof(int));
*p = atoi(value);
newconf->value = (void *)p;
newconf->vlen = sizeof(*p);
if (strcmp(name, "kern.ipc.maxsockbuf") == 0) {
long *p = (long *)malloc(sizeof(long));
*p = atol(value);
newconf->value = (void *)p;
newconf->vlen = sizeof(*p);
} else {
int *p = (int *)malloc(sizeof(int));
*p = atoi(value);
newconf->value = (void *)p;
newconf->vlen = sizeof(*p);
}
} else {
newconf->value = (void *)newconf->str;
newconf->vlen = strlen(value);
@ -183,10 +190,11 @@ freebsd_conf_handler(struct ff_config *cfg, const char *section,
}
if (*cur == NULL) {
newconf->next = NULL;
*cur = newconf;
} else {
newconf->next = (*cur)->next;
(*cur)->next = newconf;
newconf->next = NULL;
}
return 1;