From af8f6a21bb77ee1538962d9513190807c9e52e89 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sun, 14 Nov 1982 07:11:41 -0800 Subject: [PATCH] merge 4.1b with 4.1c SCCS-vsn: sys/netinet/in.c 4.11 SCCS-vsn: sys/netinet/ip_icmp.c 4.25 SCCS-vsn: sys/netinet/ip_var.h 4.6 SCCS-vsn: sys/netinet/tcp_subr.c 4.35 --- usr/src/sys/netinet/in.c | 4 +--- usr/src/sys/netinet/ip_icmp.c | 19 ++++++++++--------- usr/src/sys/netinet/ip_var.h | 4 +++- usr/src/sys/netinet/tcp_subr.c | 6 +++--- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/usr/src/sys/netinet/in.c b/usr/src/sys/netinet/in.c index 18b89a6f07..74108f6078 100644 --- a/usr/src/sys/netinet/in.c +++ b/usr/src/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* in.c 4.10 82/10/30 */ +/* in.c 4.11 82/11/13 */ #include "../h/param.h" #include "../h/mbuf.h" @@ -64,7 +64,6 @@ in_netof(in) return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); } -#ifdef notdef /* * Return the host portion of an internet address. */ @@ -80,7 +79,6 @@ in_lnaof(in) else return ((i)&IN_CLASSC_HOST); } -#endif /* * Initialize an interface's routing diff --git a/usr/src/sys/netinet/ip_icmp.c b/usr/src/sys/netinet/ip_icmp.c index 028f9d9014..7f11fa979b 100644 --- a/usr/src/sys/netinet/ip_icmp.c +++ b/usr/src/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* ip_icmp.c 4.25 82/11/05 */ +/* ip_icmp.c 4.25 82/11/13 */ #include "../h/param.h" #include "../h/systm.h" @@ -104,7 +104,8 @@ icmp_input(m) { register struct icmp *icp; register struct ip *ip = mtod(m, struct ip *); - int icmplen = ip->ip_len, hlen = ip->ip_hl << 2, i, (*ctlfunc)(); + int icmplen = ip->ip_len, hlen = ip->ip_hl << 2; + int i, (*ctlfunc)(), type; extern u_char ip_protox[]; /* @@ -148,8 +149,9 @@ icmp_input(m) goto free; if (icmpprintfs) printf("deliver to protocol %d\n", icp->icmp_ip.ip_p); + type = i == ICMP_PARAMPROB ? 0 : icp->icmp_code; if (ctlfunc = inetsw[ip_protox[icp->icmp_ip.ip_p]].pr_ctlinput) - (*ctlfunc)(icmpmap[i] + icp->icmp_code, (caddr_t)icp); + (*ctlfunc)(icmpmap[i] + type, (caddr_t)icp); goto free; case ICMP_ECHO: @@ -184,6 +186,7 @@ icmp_input(m) } reflect: icmp_reflect(ip); + return; free: m_freem(dtom(ip)); } @@ -203,8 +206,6 @@ icmp_reflect(ip) icmp_send(ip); } -int generateicmpmsgs = 1; - /* * Send an icmp packet back to the ip level, * after supplying a checksum. @@ -212,12 +213,12 @@ int generateicmpmsgs = 1; icmp_send(ip) struct ip *ip; { - register int hlen = ip->ip_hl << 2; + register int hlen; register struct icmp *icp; - register struct mbuf *m = dtom(ip); + register struct mbuf *m; - if (!generateicmpmsgs) - return; + m = dtom(ip); + hlen = ip->ip_hl << 2; icp = mtod(m, struct icmp *); icp->icmp_cksum = 0; icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen); diff --git a/usr/src/sys/netinet/ip_var.h b/usr/src/sys/netinet/ip_var.h index 337a18a0ca..e33ba2d844 100644 --- a/usr/src/sys/netinet/ip_var.h +++ b/usr/src/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* ip_var.h 4.5 81/12/02 */ +/* ip_var.h 4.6 82/11/13 */ /* * Overlay for ip header used by other protocols (tcp, udp). @@ -30,6 +30,8 @@ struct ipq { /* * Ip header, when holding a fragment. + * + * Note: ipf_next must be at same offset as ipq_next above */ struct ipasfrag { u_char ip_hl:4, diff --git a/usr/src/sys/netinet/tcp_subr.c b/usr/src/sys/netinet/tcp_subr.c index f3b7542d9d..ff1d606034 100644 --- a/usr/src/sys/netinet/tcp_subr.c +++ b/usr/src/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* tcp_subr.c 4.34 82/10/30 */ +/* tcp_subr.c 4.35 82/11/13 */ #include "../h/param.h" #include "../h/systm.h" @@ -123,13 +123,13 @@ tcp_respond(tp, ti, ack, seq, flags) } ti->ti_next = ti->ti_prev = 0; ti->ti_x1 = 0; - ti->ti_len = htons(sizeof (struct tcphdr) + tlen); + ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + tlen)); ti->ti_seq = htonl(seq); ti->ti_ack = htonl(ack); ti->ti_x2 = 0; ti->ti_off = sizeof (struct tcphdr) >> 2; ti->ti_flags = flags; - ti->ti_win = htons(win); + ti->ti_win = htons((u_short)win); ti->ti_urp = 0; ti->ti_sum = in_cksum(m, sizeof (struct tcpiphdr) + tlen); ((struct ip *)ti)->ip_len = sizeof (struct tcpiphdr) + tlen; -- 2.20.1