diff options
author | bz <bz@FreeBSD.org> | 2004-08-03 06:34:55 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2004-08-03 06:34:55 +0000 |
commit | 17a0de77f6eca6203891bb8171c289f0e3f6e955 (patch) | |
tree | fcd551cd9ae2e1f808ef52d3f62e1b1cb8a7177e /sys/netgraph/ng_ppp.c | |
parent | 1209ee91b68ce7425aeda7d951aae83edad94668 (diff) | |
download | FreeBSD-src-17a0de77f6eca6203891bb8171c289f0e3f6e955.zip FreeBSD-src-17a0de77f6eca6203891bb8171c289f0e3f6e955.tar.gz |
Do not change link[n].conf.latency for internal usage but have
link[n].latency calculated from user supplied value.
This prevents repeated NGM_PPP_SET_CONFIG/NGM_PPP_GET_CONFIG
from failing because of link[n].conf.latency being out of range.
Reviewed by: archie
Approved by: pjd (mentor)
Diffstat (limited to 'sys/netgraph/ng_ppp.c')
-rw-r--r-- | sys/netgraph/ng_ppp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c index d70bb94..6a0a8de 100644 --- a/sys/netgraph/ng_ppp.c +++ b/sys/netgraph/ng_ppp.c @@ -185,6 +185,7 @@ struct ng_ppp_link { struct ng_ppp_link_conf conf; /* link configuration */ hook_p hook; /* connection to link data */ int32_t seq; /* highest rec'd seq# - MSEQ */ + u_int32_t latency; /* calculated link latency */ struct timeval lastWrite; /* time of last write */ int bytesInQueue; /* bytes in the output queue */ struct ng_ppp_link_stat stats; /* Link stats */ @@ -1735,7 +1736,7 @@ ng_ppp_mp_strategy(node_p node, int len, int *distrib) /* Start with base latency value */ alink = &priv->links[priv->activeLinks[activeLinkNum]]; - latency[activeLinkNum] = alink->conf.latency; + latency[activeLinkNum] = alink->latency; sortByLatency[activeLinkNum] = activeLinkNum; /* see below */ /* Any additional latency? */ @@ -1910,7 +1911,8 @@ ng_ppp_update(node_p node, int newConf) hdrBytes = (priv->links[i].conf.enableACFComp ? 0 : 2) + (priv->links[i].conf.enableProtoComp ? 1 : 2) + (priv->conf.xmitShortSeq ? 2 : 4); - priv->links[i].conf.latency += + priv->links[i].latency = + priv->links[i].conf.latency + ((hdrBytes * priv->links[i].conf.bandwidth) + 50) / 100; } @@ -1932,7 +1934,7 @@ ng_ppp_update(node_p node, int newConf) link0 = &priv->links[priv->activeLinks[0]]; /* Determine if all links are still equal */ - if (link->conf.latency != link0->conf.latency + if (link->latency != link0->latency || link->conf.bandwidth != link0->conf.bandwidth) priv->allLinksEqual = 0; |