summaryrefslogtreecommitdiffstats
path: root/sys/net/if_gre.c
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2003-12-30 11:41:43 +0000
committersobomax <sobomax@FreeBSD.org>2003-12-30 11:41:43 +0000
commit96159ed2347341c533d77f2f5e0685b70a4be2ed (patch)
tree8f5ead597e01a149ed72cc04b2bcf8c5c862e9b5 /sys/net/if_gre.c
parent3c788abc59ad3ecae3795fc57cc26d1a61261b20 (diff)
downloadFreeBSD-src-96159ed2347341c533d77f2f5e0685b70a4be2ed.zip
FreeBSD-src-96159ed2347341c533d77f2f5e0685b70a4be2ed.tar.gz
Sync with NetBSD:
if_gre.c rev.1.41-1.49 o Spell output with two ts. o Remove assigned-to but not used variable. o fix grammatical error in a diagnostic message. o u_short -> u_int16_t. o gi_len is ip_len, so it has to be network byteorder. if_gre.h rev.1.11-1.13 o prototype must not have variable name. o u_short -> u_int16_t. o Spell address with two d's. ip_gre.c rev.1.22-1.29 o KNF - return is not a function. o The "osrc" variable in gre_mobile_input() is only ever set but not referenced; remove it. o correct (false) assumptions on mbuf chain. not sure if it really helps, but anyways, it is necessary to perform m_pullup. o correct arg to m_pullup (need to count IP header size as well). o remove redundant adjustment of m->m_pkthdr.len. o clear m_flags just for safety. o tabify. o u_short -> u_int16_t. MFC after: 2 weeks
Diffstat (limited to 'sys/net/if_gre.c')
-rw-r--r--sys/net/if_gre.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 9c41e71..47a74a3 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gre.c,v 1.42 2002/08/14 00:23:27 itojun Exp $ */
+/* $NetBSD: if_gre.c,v 1.49 2003/12/11 00:22:29 itojun Exp $ */
/* $FreeBSD$ */
/*
@@ -212,8 +212,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
struct gre_softc *sc = ifp->if_softc;
struct greip *gh;
struct ip *ip;
- u_char osrc;
- u_short etype = 0;
+ u_int16_t etype = 0;
struct mobile_h mob_h;
/*
@@ -237,7 +236,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
gh = NULL;
ip = NULL;
- osrc = 0;
if (ifp->if_bpf) {
u_int32_t af = dst->sa_family;
@@ -282,7 +280,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
msiz = MOB_H_SIZ_L;
}
mob_h.proto = htons(mob_h.proto);
- mob_h.hcrc = gre_in_cksum((u_short *)&mob_h, msiz);
+ mob_h.hcrc = gre_in_cksum((u_int16_t *)&mob_h, msiz);
if ((m->m_data - msiz) < m->m_pktdat) {
/* need new mbuf */
@@ -365,13 +363,14 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
((struct ip*)gh)->ip_ttl = GRE_TTL;
((struct ip*)gh)->ip_tos = ip->ip_tos;
((struct ip*)gh)->ip_id = ip->ip_id;
- gh->gi_len = m->m_pkthdr.len;
+ gh->gi_len = htons(m->m_pkthdr.len);
}
ifp->if_opackets++;
ifp->if_obytes += m->m_pkthdr.len;
/* send it off */
- error = ip_output(m, NULL, &sc->route, 0, NULL, NULL);
+ error = ip_output(m, NULL, &sc->route, 0,
+ (struct ip_moptions *)NULL, (struct inpcb *)NULL);
end:
sc->called = 0;
if (error)
@@ -620,7 +619,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
* which would be taken by ip_output(), as this one will loop back to
* us. If the interface is p2p as a--->b, then a routing entry exists
* If we now send a packet to b (e.g. ping b), this will come down here
- * gets src=a, dst=b tacked on and would from ip_ouput() sent back to
+ * gets src=a, dst=b tacked on and would from ip_output() sent back to
* if_gre.
* Goal here is to compute a route to b that is less specific than
* a-->b. We know that this one exists as in normal operation we have
@@ -656,7 +655,7 @@ gre_compute_route(struct gre_softc *sc)
}
#ifdef DIAGNOSTIC
- printf("%s: searching a route to %s", if_name(&sc->sc_if),
+ printf("%s: searching for a route to %s", if_name(&sc->sc_if),
inet_ntoa(((struct sockaddr_in *)&ro->ro_dst)->sin_addr));
#endif
@@ -696,10 +695,10 @@ gre_compute_route(struct gre_softc *sc)
* do a checksum of a buffer - much like in_cksum, which operates on
* mbufs.
*/
-u_short
-gre_in_cksum(u_short *p, u_int len)
+u_int16_t
+gre_in_cksum(u_int16_t *p, u_int len)
{
- u_int sum = 0;
+ u_int32_t sum = 0;
int nwords = len >> 1;
while (nwords-- != 0)
OpenPOWER on IntegriCloud