summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gre.c4
-rw-r--r--sys/net/pf.c19
-rw-r--r--sys/net/pf_lb.c18
-rw-r--r--sys/net/pf_osfp.c4
-rw-r--r--sys/net/pipex.c10
5 files changed, 25 insertions, 30 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 9372900b821..93035a15124 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.74 2015/03/14 03:38:51 jsg Exp $ */
+/* $OpenBSD: if_gre.c,v 1.75 2015/07/16 16:12:15 mpi Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -294,7 +294,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
msiz = MOB_H_SIZ_L;
}
- HTONS(mob_h.proto);
+ mob_h.proto = htons(mob_h.proto);
mob_h.hcrc = gre_in_cksum((u_int16_t *) &mob_h, msiz);
/* Squeeze in the mobility header */
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 899dbf712ff..f221ec582e4 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.922 2015/07/08 13:03:26 bluhm Exp $ */
+/* $OpenBSD: pf.c,v 1.923 2015/07/16 16:12:15 mpi Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1747,9 +1747,8 @@ pf_icmp_mapping(struct pf_pdesc *pd, u_int8_t type, int *icmp_dir,
case ICMP_PARAMPROB:
/* These will not be used, but set them anyway */
*icmp_dir = PF_IN;
- *virtual_type = type;
+ *virtual_type = htons(type);
*virtual_id = 0;
- HTONS(*virtual_type);
return (1); /* These types match to another state */
/*
@@ -1834,9 +1833,8 @@ pf_icmp_mapping(struct pf_pdesc *pd, u_int8_t type, int *icmp_dir,
case ICMP6_PARAM_PROB:
/* These will not be used, but set them anyway */
*icmp_dir = PF_IN;
- *virtual_type = type;
+ *virtual_type = htons(type);
*virtual_id = 0;
- HTONS(*virtual_type);
return (1); /* These types match to another state */
/*
* All remaining ICMP6 types get their own states,
@@ -1851,7 +1849,7 @@ pf_icmp_mapping(struct pf_pdesc *pd, u_int8_t type, int *icmp_dir,
break;
#endif /* INET6 */
}
- HTONS(*virtual_type);
+ *virtual_type = htons(*virtual_type);
return (0); /* These types match to their own state */
}
@@ -2388,7 +2386,7 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af,
opt = (char *)(th + 1);
opt[0] = TCPOPT_MAXSEG;
opt[1] = 4;
- HTONS(mss);
+ mss = htons(mss);
memcpy((opt + 2), &mss, 2);
}
@@ -2560,10 +2558,7 @@ pf_match(u_int8_t op, u_int32_t a1, u_int32_t a2, u_int32_t p)
int
pf_match_port(u_int8_t op, u_int16_t a1, u_int16_t a2, u_int16_t p)
{
- NTOHS(a1);
- NTOHS(a2);
- NTOHS(p);
- return (pf_match(op, a1, a2, p));
+ return (pf_match(op, ntohs(a1), ntohs(a2), ntohs(p)));
}
int
@@ -2892,7 +2887,7 @@ pf_get_mss(struct pf_pdesc *pd)
break;
case TCPOPT_MAXSEG:
memcpy(&mss, (opt + 2), 2);
- NTOHS(mss);
+ mss = ntohs(mss);
/* FALLTHROUGH */
default:
optlen = opt[1];
diff --git a/sys/net/pf_lb.c b/sys/net/pf_lb.c
index 914ead8185f..3ce14e84055 100644
--- a/sys/net/pf_lb.c
+++ b/sys/net/pf_lb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_lb.c,v 1.43 2015/06/03 11:57:37 yasuoka Exp $ */
+/* $OpenBSD: pf_lb.c,v 1.44 2015/07/16 16:12:15 mpi Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -726,35 +726,35 @@ pf_get_transaddr_af(struct pf_rule *r, struct pf_pdesc *pd,
if (pd->proto == IPPROTO_ICMPV6 && pd->naf == AF_INET) {
if (pd->dir == PF_IN) {
- NTOHS(pd->ndport);
+ pd->ndport = ntohs(pd->ndport);
if (pd->ndport == ICMP6_ECHO_REQUEST)
pd->ndport = ICMP_ECHO;
else if (pd->ndport == ICMP6_ECHO_REPLY)
pd->ndport = ICMP_ECHOREPLY;
- HTONS(pd->ndport);
+ pd->ndport = htons(pd->ndport);
} else {
- NTOHS(pd->nsport);
+ pd->nsport = ntohs(pd->nsport);
if (pd->nsport == ICMP6_ECHO_REQUEST)
pd->nsport = ICMP_ECHO;
else if (pd->nsport == ICMP6_ECHO_REPLY)
pd->nsport = ICMP_ECHOREPLY;
- HTONS(pd->nsport);
+ pd->nsport = htons(pd->nsport);
}
} else if (pd->proto == IPPROTO_ICMP && pd->naf == AF_INET6) {
if (pd->dir == PF_IN) {
- NTOHS(pd->ndport);
+ pd->ndport = ntohs(pd->ndport);
if (pd->ndport == ICMP_ECHO)
pd->ndport = ICMP6_ECHO_REQUEST;
else if (pd->ndport == ICMP_ECHOREPLY)
pd->ndport = ICMP6_ECHO_REPLY;
- HTONS(pd->ndport);
+ pd->ndport = htons(pd->ndport);
} else {
- NTOHS(pd->nsport);
+ pd->nsport = ntohs(pd->nsport);
if (pd->nsport == ICMP_ECHO)
pd->nsport = ICMP6_ECHO_REQUEST;
else if (pd->nsport == ICMP_ECHOREPLY)
pd->nsport = ICMP6_ECHO_REPLY;
- HTONS(pd->nsport);
+ pd->nsport = htons(pd->nsport);
}
}
diff --git a/sys/net/pf_osfp.c b/sys/net/pf_osfp.c
index 366452be629..5fe6ca587eb 100644
--- a/sys/net/pf_osfp.c
+++ b/sys/net/pf_osfp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_osfp.c,v 1.29 2014/07/22 11:06:10 mpi Exp $ */
+/* $OpenBSD: pf_osfp.c,v 1.30 2015/07/16 16:12:15 mpi Exp $ */
/*
* Copyright (c) 2003 Mike Frantzen <frantzen@w4g.org>
@@ -200,7 +200,7 @@ pf_osfp_fingerprint_hdr(const struct ip *ip, const struct ip6_hdr *ip6,
sizeof(fp.fp_mss));
fp.fp_tcpopts = (fp.fp_tcpopts <<
PF_OSFP_TCPOPT_BITS) | PF_OSFP_TCPOPT_MSS;
- NTOHS(fp.fp_mss);
+ fp.fp_mss = ntohs(fp.fp_mss);
break;
case TCPOPT_WINDOW:
if (optlen >= TCPOLEN_WINDOW)
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 6dd12c581be..411eae25dec 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.71 2015/07/15 22:16:42 deraadt Exp $ */
+/* $OpenBSD: pipex.c,v 1.72 2015/07/16 16:12:15 mpi Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -1356,7 +1356,7 @@ pipex_pppoe_lookup_session(struct mbuf *m0)
m_copydata(m0, sizeof(struct ether_header),
sizeof(struct pipex_pppoe_header), (caddr_t)&pppoe);
- NTOHS(pppoe.session_id);
+ pppoe.session_id = ntohs(pppoe.session_id);
session = pipex_lookup_by_session_id(PIPEX_PROTO_PPPOE,
pppoe.session_id);
#ifdef PIPEX_DEBUG
@@ -1932,7 +1932,7 @@ pipex_l2tp_output(struct mbuf *m0, struct pipex_session *session)
session->proto.l2tp.nr_acked = session->proto.l2tp.nr_nxt - 1;
seq->nr = htons(session->proto.l2tp.nr_acked);
}
- HTONS(l2tp->flagsver);
+ l2tp->flagsver = htons(l2tp->flagsver);
plen += sizeof(struct udphdr);
udp = (struct udphdr *)(mtod(m0, caddr_t) + hlen);
@@ -2608,8 +2608,8 @@ pipex_mppe_output(struct mbuf *m0, struct pipex_session *session,
if (encrypt)
hdr->coher_cnt |= 0x1000;
- HTONS(hdr->protocol);
- HTONS(hdr->coher_cnt);
+ hdr->protocol = htons(hdr->protocol);
+ hdr->coher_cnt = htons(hdr->coher_cnt);
/* encrypt chain */
for (m = m0; m; m = m->m_next) {