netinet prototypes

This commit is contained in:
christos 1996-02-13 23:40:59 +00:00
parent 6de3d0fb2e
commit 14d9cd33af
31 changed files with 471 additions and 203 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.20 1995/06/12 00:47:27 mycroft Exp $ */
/* $NetBSD: if_ether.h,v 1.21 1996/02/13 23:41:17 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -231,3 +231,21 @@ struct ether_multistep {
(step).e_enm = (ac)->ac_multiaddrs.lh_first; \
ETHER_NEXT_MULTI((step), (enm)); \
}
#ifdef _KERNEL
void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
void arpwhohas __P((struct arpcom *, struct in_addr *));
int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *));
void arpintr __P((void));
int arpioctl __P((u_long, caddr_t));
void arp_ifinit __P((struct arpcom *, struct ifaddr *));
void revarpinput __P((struct mbuf *));
void in_revarpinput __P((struct mbuf *));
void revarprequest __P((struct ifnet *));
int revarpwhoarewe __P((struct ifnet *, struct in_addr *, struct in_addr *));
int revarpwhoami __P((struct in_addr *, struct ifnet *));
int db_show_arptab __P((void));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arp.c,v 1.27 1995/08/12 23:59:29 mycroft Exp $ */
/* $NetBSD: if_arp.c,v 1.28 1996/02/13 23:40:59 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -53,6 +53,7 @@
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/proc.h>
#include <net/if.h>
#include <net/if_dl.h>
@ -101,6 +102,19 @@ static int myip_initialized = 0;
static int revarp_in_progress = 0;
static struct ifnet *myip_ifp = NULL;
static void arptimer __P((void *));
static void arprequest __P((struct arpcom *, u_int32_t *, u_int32_t *,
u_int8_t *));
static void in_arpinput __P((struct mbuf *));
static void arptfree __P((struct llinfo_arp *));
static struct llinfo_arp *arplookup __P((u_int32_t, int, int ));
#ifdef DDB
static void db_print_sa __P((struct sockaddr *));
static void db_print_ifa __P((struct ifaddr *));
static void db_print_llinfo __P((caddr_t));
static int db_show_radix_node __P((struct radix_node *, void *));
#endif
/*
* Timeout routine. Age arp_tab entries periodically.
*/
@ -330,7 +344,7 @@ arpresolve(ac, rt, m, dst, desten)
if (rt)
la = (struct llinfo_arp *)rt->rt_llinfo;
else {
if (la = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0))
if ((la = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0)) != NULL)
rt = la->la_rt;
}
if (la == 0 || rt == 0) {
@ -615,7 +629,6 @@ revarpinput(m)
struct mbuf *m;
{
struct arphdr *ar;
int op, s;
if (m->m_len < sizeof(struct arphdr))
goto out;
@ -649,12 +662,13 @@ out:
*
* Note: also supports ARP via RARP packets, per the RFC.
*/
void
in_revarpinput(m)
struct mbuf *m;
{
struct ifnet *ifp;
struct ether_arp *ar;
int op, s;
int op;
ar = mtod(m, struct ether_arp *);
op = ntohs(ar->arp_op);
@ -773,6 +787,10 @@ revarpwhoami(in, ifp)
#ifdef DDB
#include <machine/db_machdep.h>
#include <ddb/db_interface.h>
#include <ddb/db_output.h>
static void
db_print_sa(sa)
struct sockaddr *sa;
@ -868,6 +886,7 @@ db_show_radix_node(rn, w)
* Function to print all the route trees.
* Use this from ddb: "call db_show_arptab"
*/
int
db_show_arptab()
{
struct radix_node_head *rnh;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arp.h,v 1.20 1995/06/12 00:47:27 mycroft Exp $ */
/* $NetBSD: if_arp.h,v 1.21 1996/02/13 23:41:17 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -231,3 +231,21 @@ struct ether_multistep {
(step).e_enm = (ac)->ac_multiaddrs.lh_first; \
ETHER_NEXT_MULTI((step), (enm)); \
}
#ifdef _KERNEL
void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
void arpwhohas __P((struct arpcom *, struct in_addr *));
int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *));
void arpintr __P((void));
int arpioctl __P((u_long, caddr_t));
void arp_ifinit __P((struct arpcom *, struct ifaddr *));
void revarpinput __P((struct mbuf *));
void in_revarpinput __P((struct mbuf *));
void revarprequest __P((struct ifnet *));
int revarpwhoarewe __P((struct ifnet *, struct in_addr *, struct in_addr *));
int revarpwhoami __P((struct in_addr *, struct ifnet *));
int db_show_arptab __P((void));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.c,v 1.27 1995/08/12 23:59:29 mycroft Exp $ */
/* $NetBSD: if_ether.c,v 1.28 1996/02/13 23:40:59 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -53,6 +53,7 @@
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/proc.h>
#include <net/if.h>
#include <net/if_dl.h>
@ -101,6 +102,19 @@ static int myip_initialized = 0;
static int revarp_in_progress = 0;
static struct ifnet *myip_ifp = NULL;
static void arptimer __P((void *));
static void arprequest __P((struct arpcom *, u_int32_t *, u_int32_t *,
u_int8_t *));
static void in_arpinput __P((struct mbuf *));
static void arptfree __P((struct llinfo_arp *));
static struct llinfo_arp *arplookup __P((u_int32_t, int, int ));
#ifdef DDB
static void db_print_sa __P((struct sockaddr *));
static void db_print_ifa __P((struct ifaddr *));
static void db_print_llinfo __P((caddr_t));
static int db_show_radix_node __P((struct radix_node *, void *));
#endif
/*
* Timeout routine. Age arp_tab entries periodically.
*/
@ -330,7 +344,7 @@ arpresolve(ac, rt, m, dst, desten)
if (rt)
la = (struct llinfo_arp *)rt->rt_llinfo;
else {
if (la = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0))
if ((la = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0)) != NULL)
rt = la->la_rt;
}
if (la == 0 || rt == 0) {
@ -615,7 +629,6 @@ revarpinput(m)
struct mbuf *m;
{
struct arphdr *ar;
int op, s;
if (m->m_len < sizeof(struct arphdr))
goto out;
@ -649,12 +662,13 @@ out:
*
* Note: also supports ARP via RARP packets, per the RFC.
*/
void
in_revarpinput(m)
struct mbuf *m;
{
struct ifnet *ifp;
struct ether_arp *ar;
int op, s;
int op;
ar = mtod(m, struct ether_arp *);
op = ntohs(ar->arp_op);
@ -773,6 +787,10 @@ revarpwhoami(in, ifp)
#ifdef DDB
#include <machine/db_machdep.h>
#include <ddb/db_interface.h>
#include <ddb/db_output.h>
static void
db_print_sa(sa)
struct sockaddr *sa;
@ -868,6 +886,7 @@ db_show_radix_node(rn, w)
* Function to print all the route trees.
* Use this from ddb: "call db_show_arptab"
*/
int
db_show_arptab()
{
struct radix_node_head *rnh;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.20 1995/06/12 00:47:27 mycroft Exp $ */
/* $NetBSD: if_ether.h,v 1.21 1996/02/13 23:41:17 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -231,3 +231,21 @@ struct ether_multistep {
(step).e_enm = (ac)->ac_multiaddrs.lh_first; \
ETHER_NEXT_MULTI((step), (enm)); \
}
#ifdef _KERNEL
void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
void arpwhohas __P((struct arpcom *, struct in_addr *));
int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *));
void arpintr __P((void));
int arpioctl __P((u_long, caddr_t));
void arp_ifinit __P((struct arpcom *, struct ifaddr *));
void revarpinput __P((struct mbuf *));
void in_revarpinput __P((struct mbuf *));
void revarprequest __P((struct ifnet *));
int revarpwhoarewe __P((struct ifnet *, struct in_addr *, struct in_addr *));
int revarpwhoami __P((struct in_addr *, struct ifnet *));
int db_show_arptab __P((void));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_inarp.h,v 1.20 1995/06/12 00:47:27 mycroft Exp $ */
/* $NetBSD: if_inarp.h,v 1.21 1996/02/13 23:41:17 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -231,3 +231,21 @@ struct ether_multistep {
(step).e_enm = (ac)->ac_multiaddrs.lh_first; \
ETHER_NEXT_MULTI((step), (enm)); \
}
#ifdef _KERNEL
void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
void arpwhohas __P((struct arpcom *, struct in_addr *));
int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *));
void arpintr __P((void));
int arpioctl __P((u_long, caddr_t));
void arp_ifinit __P((struct arpcom *, struct ifaddr *));
void revarpinput __P((struct mbuf *));
void in_revarpinput __P((struct mbuf *));
void revarprequest __P((struct ifnet *));
int revarpwhoarewe __P((struct ifnet *, struct in_addr *, struct in_addr *));
int revarpwhoami __P((struct in_addr *, struct ifnet *));
int db_show_arptab __P((void));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp.c,v 1.14 1995/08/12 23:59:31 mycroft Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
* Internet Group Management Protocol (IGMP) routines.
@ -14,6 +14,7 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/systm.h>
#include <net/if.h>
#include <net/route.h>
@ -26,12 +27,16 @@
#include <netinet/igmp.h>
#include <netinet/igmp_var.h>
#include <machine/stdarg.h>
#define IP_MULTICASTOPTS 0
int igmp_timers_are_running;
static struct router_info *rti_head;
void igmp_sendpkt __P((struct in_multi *, int));
static int rti_fill __P((struct in_multi *));
static struct router_info * rti_find __P((struct ifnet *));
void
igmp_init()
@ -91,10 +96,15 @@ rti_find(ifp)
}
void
igmp_input(m, iphlen)
register struct mbuf *m;
register int iphlen;
#if __STDC__
igmp_input(struct mbuf *m, ...)
#else
igmp_input(m, va_alist)
struct mbuf *m;
va_dcl
#endif
{
register int iphlen;
register struct ifnet *ifp = m->m_pkthdr.rcvif;
register struct ip *ip = mtod(m, struct ip *);
register struct igmp *igmp;
@ -105,6 +115,11 @@ igmp_input(m, iphlen)
struct router_info *rti;
register struct in_ifaddr *ia;
int timer;
va_list ap;
va_start(ap, m);
iphlen = va_arg(ap, int);
va_end(ap);
++igmpstat.igps_rcv_total;

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp_var.h,v 1.8 1995/05/31 06:08:24 mycroft Exp $ */
/* $NetBSD: igmp_var.h,v 1.9 1996/02/13 23:41:31 christos Exp $ */
/*
* Copyright (c) 1988 Stephen Deering.
@ -73,7 +73,7 @@ struct igmpstat igmpstat;
#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1)
void igmp_init __P((void));
void igmp_input __P((struct mbuf *, int));
void igmp_input __P((struct mbuf *, ...));
void igmp_joingroup __P((struct in_multi *));
void igmp_leavegroup __P((struct in_multi *));
void igmp_fasttimo __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: in.c,v 1.25 1995/08/12 23:59:32 mycroft Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
@ -41,6 +41,7 @@
#include <sys/malloc.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/systm.h>
#include <net/if.h>
#include <net/route.h>
@ -50,6 +51,7 @@
#include <netinet/in_var.h>
#include <netinet/if_ether.h>
#include <netinet/ip_mroute.h>
#include <netinet/igmp_var.h>
#include "ether.h"
@ -138,7 +140,6 @@ in_control(so, cmd, data, ifp)
{
register struct ifreq *ifr = (struct ifreq *)data;
register struct in_ifaddr *ia = 0;
register struct ifaddr *ifa;
struct in_aliasreq *ifra = (struct in_aliasreq *)data;
struct sockaddr_in oldaddr;
int error, hostIsNew, maskIsNew;
@ -348,7 +349,7 @@ in_ifinit(ifp, ia, sin, scrub)
{
register u_int32_t i = sin->sin_addr.s_addr;
struct sockaddr_in oldaddr;
int s = splimp(), flags = RTF_UP, error, ether_output();
int s = splimp(), flags = RTF_UP, error;
oldaddr = ia->ia_addr;
ia->ia_addr = *sin;
@ -525,7 +526,7 @@ in_addmulti(ap, ifp)
/*
* Delete a multicast address record.
*/
int
void
in_delmulti(inm)
register struct in_multi *inm;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: in.h,v 1.19 1996/01/16 04:17:30 thorpej Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -91,7 +91,7 @@ struct in_addr {
* on these macros not doing byte-swapping.
*/
#ifdef _KERNEL
#define __IPADDR(x) htonl((u_int32_t)(x))
#define __IPADDR(x) ((u_int32_t) htonl((u_int32_t)(x)))
#else
#define __IPADDR(x) ((u_int32_t)(x))
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_pcb.c,v 1.24 1996/01/31 03:49:23 mycroft Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
@ -74,10 +74,11 @@ in_pcbinit(table, hashsize)
}
int
in_pcballoc(so, table)
in_pcballoc(so, v)
struct socket *so;
struct inpcbtable *table;
void *v;
{
struct inpcbtable *table = v;
register struct inpcb *inp;
int s;
@ -97,10 +98,11 @@ in_pcballoc(so, table)
}
int
in_pcbbind(inp, nam)
register struct inpcb *inp;
in_pcbbind(v, nam)
register void *v;
struct mbuf *nam;
{
register struct inpcb *inp = v;
register struct socket *so = inp->inp_socket;
register struct inpcbtable *table = inp->inp_table;
register struct sockaddr_in *sin;
@ -179,12 +181,13 @@ in_pcbbind(inp, nam)
* then pick one.
*/
int
in_pcbconnect(inp, nam)
register struct inpcb *inp;
in_pcbconnect(v, nam)
register void *v;
struct mbuf *nam;
{
register struct inpcb *inp = v;
struct in_ifaddr *ia;
struct sockaddr_in *ifaddr;
struct sockaddr_in *ifaddr = NULL;
register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
if (nam->m_len != sizeof (*sin))
@ -291,10 +294,11 @@ in_pcbconnect(inp, nam)
return (0);
}
int
in_pcbdisconnect(inp)
struct inpcb *inp;
void
in_pcbdisconnect(v)
void *v;
{
struct inpcb *inp = v;
inp->inp_faddr.s_addr = INADDR_ANY;
inp->inp_fport = 0;
@ -303,10 +307,11 @@ in_pcbdisconnect(inp)
in_pcbdetach(inp);
}
int
in_pcbdetach(inp)
struct inpcb *inp;
void
in_pcbdetach(v)
void *v;
{
struct inpcb *inp = v;
struct socket *so = inp->inp_socket;
int s;
@ -324,7 +329,7 @@ in_pcbdetach(inp)
FREE(inp, M_PCB);
}
int
void
in_setsockaddr(inp, nam)
register struct inpcb *inp;
struct mbuf *nam;
@ -340,7 +345,7 @@ in_setsockaddr(inp, nam)
sin->sin_addr = inp->inp_laddr;
}
int
void
in_setpeeraddr(inp, nam)
struct inpcb *inp;
struct mbuf *nam;
@ -439,7 +444,7 @@ in_pcbnotifyall(table, dst, errno, notify)
* routing information. If the route was created dynamically
* (by a redirect), time to try a default gateway again.
*/
int
void
in_losing(inp)
struct inpcb *inp;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_pcb.h,v 1.13 1996/01/31 03:49:30 mycroft Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -81,15 +81,15 @@ struct inpcbtable {
#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
#ifdef _KERNEL
int in_losing __P((struct inpcb *));
int in_pcballoc __P((struct socket *, struct inpcbtable *));
int in_pcbbind __P((struct inpcb *, struct mbuf *));
int in_pcbconnect __P((struct inpcb *, struct mbuf *));
int in_pcbdetach __P((struct inpcb *));
int in_pcbdisconnect __P((struct inpcb *));
void in_losing __P((struct inpcb *));
int in_pcballoc __P((struct socket *, void *));
int in_pcbbind __P((void *, struct mbuf *));
int in_pcbconnect __P((void *, struct mbuf *));
void in_pcbdetach __P((void *));
void in_pcbdisconnect __P((void *));
struct inpcb *
in_pcbhashlookup __P((struct inpcbtable *,
struct in_addr, u_int, struct in_addr, u_int));
in_pcbhashlookup __P((struct inpcbtable *, struct in_addr,
u_int, struct in_addr, u_int));
void in_pcbinit __P((struct inpcbtable *, int));
struct inpcb *
in_pcblookup __P((struct inpcbtable *,
@ -100,6 +100,6 @@ void in_pcbnotifyall __P((struct inpcbtable *, struct sockaddr *,
int, void (*)(struct inpcb *, int)));
void in_pcbrehash __P((struct inpcb *));
void in_rtchange __P((struct inpcb *, int));
int in_setpeeraddr __P((struct inpcb *, struct mbuf *));
int in_setsockaddr __P((struct inpcb *, struct mbuf *));
void in_setpeeraddr __P((struct inpcb *, struct mbuf *));
void in_setsockaddr __P((struct inpcb *, struct mbuf *));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_proto.c,v 1.12 1995/09/30 07:02:00 thorpej Exp $ */
/* $NetBSD: in_proto.c,v 1.13 1996/02/13 23:42:09 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -66,20 +66,21 @@
*/
#ifdef NSIP
void idpip_input(), nsip_ctlinput();
#include <netns/ns_var.h>
#include <netns/idp_var.h>
#endif /* NSIP */
#ifdef TPIP
void tpip_input(), tpip_ctlinput(), tp_init(), tp_slowtimo(), tp_drain();
int tp_ctloutput(), tp_usrreq();
#include <netiso/tp_param.h>
#include <netiso/tp_var.h>
#endif /* TPIP */
#ifdef EON
void eoninput(), eonctlinput(), eonprotoinit();
#include <netiso/eonvar.h>
#endif /* EON */
#ifdef MROUTING
void ipip_input();
#include <netinet/mroute.h>
#endif /* MROUTING */
extern struct domain inetdomain;

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_var.h,v 1.15 1995/06/12 00:47:37 mycroft Exp $ */
/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
/*
* Copyright (c) 1985, 1986, 1993
@ -208,7 +208,7 @@ struct in_multistep {
int in_ifinit __P((struct ifnet *,
struct in_ifaddr *, struct sockaddr_in *, int));
struct in_multi *in_addmulti __P((struct in_addr *, struct ifnet *));
int in_delmulti __P((struct in_multi *));
void in_delmulti __P((struct in_multi *));
void in_ifscrub __P((struct ifnet *, struct in_ifaddr *));
int in_control __P((struct socket *, u_long, caddr_t, struct ifnet *));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_icmp.c,v 1.18 1995/06/12 00:47:39 mycroft Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -43,6 +43,10 @@
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <vm/vm.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/route.h>
@ -52,8 +56,11 @@
#include <netinet/in_var.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/ip_var.h>
#include <netinet/icmp_var.h>
#include <machine/stdarg.h>
/*
* ICMP routines: error generation, receive packet processing, and
* routines to turnaround packets back to the originator, and
@ -172,18 +179,28 @@ struct sockaddr_in icmpmask = { 8, 0 };
* Process a received ICMP message.
*/
void
icmp_input(m, hlen)
register struct mbuf *m;
int hlen;
#if __STDC__
icmp_input(struct mbuf *m, ...)
#else
icmp_input(m, va_alist)
struct mbuf *m;
va_dcl
#endif
{
register struct icmp *icp;
register struct ip *ip = mtod(m, struct ip *);
int icmplen = ip->ip_len;
register int i;
struct in_ifaddr *ia;
void (*ctlfunc) __P((int, struct sockaddr *, struct ip *));
void *(*ctlfunc) __P((int, struct sockaddr *, void *));
int code;
extern u_char ip_protox[];
int hlen;
va_list ap;
va_start(ap, m);
hlen = va_arg(ap, int);
va_end(ap);
/*
* Locate icmp structure in mbuf, and check
@ -294,7 +311,8 @@ icmp_input(m, hlen)
printf("deliver to protocol %d\n", icp->icmp_ip.ip_p);
#endif
icmpsrc.sin_addr = icp->icmp_ip.ip_dst;
if (ctlfunc = inetsw[ip_protox[icp->icmp_ip.ip_p]].pr_ctlinput)
ctlfunc = inetsw[ip_protox[icp->icmp_ip.ip_p]].pr_ctlinput;
if (ctlfunc)
(*ctlfunc)(code, sintosa(&icmpsrc), &icp->icmp_ip);
break;
@ -410,7 +428,7 @@ icmp_reflect(m)
register struct ip *ip = mtod(m, struct ip *);
register struct in_ifaddr *ia;
struct in_addr t;
struct mbuf *opts = 0, *ip_srcroute();
struct mbuf *opts = 0;
int optlen = (ip->ip_hl << 2) - sizeof(struct ip);
if (!in_canforward(ip->ip_src) &&
@ -491,7 +509,7 @@ icmp_reflect(m)
}
}
/* Terminate & pad, if necessary */
if (cnt = opts->m_len % 4) {
if ((cnt = opts->m_len % 4) != 0) {
for (; cnt < 4; cnt++) {
*(mtod(opts, caddr_t) + opts->m_len) =
IPOPT_EOL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_icmp.h,v 1.9 1995/04/17 05:32:57 cgd Exp $ */
/* $NetBSD: ip_icmp.h,v 1.10 1996/02/13 23:42:28 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -155,7 +155,7 @@ struct icmp {
#ifdef _KERNEL
void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *));
void icmp_input __P((struct mbuf *, int));
void icmp_input __P((struct mbuf *, ...));
void icmp_reflect __P((struct mbuf *));
void icmp_send __P((struct mbuf *, struct mbuf *));
int icmp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.27 1996/01/16 04:17:37 thorpej Exp $ */
/* $NetBSD: ip_input.c,v 1.28 1996/02/13 23:42:37 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -45,6 +45,10 @@
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <vm/vm.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/route.h>
@ -199,7 +203,7 @@ next:
}
ip = mtod(m, struct ip *);
}
if (ip->ip_sum = in_cksum(m, hlen)) {
if ((ip->ip_sum = in_cksum(m, hlen)) != 0) {
ipstat.ips_badsum++;
goto bad;
}
@ -1004,7 +1008,7 @@ ip_forward(m, srcrt)
register struct ip *ip = mtod(m, struct ip *);
register struct sockaddr_in *sin;
register struct rtentry *rt;
int error, type = 0, code;
int error, type = 0, code = 0;
struct mbuf *mcopy;
n_long dest;
struct ifnet *destifp;
@ -1012,8 +1016,8 @@ ip_forward(m, srcrt)
dest = 0;
#ifdef DIAGNOSTIC
if (ipprintfs)
printf("forward: src %x dst %x ttl %x\n", ip->ip_src,
ip->ip_dst, ip->ip_ttl);
printf("forward: src %x dst %x ttl %x\n",
ip->ip_src.s_addr, ip->ip_dst.s_addr, ip->ip_ttl);
#endif
if (m->m_flags & M_BCAST || in_canforward(ip->ip_dst) == 0) {
ipstat.ips_cantforward++;
@ -1139,8 +1143,6 @@ ip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
void *newp;
size_t newlen;
{
int temp;
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return (ENOTDIR);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_mroute.c,v 1.24 1995/08/12 23:59:38 mycroft Exp $ */
/* $NetBSD: ip_mroute.c,v 1.25 1996/02/13 23:42:46 christos Exp $ */
/*
* IP multicast forwarding procedures
@ -39,6 +39,8 @@
#include <netinet/igmp_var.h>
#include <netinet/ip_mroute.h>
#include <machine/stdarg.h>
#define IP_MULTICASTOPTS 0
#define M_PULLUP(m, len) \
do { \
@ -46,10 +48,6 @@
(m) = m_pullup((m), (len)); \
} while (0)
static int ip_mdq();
static void phyint_send();
static void encap_send();
/*
* Globals. All but ip_mrouter and ip_mrtproto could be static,
* except for netstat or debugging purposes.
@ -81,7 +79,6 @@ extern struct socket *ip_rsvpd;
extern int rsvp_on;
#endif /* RSVP_ISI */
static void expire_upcalls();
#define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */
#define UPCALL_EXPIRE 6 /* number of timeouts */
@ -92,16 +89,41 @@ static void expire_upcalls();
struct pkt_queue qtable[MAXVIFS][MAXQSIZE];
static void tbf_control __P((struct vif *, struct mbuf *, struct ip *,
u_int32_t));
static void tbf_queue __P((struct vif *, struct mbuf *, struct ip *));
static void tbf_dequeue __P((struct vif *, int));
static void tbf_process_q __P((struct vif *));
static void tbf_reprocess_q __P((void *));
static int tbf_dq_sel __P((struct vif *, struct ip *));
static void tbf_send_packet __P((struct vif *, struct mbuf *));
static void tbf_update_tokens __P((struct vif *));
static int priority __P((struct vif *, struct ip *));
static int get_sg_cnt __P((struct sioc_sg_req *));
static int get_vif_cnt __P((struct sioc_vif_req *));
static int ip_mrouter_init __P((struct socket *, struct mbuf *));
static int get_version __P((struct mbuf *));
static int set_assert __P((struct mbuf *));
static int get_assert __P((struct mbuf *));
static int add_vif __P((struct mbuf *));
static int del_vif __P((struct mbuf *));
static void update_mfc __P((struct mfcctl *, struct mfc *));
static void expire_mfc __P((struct mfc *));
static int add_mfc __P((struct mbuf *));
#ifdef UPCALL_TIMING
static void collate __P((struct timeval *));
#endif
static int del_mfc __P((struct mbuf *));
static int socket_send __P((struct socket *, struct mbuf *,
struct sockaddr_in *));
static void expire_upcalls __P((void *));
#ifdef RSVP_ISI
static int ip_mdq __P((struct mbuf *, struct ifnet *, struct mfc *, vifi_t));
#else
static int ip_mdq __P((struct mbuf *, struct ifnet *, struct mfc *));
#endif
static void phyint_send __P((struct ip *, struct vif *, struct mbuf *));
static void encap_send __P((struct ip *, struct vif *, struct mbuf *));
static void tbf_control __P((struct vif *, struct mbuf *, struct ip *,
u_int32_t));
static void tbf_queue __P((struct vif *, struct mbuf *, struct ip *));
static void tbf_process_q __P((struct vif *));
static void tbf_dequeue __P((struct vif *, int));
static void tbf_reprocess_q __P((void *));
static int tbf_dq_sel __P((struct vif *, struct ip *));
static void tbf_send_packet __P((struct vif *, struct mbuf *));
static void tbf_update_tokens __P((struct vif *));
static int priority __P((struct vif *, struct ip *));
/*
* 'Interfaces' associated with decapsulator (so we can tell
@ -202,23 +224,8 @@ static int pim_assert;
#ifdef UPCALL_TIMING
u_int32_t upcall_data[51];
static void collate __P((struct timeval *));
#endif /* UPCALL_TIMING */
static int get_sg_cnt __P((struct sioc_sg_req *));
static int get_vif_cnt __P((struct sioc_vif_req *));
static int ip_mrouter_init __P((struct socket *, struct mbuf *));
static int get_version __P((struct mbuf *));
static int set_assert __P((struct mbuf *));
static int get_assert __P((struct mbuf *));
static int add_vif __P((struct mbuf *));
static void reset_vif __P((struct vif *));
static int del_vif __P((struct mbuf *));
static void update_mfc __P((struct mfcctl *, struct mfc *));
static void expire_mfc __P((struct mfc *));
static int add_mfc __P((struct mbuf *));
static int del_mfc __P((struct mbuf *));
/*
* Handle MRT setsockopt commands to modify the multicast routing tables.
*/
@ -718,9 +725,8 @@ add_mfc(m)
struct mbuf *m;
{
struct mfcctl *mfccp;
struct mfc *rt, *rt1;
u_int32_t hash;
vifi_t vifi;
struct mfc *rt;
u_int32_t hash = 0;
struct rtdetq *rte, *nrte;
register u_short nstl;
int s;
@ -931,13 +937,12 @@ ip_mforward(m, ifp)
{
register struct ip *ip = mtod(m, struct ip *);
register struct mfc *rt;
register struct vif *vifp;
register u_char *ipoptions;
static struct sockproto k_igmpproto = { AF_INET, IPPROTO_IGMP };
static int srctun = 0;
register struct mbuf *mm, *mn;
register struct mbuf *mm;
int s;
#ifdef RSVP_ISI
register struct vif *vifp;
vifi_t vifi;
#endif /* RSVP_ISI */
@ -1146,8 +1151,10 @@ ip_mforward(m, ifp)
}
/*ARGSUSED*/
static void
expire_upcalls()
expire_upcalls(v)
void *v;
{
int i;
int s;
@ -1202,7 +1209,6 @@ ip_mdq(m, ifp, rt)
register struct ip *ip = mtod(m, struct ip *);
register vifi_t vifi;
register struct vif *vifp;
register struct mbuf *tmp;
register int plen = ntohs(ip->ip_len);
/*
@ -1420,14 +1426,24 @@ encap_send(ip, vifp, m)
* ENCAP_PROTO and a local destination address).
*/
void
ipip_input(m, hlen)
register struct mbuf *m;
register int hlen;
#if __STDC__
ipip_input(struct mbuf *m, ...)
#else
ipip_input(m, va_alist)
struct mbuf *m;
va_dcl
#endif
{
register int hlen;
register struct ip *ip = mtod(m, struct ip *);
register int s;
register struct ifqueue *ifq;
register struct vif *vifp;
va_list ap;
va_start(ap, m);
hlen = va_arg(ap, int);
va_end(ap);
if (!have_encap_tunnel) {
rip_input(m);
@ -1566,7 +1582,6 @@ static void
tbf_process_q(vifp)
register struct vif *vifp;
{
register struct mbuf *m;
register struct pkt_queue pkt_1;
register int index = (vifp - viftable);
register int s = splsoftnet();
@ -1667,7 +1682,6 @@ tbf_send_packet(vifp,m)
register struct vif *vifp;
register struct mbuf *m;
{
register struct mbuf *mcp;
int error;
int s = splsoftnet();
@ -1726,7 +1740,6 @@ priority(vifp, ip)
register struct vif *vifp;
register struct ip *ip;
{
register u_short port;
register int prio;
/* temporary hack; may add general packet classifier some day */
@ -1867,6 +1880,7 @@ ip_rsvp_vif_done(so, m)
return (0);
}
void
ip_rsvp_force_done(so)
struct socket *so;
{
@ -1899,6 +1913,7 @@ ip_rsvp_force_done(so)
return;
}
void
rsvp_input(m, ifp)
struct mbuf *m;
struct ifnet *ifp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_mroute.h,v 1.9 1995/05/31 21:50:43 mycroft Exp $ */
/* $NetBSD: ip_mroute.h,v 1.10 1996/02/13 23:42:55 christos Exp $ */
/*
* Definitions for IP multicast forwarding.
@ -210,9 +210,21 @@ struct pkt_queue {
};
int ip_mforward __P((struct mbuf *, struct ifnet *));
int ip_mrouter_get __P((int, struct socket *, struct mbuf **));
int ip_mrouter_set __P((int, struct socket *, struct mbuf **));
int ip_mrouter_done __P((void));
int ip_mrouter_set __P((int, struct socket *, struct mbuf **));
int ip_mrouter_get __P((int, struct socket *, struct mbuf **));
int mrt_ioctl __P((u_long, caddr_t));
int ip_mrouter_done __P((void));
void reset_vif __P((struct vif *));
#ifdef RSVP_ISI
int ip_mforward __P((struct mbuf *, struct ifnet *, struct ip_moptions *));
int legal_vif_num __P((int));
int ip_rsvp_vif_init __P((struct socket *, struct mbuf *));
int ip_rsvp_vif_done __P((struct socket *, struct mbuf *));
void ip_rsvp_force_done __P((struct socket *));
void rsvp_input __P((struct mbuf *, struct ifnet *));
#else
int ip_mforward __P((struct mbuf *, struct ifnet *));
#endif
void ipip_input __P((struct mbuf *, ...));
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_output.c,v 1.27 1995/07/01 03:44:55 cgd Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -42,6 +42,7 @@
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/systm.h>
#include <net/if.h>
#include <net/route.h>
@ -57,6 +58,8 @@
#include <machine/mtpr.h>
#endif
#include <machine/stdarg.h>
static struct mbuf *ip_insertoptions __P((struct mbuf *, struct mbuf *, int *));
static void ip_mloopback
__P((struct ifnet *, struct mbuf *, struct sockaddr_in *));
@ -68,12 +71,13 @@ static void ip_mloopback
* The mbuf opt, if present, will not be freed.
*/
int
ip_output(m0, opt, ro, flags, imo)
#if __STDC__
ip_output(struct mbuf *m0, ...)
#else
ip_output(m0, va_alist)
struct mbuf *m0;
struct mbuf *opt;
struct route *ro;
int flags;
struct ip_moptions *imo;
va_dcl
#endif
{
register struct ip *ip, *mhip;
register struct ifnet *ifp;
@ -83,6 +87,20 @@ ip_output(m0, opt, ro, flags, imo)
struct route iproute;
struct sockaddr_in *dst;
struct in_ifaddr *ia;
struct mbuf *opt;
struct route *ro;
int flags;
struct ip_moptions *imo;
va_list ap;
va_start(ap, m0);
opt = va_arg(ap, struct mbuf *);
ro = va_arg(ap, struct route *);
flags = va_arg(ap, int);
imo = va_arg(ap, struct ip_moptions *);
va_end(ap);
#ifdef DIAGNOSTIC
if ((m->m_flags & M_PKTHDR) == 0)
@ -481,7 +499,7 @@ ip_ctloutput(op, so, level, optname, mp)
{
register struct inpcb *inp = sotoinpcb(so);
register struct mbuf *m = *mp;
register int optval;
register int optval = 0;
int error = 0;
if (level != IPPROTO_IP) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_var.h,v 1.15 1995/11/21 01:07:38 cgd Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -167,8 +167,7 @@ int ip_getmoptions __P((int, struct ip_moptions *, struct mbuf **));
void ip_init __P((void));
int ip_mforward __P((struct mbuf *, struct ifnet *));
int ip_optcopy __P((struct ip *, struct ip *));
int ip_output __P((struct mbuf *,
struct mbuf *, struct route *, int, struct ip_moptions *));
int ip_output __P((struct mbuf *, ...));
int ip_pcbopts __P((struct mbuf **, struct mbuf *));
struct ip *
ip_reass __P((struct ipqent *, struct ipq *));
@ -183,8 +182,8 @@ int ip_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
void ipintr __P((void));
int rip_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
void rip_init __P((void));
void rip_input __P((struct mbuf *));
int rip_output __P((struct mbuf *, struct socket *, u_long));
void rip_input __P((struct mbuf *, ...));
int rip_output __P((struct mbuf *, ...));
int rip_usrreq __P((struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip.c,v 1.23 1996/01/31 03:49:31 mycroft Exp $ */
/* $NetBSD: raw_ip.c,v 1.24 1996/02/13 23:43:29 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -53,6 +53,9 @@
#include <netinet/ip_var.h>
#include <netinet/ip_mroute.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
#include <machine/stdarg.h>
struct inpcbtable rawcbtable;
@ -83,8 +86,13 @@ struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };
* mbuf chain.
*/
void
rip_input(m)
#if __STDC__
rip_input(struct mbuf *m, ...)
#else
rip_input(m, va_alist)
struct mbuf *m;
va_dcl
#endif
{
register struct ip *ip = mtod(m, struct ip *);
register struct inpcb *inp;
@ -104,7 +112,7 @@ rip_input(m)
continue;
if (last) {
struct mbuf *n;
if (n = m_copy(m, 0, (int)M_COPYALL)) {
if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
if (sbappendaddr(&last->so_rcv,
sintosa(&ripsrc), n,
(struct mbuf *)0) == 0)
@ -134,15 +142,29 @@ rip_input(m)
* Tack on options user may have setup with control call.
*/
int
rip_output(m, so, dst)
register struct mbuf *m;
#if __STDC__
rip_output(struct mbuf *m, ...)
#else
rip_output(m, va_alist)
struct mbuf *m;
va_dcl
#endif
{
struct socket *so;
u_long dst;
{
register struct ip *ip;
register struct inpcb *inp = sotoinpcb(so);
register struct inpcb *inp;
struct mbuf *opts;
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
int flags;
va_list ap;
va_start(ap, m);
so = va_arg(ap, struct socket *);
dst = va_arg(ap, u_long);
va_end(ap);
inp = sotoinpcb(so);
flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
/*
* If the user handed us a complete IP packet, use it.
@ -182,7 +204,6 @@ rip_ctloutput(op, so, level, optname, m)
struct mbuf **m;
{
register struct inpcb *inp = sotoinpcb(so);
register int error;
if (level != IPPROTO_IP) {
if (m != 0 && *m != 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_debug.c,v 1.9 1995/04/13 06:36:32 cgd Exp $ */
/* $NetBSD: tcp_debug.c,v 1.10 1996/02/13 23:43:36 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -80,8 +80,10 @@ tcp_trace(act, ostate, tp, ti, req)
struct tcpiphdr *ti;
int req;
{
#ifdef TCPDEBUG
tcp_seq seq, ack;
int len, flags;
#endif
struct tcp_debug *td = &tcp_debug[tcp_debx++];
if (tcp_debx == TCP_NDEBUG)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_input.c,v 1.22 1996/01/31 05:56:56 mycroft Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994
@ -61,6 +61,8 @@
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>
#include <machine/stdarg.h>
int tcprexmtthresh = 3;
struct tcpiphdr tcp_saveti;
@ -233,26 +235,35 @@ present:
* protocol specification dated September, 1981 very closely.
*/
void
tcp_input(m, iphlen)
#if __STDC__
tcp_input(struct mbuf *m, ...)
#else
tcp_input(m, va_alist)
register struct mbuf *m;
int iphlen;
#endif
{
register struct tcpiphdr *ti;
register struct inpcb *inp;
caddr_t optp = NULL;
int optlen;
int optlen = 0;
int len, tlen, off;
register struct tcpcb *tp = 0;
register int tiflags;
struct socket *so;
struct socket *so = NULL;
int todrop, acked, ourfinisacked, needoutput = 0;
short ostate;
short ostate = 0;
struct in_addr laddr;
int dropsocket = 0;
int iss = 0;
u_long tiwin;
u_int32_t ts_val, ts_ecr;
int ts_present = 0;
int iphlen;
va_list ap;
va_start(ap, m);
iphlen = va_arg(ap, int);
va_end(ap);
tcpstat.tcps_rcvtotal++;
/*
@ -278,7 +289,7 @@ tcp_input(m, iphlen)
bzero(ti->ti_x1, sizeof ti->ti_x1);
ti->ti_len = (u_int16_t)tlen;
HTONS(ti->ti_len);
if (ti->ti_sum = in_cksum(m, len)) {
if ((ti->ti_sum = in_cksum(m, len)) != 0) {
tcpstat.tcps_rcvbadsum++;
goto drop;
}
@ -1122,10 +1133,9 @@ step6:
* Update window information.
* Don't look at window if no ACK: TAC's send garbage on first SYN.
*/
if ((tiflags & TH_ACK) &&
(SEQ_LT(tp->snd_wl1, ti->ti_seq) || tp->snd_wl1 == ti->ti_seq &&
(SEQ_LT(tp->snd_wl2, ti->ti_ack) ||
tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd))) {
if (((tiflags & TH_ACK) && SEQ_LT(tp->snd_wl1, ti->ti_seq)) ||
(tp->snd_wl1 == ti->ti_seq && SEQ_LT(tp->snd_wl2, ti->ti_ack)) ||
(tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd)) {
/* keep track of pure window updates */
if (ti->ti_len == 0 &&
tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd)
@ -1183,7 +1193,7 @@ step6:
* but if two URG's are pending at once, some out-of-band
* data may creep in... ick.
*/
if (ti->ti_urp <= ti->ti_len
if (ti->ti_urp <= (u_int16_t) ti->ti_len
#ifdef SO_OOBINLINE
&& (so->so_options & SO_OOBINLINE) == 0
#endif
@ -1572,7 +1582,7 @@ tcp_mss(tp, offer)
/* default variation is +- 1 rtt */
tp->t_rttvar =
tp->t_srtt * TCP_RTTVAR_SCALE / TCP_RTT_SCALE;
TCPT_RANGESET(tp->t_rxtcur,
TCPT_RANGESET((long) tp->t_rxtcur,
((tp->t_srtt >> 2) + tp->t_rttvar) >> 1,
tp->t_rttmin, TCPTV_REXMTMAX);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_output.c,v 1.13 1995/04/13 20:09:23 cgd Exp $ */
/* $NetBSD: tcp_output.c,v 1.14 1996/02/13 23:43:53 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -60,6 +60,11 @@
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>
#ifdef TUBA
#include <netiso/iso.h>
#include <netiso/tuba_table.h>
#endif
#ifdef notyet
extern struct mbuf *m_copypack();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.21 1996/01/31 03:49:35 mycroft Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -275,7 +275,6 @@ tcp_close(tp)
register struct ipqent *qe;
struct inpcb *inp = tp->t_inpcb;
struct socket *so = inp->inp_socket;
register struct mbuf *m;
#ifdef RTV_RTT
register struct rtentry *rt;
@ -294,7 +293,7 @@ tcp_close(tp)
if (SEQ_LT(tp->iss + so->so_snd.sb_hiwat * 16, tp->snd_max) &&
(rt = inp->inp_route.ro_rt) &&
satosin(rt_key(rt))->sin_addr.s_addr != INADDR_ANY) {
register u_long i;
register u_long i = 0;
if ((rt->rt_rmx.rmx_locks & RTV_RTT) == 0) {
i = tp->t_srtt *
@ -327,8 +326,8 @@ tcp_close(tp)
* before we start updating, then update on both good
* and bad news.
*/
if ((rt->rt_rmx.rmx_locks & RTV_SSTHRESH) == 0 &&
(i = tp->snd_ssthresh) && rt->rt_rmx.rmx_ssthresh ||
if (((rt->rt_rmx.rmx_locks & RTV_SSTHRESH) == 0 &&
(i = tp->snd_ssthresh) && rt->rt_rmx.rmx_ssthresh) ||
i < (rt->rt_rmx.rmx_sendpipe / 2)) {
/*
* convert the limit from user data bytes to
@ -402,20 +401,20 @@ tcp_notify(inp, error)
sowwakeup(so);
}
void
tcp_ctlinput(cmd, sa, ip)
void *
tcp_ctlinput(cmd, sa, v)
int cmd;
struct sockaddr *sa;
register struct ip *ip;
register void *v;
{
register struct ip *ip = v;
register struct tcphdr *th;
extern struct in_addr zeroin_addr;
extern int inetctlerrmap[];
void (*notify) __P((struct inpcb *, int)) = tcp_notify;
int errno;
if ((unsigned)cmd >= PRC_NCMDS)
return;
return NULL;
errno = inetctlerrmap[cmd];
if (cmd == PRC_QUENCH)
notify = tcp_quench;
@ -424,13 +423,14 @@ tcp_ctlinput(cmd, sa, ip)
else if (cmd == PRC_HOSTDEAD)
ip = 0;
else if (errno == 0)
return;
return NULL;
if (ip) {
th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
in_pcbnotify(&tcbtable, sa, th->th_dport, ip->ip_src,
th->th_sport, errno, notify);
} else
in_pcbnotifyall(&tcbtable, sa, errno, notify);
return NULL;
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_timer.c,v 1.13 1995/08/12 23:59:39 mycroft Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -203,7 +203,7 @@ tcp_timers(tp, timer)
}
tcpstat.tcps_rexmttimeo++;
rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
TCPT_RANGESET(tp->t_rxtcur, rexmt,
TCPT_RANGESET((long) tp->t_rxtcur, rexmt,
tp->t_rttmin, TCPTV_REXMTMAX);
tp->t_timer[TCPT_REXMT] = tp->t_rxtcur;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.19 1996/01/31 05:42:37 mycroft Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -45,6 +45,10 @@
#include <sys/protosw.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/proc.h>
#include <sys/ucred.h>
#include <vm/vm.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/route.h>
@ -81,7 +85,7 @@ tcp_usrreq(so, req, m, nam, control)
struct mbuf *m, *nam, *control;
{
register struct inpcb *inp;
register struct tcpcb *tp;
register struct tcpcb *tp = NULL;
int s;
int error = 0;
int ostate;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_var.h,v 1.16 1996/01/31 03:49:36 mycroft Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993, 1994
@ -247,7 +247,7 @@ int tcp_attach __P((struct socket *));
void tcp_canceltimers __P((struct tcpcb *));
struct tcpcb *
tcp_close __P((struct tcpcb *));
void tcp_ctlinput __P((int, struct sockaddr *, struct ip *));
void *tcp_ctlinput __P((int, struct sockaddr *, void *));
int tcp_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
struct tcpcb *
tcp_disconnect __P((struct tcpcb *));
@ -258,7 +258,7 @@ void tcp_dooptions __P((struct tcpcb *,
void tcp_drain __P((void));
void tcp_fasttimo __P((void));
void tcp_init __P((void));
void tcp_input __P((struct mbuf *, int));
void tcp_input __P((struct mbuf *, ...));
int tcp_mss __P((struct tcpcb *, u_int));
struct tcpcb *
tcp_newtcpcb __P((struct inpcb *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_usrreq.c,v 1.26 1996/01/31 03:49:38 mycroft Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.27 1996/02/13 23:44:32 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -43,6 +43,11 @@
#include <sys/socketvar.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <vm/vm.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/route.h>
@ -57,6 +62,8 @@
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <machine/stdarg.h>
/*
* UDP protocol implementation.
* Per RFC 768, August, 1980.
@ -86,9 +93,13 @@ udp_init()
}
void
udp_input(m, iphlen)
register struct mbuf *m;
int iphlen;
#if __STDC__
udp_input(struct mbuf *m, ...)
#else
udp_input(m, va_alist)
struct mbuf *m;
va_dcl
#endif
{
register struct ip *ip;
register struct udphdr *uh;
@ -96,6 +107,12 @@ udp_input(m, iphlen)
struct mbuf *opts = 0;
int len;
struct ip save_ip;
int iphlen;
va_list ap;
va_start(ap, m);
iphlen = va_arg(ap, int);
va_end(ap);
udpstat.udps_ipackets++;
@ -149,7 +166,7 @@ udp_input(m, iphlen)
bzero(((struct ipovly *)ip)->ih_x1,
sizeof ((struct ipovly *)ip)->ih_x1);
((struct ipovly *)ip)->ih_len = uh->uh_ulen;
if (uh->uh_sum = in_cksum(m, len + sizeof (struct ip))) {
if ((uh->uh_sum = in_cksum(m, len + sizeof (struct ip))) != 0) {
udpstat.udps_badsum++;
m_freem(m);
return;
@ -357,45 +374,58 @@ udp_notify(inp, errno)
sowwakeup(inp->inp_socket);
}
void
udp_ctlinput(cmd, sa, ip)
void *
udp_ctlinput(cmd, sa, v)
int cmd;
struct sockaddr *sa;
register struct ip *ip;
void *v;
{
register struct ip *ip = v;
register struct udphdr *uh;
extern struct in_addr zeroin_addr;
extern int inetctlerrmap[];
void (*notify) __P((struct inpcb *, int)) = udp_notify;
int errno;
if ((unsigned)cmd >= PRC_NCMDS)
return;
return NULL;
errno = inetctlerrmap[cmd];
if (PRC_IS_REDIRECT(cmd))
notify = in_rtchange, ip = 0;
else if (cmd == PRC_HOSTDEAD)
ip = 0;
else if (errno == 0)
return;
return NULL;
if (ip) {
uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));
in_pcbnotify(&udbtable, sa, uh->uh_dport, ip->ip_src,
uh->uh_sport, errno, notify);
} else
in_pcbnotifyall(&udbtable, sa, errno, notify);
return NULL;
}
int
udp_output(inp, m, addr, control)
register struct inpcb *inp;
register struct mbuf *m;
struct mbuf *addr, *control;
#if __STDC__
udp_output(struct mbuf *m, ...)
#else
udp_output(m, va_alist)
struct mbuf *m;
va_dcl
#endif
{
register struct inpcb *inp;
struct mbuf *addr, *control;
register struct udpiphdr *ui;
register int len = m->m_pkthdr.len;
struct in_addr laddr;
int s, error = 0;
int s = 0, error = 0;
va_list ap;
va_start(ap, m);
inp = va_arg(ap, struct inpcb *);
addr = va_arg(ap, struct mbuf *);
control = va_arg(ap, struct mbuf *);
va_end(ap);
if (control)
m_freem(control); /* XXX */
@ -568,7 +598,7 @@ udp_usrreq(so, req, m, addr, control)
break;
case PRU_SEND:
return (udp_output(inp, m, addr, control));
return (udp_output(m, inp, addr, control));
case PRU_ABORT:
soisdisconnected(so);
@ -628,6 +658,7 @@ udp_detach(inp)
/*
* Sysctl for udp variables.
*/
int
udp_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
int *name;
u_int namelen;

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_var.h,v 1.11 1996/01/31 03:49:39 mycroft Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -81,11 +81,10 @@ struct udpstat {
struct inpcbtable udbtable;
struct udpstat udpstat;
void udp_ctlinput __P((int, struct sockaddr *, struct ip *));
void *udp_ctlinput __P((int, struct sockaddr *, void *));
void udp_init __P((void));
void udp_input __P((struct mbuf *, int));
int udp_output __P((struct inpcb *,
struct mbuf *, struct mbuf *, struct mbuf *));
void udp_input __P((struct mbuf *, ...));
int udp_output __P((struct mbuf *, ...));
int udp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
int udp_usrreq __P((struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *));