summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ncp.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ppp/ncp.c')
-rw-r--r--usr.sbin/ppp/ncp.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/usr.sbin/ppp/ncp.c b/usr.sbin/ppp/ncp.c
index e1acafb..79a3000 100644
--- a/usr.sbin/ppp/ncp.c
+++ b/usr.sbin/ppp/ncp.c
@@ -89,12 +89,8 @@ static u_short default_urgent_tcp_ports[] = {
544 /* kshell */
};
-static u_short default_urgent_udp_ports[] = { };
-
#define NDEFTCPPORTS \
(sizeof default_urgent_tcp_ports / sizeof default_urgent_tcp_ports[0])
-#define NDEFUDPPORTS \
- (sizeof default_urgent_udp_ports / sizeof default_urgent_udp_ports[0])
void
ncp_Init(struct ncp *ncp, struct bundle *bundle)
@@ -108,11 +104,8 @@ ncp_Init(struct ncp *ncp, struct bundle *bundle)
NDEFTCPPORTS * sizeof(u_short));
ncp->cfg.urgent.tos = 1;
- ncp->cfg.urgent.udp.nports = ncp->cfg.urgent.udp.maxports = NDEFUDPPORTS;
- ncp->cfg.urgent.udp.port = (u_short *)malloc(NDEFUDPPORTS * sizeof(u_short));
- memcpy(ncp->cfg.urgent.udp.port, default_urgent_udp_ports,
- NDEFUDPPORTS * sizeof(u_short));
-
+ ncp->cfg.urgent.udp.nports = ncp->cfg.urgent.udp.maxports = 0;
+ ncp->cfg.urgent.udp.port = NULL;
mp_Init(&ncp->mp, bundle);
@@ -205,7 +198,7 @@ ncp_SetLink(struct ncp *ncp, struct link *l)
* down to the physical link level 'till ncp_FillPhysicalQueues() is used.
*/
void
-ncp_Enqueue(struct ncp *ncp, int af, int pri, char *ptr, int count)
+ncp_Enqueue(struct ncp *ncp, int af, unsigned pri, char *ptr, int count)
{
#ifndef NOINET6
struct ipv6cp *ipv6cp = &ncp->ipv6cp;
@@ -222,8 +215,8 @@ ncp_Enqueue(struct ncp *ncp, int af, int pri, char *ptr, int count)
switch (af) {
case AF_INET:
- if (pri < 0 || pri >= IPCP_QUEUES(ipcp)) {
- log_Printf(LogERROR, "Can't store in ip queue %d\n", pri);
+ if (pri >= IPCP_QUEUES(ipcp)) {
+ log_Printf(LogERROR, "Can't store in ip queue %u\n", pri);
break;
}
@@ -236,8 +229,8 @@ ncp_Enqueue(struct ncp *ncp, int af, int pri, char *ptr, int count)
#ifndef NOINET6
case AF_INET6:
- if (pri < 0 || pri >= IPV6CP_QUEUES(ipcp)) {
- log_Printf(LogERROR, "Can't store in ipv6 queue %d\n", pri);
+ if (pri >= IPV6CP_QUEUES(ipcp)) {
+ log_Printf(LogERROR, "Can't store in ipv6 queue %u\n", pri);
break;
}
@@ -333,7 +326,7 @@ ncp_FillPhysicalQueues(struct ncp *ncp, struct bundle *bundle)
* of what is to be pushed next, coming either from mp->out or ncp->afq.
*/
int
-ncp_PushPacket(struct ncp *ncp, int *af, struct link *l)
+ncp_PushPacket(struct ncp *ncp __unused, int *af, struct link *l)
{
struct bundle *bundle = l->lcp.fsm.bundle;
int res;
@@ -360,7 +353,7 @@ ncp_PushPacket(struct ncp *ncp, int *af, struct link *l)
int
ncp_IsUrgentPort(struct port_range *range, u_short src, u_short dst)
{
- int f;
+ unsigned f;
for (f = 0; f < range->nports; f++)
if (range->port[f] == src || range->port[f] == dst)
@@ -373,7 +366,7 @@ void
ncp_AddUrgentPort(struct port_range *range, u_short port)
{
u_short *newport;
- int p;
+ unsigned p;
if (range->nports == range->maxports) {
range->maxports += 10;
@@ -407,11 +400,11 @@ ncp_AddUrgentPort(struct port_range *range, u_short port)
void
ncp_RemoveUrgentPort(struct port_range *range, u_short port)
{
- int p;
+ unsigned p;
for (p = 0; p < range->nports; p++)
if (range->port[p] == port) {
- if (p != range->nports - 1)
+ if (p + 1 != range->nports)
memmove(range->port + p, range->port + p + 1,
(range->nports - p - 1) * sizeof(u_short));
range->nports--;
@@ -432,7 +425,7 @@ int
ncp_Show(struct cmdargs const *arg)
{
struct ncp *ncp = &arg->bundle->ncp;
- int p;
+ unsigned p;
#ifndef NOINET6
prompt_Printf(arg->prompt, "Next queued AF: %s\n",
OpenPOWER on IntegriCloud