summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2002-11-20 19:00:54 +0000
committerluigi <luigi@FreeBSD.org>2002-11-20 19:00:54 +0000
commitabbf6b609086058fb129298ed714994d1236fdee (patch)
treefd5c55116b906a53d60ecb5a4a0425a5291252f7 /sys/netinet
parentf840da61b0f36260b235839a60e359112342f688 (diff)
downloadFreeBSD-src-abbf6b609086058fb129298ed714994d1236fdee.zip
FreeBSD-src-abbf6b609086058fb129298ed714994d1236fdee.tar.gz
Back out some style changes. They are not urgent,
I will put them back in after 5.0 is out. Requested by: sam Approved by: re
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/igmp.c52
-rw-r--r--sys/netinet/raw_ip.c56
-rw-r--r--sys/netinet/udp_usrreq.c63
3 files changed, 95 insertions, 76 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index a109d4e..929d456 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -76,7 +76,8 @@
static MALLOC_DEFINE(M_IGMP, "igmp", "igmp state");
-static struct router_info *find_rti(struct ifnet *ifp);
+static struct router_info *
+ find_rti(struct ifnet *ifp);
static struct igmpstat igmpstat;
@@ -92,7 +93,7 @@ static struct router_info *Head;
static void igmp_sendpkt(struct in_multi *, int, unsigned long);
void
-igmp_init(void)
+igmp_init()
{
struct ipoption *ra;
@@ -120,9 +121,10 @@ igmp_init(void)
}
static struct router_info *
-find_rti(struct ifnet *ifp)
+find_rti(ifp)
+ struct ifnet *ifp;
{
- struct router_info *rti = Head;
+ register struct router_info *rti = Head;
#ifdef IGMP_DEBUG
printf("[igmp.c, _find_rti] --> entering \n");
@@ -149,16 +151,18 @@ find_rti(struct ifnet *ifp)
}
void
-igmp_input(struct mbuf *m, int off)
+igmp_input(m, off)
+ register struct mbuf *m;
+ int off;
{
- int iphlen = off;
- struct igmp *igmp;
- struct ip *ip;
- int igmplen;
- struct ifnet *ifp = m->m_pkthdr.rcvif;
- int minlen;
- struct in_multi *inm;
- struct in_ifaddr *ia;
+ register int iphlen = off;
+ register struct igmp *igmp;
+ register struct ip *ip;
+ register int igmplen;
+ register struct ifnet *ifp = m->m_pkthdr.rcvif;
+ register int minlen;
+ register struct in_multi *inm;
+ register struct in_ifaddr *ia;
struct in_multistep step;
struct router_info *rti;
@@ -341,7 +345,8 @@ igmp_input(struct mbuf *m, int off)
}
void
-igmp_joingroup(struct in_multi *inm)
+igmp_joingroup(inm)
+ struct in_multi *inm;
{
int s = splnet();
@@ -361,7 +366,8 @@ igmp_joingroup(struct in_multi *inm)
}
void
-igmp_leavegroup(struct in_multi *inm)
+igmp_leavegroup(inm)
+ struct in_multi *inm;
{
if (inm->inm_state == IGMP_IREPORTEDLAST &&
inm->inm_addr.s_addr != igmp_all_hosts_group &&
@@ -371,9 +377,9 @@ igmp_leavegroup(struct in_multi *inm)
}
void
-igmp_fasttimo(void)
+igmp_fasttimo()
{
- struct in_multi *inm;
+ register struct in_multi *inm;
struct in_multistep step;
int s;
@@ -403,10 +409,10 @@ igmp_fasttimo(void)
}
void
-igmp_slowtimo(void)
+igmp_slowtimo()
{
int s = splnet();
- struct router_info *rti = Head;
+ register struct router_info *rti = Head;
#ifdef IGMP_DEBUG
printf("[igmp.c,_slowtimo] -- > entering \n");
@@ -426,13 +432,13 @@ igmp_slowtimo(void)
splx(s);
}
-/*
- * XXX fix this static var when we remove the network code from Giant.
- */
static struct route igmprt;
static void
-igmp_sendpkt(struct in_multi *inm, int type, unsigned long addr)
+igmp_sendpkt(inm, type, addr)
+ struct in_multi *inm;
+ int type;
+ unsigned long addr;
{
struct mbuf *m;
struct igmp *igmp;
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 9bae95f..8599a1b 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -118,10 +118,10 @@ void (*ip_rsvp_force_done)(struct socket *);
*/
/*
- * Initialize raw connection block queue.
+ * Initialize raw connection block q.
*/
void
-rip_init(void)
+rip_init()
{
INP_INFO_LOCK_INIT(&ripcbinfo, "rip");
LIST_INIT(&ripcb);
@@ -138,22 +138,19 @@ rip_init(void)
uma_zone_set_max(ripcbinfo.ipi_zone, maxsockets);
}
-/*
- * XXX ripsrc is modified in rip_input, so we must be fix this
- * when we want to make this code smp-friendly.
- */
static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };
-
/*
* Setup generic address and protocol structures
* for raw_input routine, then pass them along with
* mbuf chain.
*/
void
-rip_input(struct mbuf *m, int off)
+rip_input(m, off)
+ struct mbuf *m;
+ int off;
{
- struct ip *ip = mtod(m, struct ip *);
- struct inpcb *inp;
+ register struct ip *ip = mtod(m, struct ip *);
+ register struct inpcb *inp;
struct inpcb *last = 0;
struct mbuf *opts = 0;
int proto = ip->ip_p;
@@ -166,14 +163,14 @@ rip_input(struct mbuf *m, int off)
#endif
if (inp->inp_ip_p && inp->inp_ip_p != proto)
continue;
- if (inp->inp_laddr.s_addr != INADDR_ANY &&
- inp->inp_laddr.s_addr != ip->ip_dst.s_addr)
+ if (inp->inp_laddr.s_addr &&
+ inp->inp_laddr.s_addr != ip->ip_dst.s_addr)
continue;
- if (inp->inp_faddr.s_addr != INADDR_ANY &&
- inp->inp_faddr.s_addr != ip->ip_src.s_addr)
+ if (inp->inp_faddr.s_addr &&
+ inp->inp_faddr.s_addr != ip->ip_src.s_addr)
continue;
if (last) {
- struct mbuf *n = m_copypacket(m, M_DONTWAIT);
+ struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
int policyfail = 0;
if (n != NULL) {
@@ -268,10 +265,13 @@ rip_input(struct mbuf *m, int off)
* Tack on options user may have setup with control call.
*/
int
-rip_output(struct mbuf *m, struct socket *so, u_long dst)
+rip_output(m, so, dst)
+ struct mbuf *m;
+ struct socket *so;
+ u_long dst;
{
- struct ip *ip;
- struct inpcb *inp = sotoinpcb(so);
+ register struct ip *ip;
+ register struct inpcb *inp = sotoinpcb(so);
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
#ifdef MAC
@@ -330,7 +330,9 @@ rip_output(struct mbuf *m, struct socket *so, u_long dst)
* Raw IP socket option processing.
*/
int
-rip_ctloutput(struct socket *so, struct sockopt *sopt)
+rip_ctloutput(so, sopt)
+ struct socket *so;
+ struct sockopt *sopt;
{
struct inpcb *inp = sotoinpcb(so);
int error, optval;
@@ -458,7 +460,10 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt)
* interface routes.
*/
void
-rip_ctlinput(int cmd, struct sockaddr *sa, void *vip)
+rip_ctlinput(cmd, sa, vip)
+ int cmd;
+ struct sockaddr *sa;
+ void *vip;
{
struct in_ifaddr *ia;
struct ifnet *ifp;
@@ -516,8 +521,7 @@ SYSCTL_INT(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW,
SYSCTL_INT(_net_inet_raw, OID_AUTO, recvspace, CTLFLAG_RW,
&rip_recvspace, 0, "Maximum incoming raw IP datagram size");
SYSCTL_INT(_net_inet_raw, OID_AUTO, olddiverterror, CTLFLAG_RW,
- &rip_olddiverterror, 0,
- "Return an error when creating an 'old' DIVERT socket");
+ &rip_olddiverterror, 0, "Return an error when creating an 'old' DIVERT socket");
static int
rip_attach(struct socket *so, int proto, struct thread *td)
@@ -536,9 +540,7 @@ rip_attach(struct socket *so, int proto, struct thread *td)
/* To be removed before 5.2 */
if (rip_olddiverterror && proto == IPPROTO_OLD_DIVERT) {
- printf("Old IPDIVERT program needs to be recompiled, "
- "or new IP proto 254 user needs "
- "sysctl net.inet.raw.olddiverterror=0\n");
+ printf("Old IPDIVERT program needs to be recompiled, or new IP proto 254 user needs sysctl net.inet.raw.olddiverterror=0\n");
return EPROTONOSUPPORT;
}
@@ -601,7 +603,7 @@ rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
if (TAILQ_EMPTY(&ifnet) || ((addr->sin_family != AF_INET) &&
(addr->sin_family != AF_IMPLINK)) ||
- (addr->sin_addr.s_addr != INADDR_ANY &&
+ (addr->sin_addr.s_addr &&
ifa_ifwithaddr((struct sockaddr *)addr) == 0))
return EADDRNOTAVAIL;
inp->inp_laddr = addr->sin_addr;
@@ -638,7 +640,7 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
struct mbuf *control, struct thread *td)
{
struct inpcb *inp = sotoinpcb(so);
- u_long dst;
+ register u_long dst;
if (so->so_state & SS_ISCONNECTED) {
if (nam) {
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 6545535..437ee4e 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -98,15 +98,15 @@ static int udpcksum = 1;
static int udpcksum = 0; /* XXX */
#endif
SYSCTL_INT(_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_RW,
- &udpcksum, 0, "");
+ &udpcksum, 0, "");
-int log_in_vain; /* defaults to 0 */
+int log_in_vain = 0;
SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW,
&log_in_vain, 0, "Log all incoming UDP packets");
-static int blackhole; /* defaults to 0 */
+static int blackhole = 0;
SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_RW,
- &blackhole, 0, "Do not send port unreachables for refused connects");
+ &blackhole, 0, "Do not send port unreachables for refused connects");
struct inpcbhead udb; /* from udp_var.h */
#define udb6 udb /* for KAME src sync over BSD*'s */
@@ -120,12 +120,7 @@ struct udpstat udpstat; /* from udp_var.h */
SYSCTL_STRUCT(_net_inet_udp, UDPCTL_STATS, stats, CTLFLAG_RW,
&udpstat, udpstat, "UDP statistics (struct udpstat, netinet/udp_var.h)");
-/*
- * XXX warning, udp_in is not constant, so we need to fix this when
- * we want to remove this code from under Giant
- */
static struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET };
-
#ifdef INET6
struct udp_in6 {
struct sockaddr_in6 uin6_sin;
@@ -151,7 +146,7 @@ static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *,
struct mbuf *, struct thread *);
void
-udp_init(void)
+udp_init()
{
INP_INFO_LOCK_INIT(&udbinfo, "udp");
LIST_INIT(&udb);
@@ -165,12 +160,14 @@ udp_init(void)
}
void
-udp_input(struct mbuf *m, int off)
+udp_input(m, off)
+ register struct mbuf *m;
+ int off;
{
int iphlen = off;
- struct ip *ip;
- struct udphdr *uh;
- struct inpcb *inp;
+ register struct ip *ip;
+ register struct udphdr *uh;
+ register struct inpcb *inp;
struct mbuf *opts = 0;
int len;
struct ip save_ip;
@@ -314,7 +311,7 @@ udp_input(struct mbuf *m, int off)
if (last != NULL) {
struct mbuf *n;
- n = m_copypacket(m, M_DONTWAIT);
+ n = m_copy(m, 0, M_COPYALL);
if (n != NULL)
udp_append(last, ip, n,
iphlen +
@@ -397,7 +394,9 @@ badunlocked:
#ifdef INET6
static void
-ip_2_ip6_hdr(struct ip6_hdr *ip6, struct ip *ip)
+ip_2_ip6_hdr(ip6, ip)
+ struct ip6_hdr *ip6;
+ struct ip *ip;
{
bzero(ip6, sizeof(*ip6));
@@ -417,7 +416,11 @@ ip_2_ip6_hdr(struct ip6_hdr *ip6, struct ip *ip)
* caller must properly init udp_ip6 and udp_in6 beforehand.
*/
static void
-udp_append(struct inpcb *last, struct ip *ip, struct mbuf *n, int off)
+udp_append(last, ip, n, off)
+ struct inpcb *last;
+ struct ip *ip;
+ struct mbuf *n;
+ int off;
{
struct sockaddr *append_sa;
struct mbuf *opts = 0;
@@ -486,7 +489,9 @@ udp_append(struct inpcb *last, struct ip *ip, struct mbuf *n, int off)
* just wake up so that he can collect error status.
*/
struct inpcb *
-udp_notify(struct inpcb *inp, int errno)
+udp_notify(inp, errno)
+ register struct inpcb *inp;
+ int errno;
{
inp->inp_socket->so_error = errno;
sorwakeup(inp->inp_socket);
@@ -495,7 +500,10 @@ udp_notify(struct inpcb *inp, int errno)
}
void
-udp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
+udp_ctlinput(cmd, sa, vip)
+ int cmd;
+ struct sockaddr *sa;
+ void *vip;
{
struct ip *ip = vip;
struct udphdr *uh;
@@ -630,7 +638,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
}
SYSCTL_PROC(_net_inet_udp, UDPCTL_PCBLIST, pcblist, CTLFLAG_RD, 0, 0,
- udp_pcblist, "S,xinpcb", "List of active UDP sockets");
+ udp_pcblist, "S,xinpcb", "List of active UDP sockets");
static int
udp_getcred(SYSCTL_HANDLER_ARGS)
@@ -671,11 +679,15 @@ SYSCTL_PROC(_net_inet_udp, OID_AUTO, getcred,
udp_getcred, "S,xucred", "Get the xucred of a UDP connection");
static int
-udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
- struct mbuf *control, struct thread *td)
+udp_output(inp, m, addr, control, td)
+ register struct inpcb *inp;
+ struct mbuf *m;
+ struct sockaddr *addr;
+ struct mbuf *control;
+ struct thread *td;
{
- struct udpiphdr *ui;
- int len = m->m_pkthdr.len;
+ register struct udpiphdr *ui;
+ register int len = m->m_pkthdr.len;
struct in_addr faddr, laddr;
struct cmsghdr *cm;
struct sockaddr_in *sin, src;
@@ -835,11 +847,10 @@ release:
}
u_long udp_sendspace = 9216; /* really max datagram size */
-
+ /* 40 1K datagrams */
SYSCTL_INT(_net_inet_udp, UDPCTL_MAXDGRAM, maxdgram, CTLFLAG_RW,
&udp_sendspace, 0, "Maximum outgoing UDP datagram size");
-/* XXX having this conditional is just silly! */
u_long udp_recvspace = 40 * (1024 +
#ifdef INET6
sizeof(struct sockaddr_in6)
OpenPOWER on IntegriCloud