Added control() function (as NULL pointer).
Fixed some warnings. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5027 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -121,8 +121,7 @@ static void icmp_reflect(struct mbuf *m)
|
|||||||
ip->ip_ttl = MAXTTL;
|
ip->ip_ttl = MAXTTL;
|
||||||
if (optlen > 0) {
|
if (optlen > 0) {
|
||||||
uint8 *cp;
|
uint8 *cp;
|
||||||
int opt, cnt;
|
int opt, cnt, len;
|
||||||
uint len;
|
|
||||||
|
|
||||||
cp = (uint8*)(ip + 1);
|
cp = (uint8*)(ip + 1);
|
||||||
if ((opts = ipm->srcroute()) == 0 &&
|
if ((opts = ipm->srcroute()) == 0 &&
|
||||||
@@ -172,7 +171,7 @@ done:
|
|||||||
m_free(opts);
|
m_free(opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void icmp_input(struct mbuf *buf, int hdrlen)
|
static void icmp_input(struct mbuf *buf, int hdrlen)
|
||||||
{
|
{
|
||||||
struct ip *ip = mtod(buf, struct ip *);
|
struct ip *ip = mtod(buf, struct ip *);
|
||||||
struct icmp *ic;
|
struct icmp *ic;
|
||||||
@@ -189,8 +188,8 @@ void icmp_input(struct mbuf *buf, int hdrlen)
|
|||||||
#if SHOW_DEBUG
|
#if SHOW_DEBUG
|
||||||
dump_icmp(buf);
|
dump_icmp(buf);
|
||||||
#endif
|
#endif
|
||||||
i = hdrlen + min(icl, ICMP_ADVLENMIN);
|
i = hdrlen + min(icl, (int) ICMP_ADVLENMIN);
|
||||||
if (buf->m_len < i && (buf = m_pullup(buf, i)) == NULL) {
|
if ((int) buf->m_len < i && (buf = m_pullup(buf, i)) == NULL) {
|
||||||
icmpstat.icps_tooshort++;
|
icmpstat.icps_tooshort++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -254,7 +253,7 @@ void icmp_input(struct mbuf *buf, int hdrlen)
|
|||||||
goto badcode;
|
goto badcode;
|
||||||
code = PRC_QUENCH;
|
code = PRC_QUENCH;
|
||||||
deliver:
|
deliver:
|
||||||
if (icl < ICMP_ADVLENMIN || icl < ICMP_ADVLEN(ic) ||
|
if (icl < (int) ICMP_ADVLENMIN || icl < ICMP_ADVLEN(ic) ||
|
||||||
(ic->icmp_ip.ip_hl < sizeof(struct ip) >> 2)) {
|
(ic->icmp_ip.ip_hl < sizeof(struct ip) >> 2)) {
|
||||||
icmpstat.icps_badlen++;
|
icmpstat.icps_badlen++;
|
||||||
goto freeit;
|
goto freeit;
|
||||||
@@ -295,7 +294,7 @@ freeit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void icmp_error(struct mbuf *n, int type, int code, n_long dest,
|
static void icmp_error(struct mbuf *n, int type, int code, n_long dest,
|
||||||
struct ifnet *destifp)
|
struct ifnet *destifp)
|
||||||
{
|
{
|
||||||
struct ip *oip = mtod(n, struct ip*), *nip;
|
struct ip *oip = mtod(n, struct ip*), *nip;
|
||||||
@@ -432,7 +431,8 @@ struct icmp_module_info protocol_info = {
|
|||||||
std_ops
|
std_ops
|
||||||
},
|
},
|
||||||
icmp_protocol_init,
|
icmp_protocol_init,
|
||||||
icmp_protocol_stop
|
icmp_protocol_stop,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
icmp_error
|
icmp_error
|
||||||
|
|||||||
@@ -1195,7 +1195,8 @@ struct ipv4_module_info protocol_info = {
|
|||||||
std_ops
|
std_ops
|
||||||
},
|
},
|
||||||
ipv4_module_init,
|
ipv4_module_init,
|
||||||
ipv4_module_stop
|
ipv4_module_stop,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
ipv4_output,
|
ipv4_output,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ static int rip_recvspace = 8192;
|
|||||||
|
|
||||||
struct ipstat ipstat; //XXX might need to be shared
|
struct ipstat ipstat; //XXX might need to be shared
|
||||||
|
|
||||||
void rip_init(void)
|
static void rip_init(void)
|
||||||
{
|
{
|
||||||
rawinpcb.inp_next = rawinpcb.inp_prev = &rawinpcb;
|
rawinpcb.inp_next = rawinpcb.inp_prev = &rawinpcb;
|
||||||
memset(&ripsrc, 0, sizeof(ripsrc));
|
memset(&ripsrc, 0, sizeof(ripsrc));
|
||||||
@@ -40,7 +40,7 @@ void rip_init(void)
|
|||||||
ripsrc.sin_len = sizeof(ripsrc);
|
ripsrc.sin_len = sizeof(ripsrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rip_input(struct mbuf *m, int hdrlen)
|
static void rip_input(struct mbuf *m, int hdrlen)
|
||||||
{
|
{
|
||||||
struct ip *ip = mtod(m, struct ip*);
|
struct ip *ip = mtod(m, struct ip*);
|
||||||
struct inpcb *inp;
|
struct inpcb *inp;
|
||||||
@@ -80,7 +80,7 @@ void rip_input(struct mbuf *m, int hdrlen)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rip_output(struct mbuf *m, struct socket *so, uint32 dst)
|
static int rip_output(struct mbuf *m, struct socket *so, uint32 dst)
|
||||||
{
|
{
|
||||||
struct ip *ip;
|
struct ip *ip;
|
||||||
struct inpcb *inp = sotoinpcb(so);
|
struct inpcb *inp = sotoinpcb(so);
|
||||||
@@ -88,7 +88,7 @@ int rip_output(struct mbuf *m, struct socket *so, uint32 dst)
|
|||||||
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
|
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
|
||||||
|
|
||||||
if ((inp->inp_flags & INP_HDRINCL) == 0) {
|
if ((inp->inp_flags & INP_HDRINCL) == 0) {
|
||||||
M_PREPEND(m, sizeof(struct ip));
|
M_PREPEND(m, (int) sizeof(struct ip));
|
||||||
ip = mtod(m, struct ip *);
|
ip = mtod(m, struct ip *);
|
||||||
ip->ip_p = inp->inp_ip.ip_p;
|
ip->ip_p = inp->inp_ip.ip_p;
|
||||||
ip->ip_len = m->m_pkthdr.len;
|
ip->ip_len = m->m_pkthdr.len;
|
||||||
@@ -120,7 +120,7 @@ int rip_output(struct mbuf *m, struct socket *so, uint32 dst)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rip_userreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
|
static int rip_userreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
|
||||||
struct mbuf *control)
|
struct mbuf *control)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
@@ -229,7 +229,7 @@ int rip_userreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rip_ctloutput(int op, struct socket *so, int level,
|
static int rip_ctloutput(int op, struct socket *so, int level,
|
||||||
int optnum, struct mbuf **m)
|
int optnum, struct mbuf **m)
|
||||||
{
|
{
|
||||||
struct inpcb *inp = sotoinpcb(so);
|
struct inpcb *inp = sotoinpcb(so);
|
||||||
@@ -314,7 +314,8 @@ struct raw_module_info protocol_info = {
|
|||||||
std_ops
|
std_ops
|
||||||
},
|
},
|
||||||
raw_module_init,
|
raw_module_init,
|
||||||
raw_module_stop
|
raw_module_stop,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
&rip_input
|
&rip_input
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ tcp_seq tcp_iss; /* tcp initial send seq # */
|
|||||||
// XXX shared? look into sockbuf.c
|
// XXX shared? look into sockbuf.c
|
||||||
uint32 sb_max = SB_MAX;
|
uint32 sb_max = SB_MAX;
|
||||||
|
|
||||||
void tcp_init(void)
|
static void tcp_init(void)
|
||||||
{
|
{
|
||||||
tcp_now = arc4random() / 2;
|
tcp_now = arc4random() / 2;
|
||||||
tcp_iss = 1;
|
tcp_iss = 1;
|
||||||
|
|
||||||
tcb.inp_next = tcb.inp_prev = &tcb;
|
tcb.inp_next = tcb.inp_prev = &tcb;
|
||||||
if (get_max_protohdr() < sizeof(struct tcpiphdr))
|
if (get_max_protohdr() < (int) sizeof(struct tcpiphdr))
|
||||||
set_max_protohdr(sizeof(struct tcpiphdr));
|
set_max_protohdr(sizeof(struct tcpiphdr));
|
||||||
memset(&tcpstat, 0, sizeof(struct tcpstat));
|
memset(&tcpstat, 0, sizeof(struct tcpstat));
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ void tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
|
|||||||
ipm->output(m, NULL, ro, 0, NULL);
|
ipm->output(m, NULL, ro, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tcpcb *tcp_usrclosed(struct tcpcb *tp)
|
static struct tcpcb *tcp_usrclosed(struct tcpcb *tp)
|
||||||
{
|
{
|
||||||
switch(tp->t_state) {
|
switch(tp->t_state) {
|
||||||
case TCPS_CLOSED:
|
case TCPS_CLOSED:
|
||||||
@@ -554,7 +554,8 @@ struct kernel_net_module_info protocol_info = {
|
|||||||
std_ops
|
std_ops
|
||||||
},
|
},
|
||||||
tcp_module_init,
|
tcp_module_init,
|
||||||
tcp_module_stop
|
tcp_module_stop,
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ static void dump_udp(struct mbuf *buf)
|
|||||||
}
|
}
|
||||||
#endif /* SHOW_DEBUG */
|
#endif /* SHOW_DEBUG */
|
||||||
|
|
||||||
int udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,struct mbuf *control)
|
static int udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,
|
||||||
|
struct mbuf *control)
|
||||||
{
|
{
|
||||||
struct udpiphdr *ui;
|
struct udpiphdr *ui;
|
||||||
uint16 len = m->m_pkthdr.len;
|
uint16 len = m->m_pkthdr.len;
|
||||||
@@ -85,7 +86,7 @@ int udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,struct mbuf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
M_PREPEND(m, sizeof(*ui));
|
M_PREPEND(m, (int) sizeof(*ui));
|
||||||
if (!m) {
|
if (!m) {
|
||||||
error = ENOMEM;
|
error = ENOMEM;
|
||||||
goto release;
|
goto release;
|
||||||
@@ -132,7 +133,7 @@ release:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int udp_userreq(struct socket *so, int req,
|
static int udp_userreq(struct socket *so, int req,
|
||||||
struct mbuf *m, struct mbuf *addr, struct mbuf *ctrl)
|
struct mbuf *m, struct mbuf *addr, struct mbuf *ctrl)
|
||||||
{
|
{
|
||||||
struct inpcb *inp = sotoinpcb(so);
|
struct inpcb *inp = sotoinpcb(so);
|
||||||
@@ -227,7 +228,7 @@ release:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_input(struct mbuf *buf, int hdrlen)
|
static void udp_input(struct mbuf *buf, int hdrlen)
|
||||||
{
|
{
|
||||||
struct ip *ip = mtod(buf, struct ip*);
|
struct ip *ip = mtod(buf, struct ip*);
|
||||||
struct udphdr *udp = (struct udphdr*)((caddr_t)ip + hdrlen);
|
struct udphdr *udp = (struct udphdr*)((caddr_t)ip + hdrlen);
|
||||||
@@ -332,7 +333,7 @@ static void udp_ctlinput(int cmd, struct sockaddr *sa, void *ipp)
|
|||||||
in_pcbnotify(&udb, sa, 0, zeroin_addr, 0, cmd, udp_notify);
|
in_pcbnotify(&udb, sa, 0, zeroin_addr, 0, cmd, udp_notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_init(void)
|
static void udp_init(void)
|
||||||
{
|
{
|
||||||
udb.inp_prev = udb.inp_next = &udb;
|
udb.inp_prev = udb.inp_next = &udb;
|
||||||
udp_sendspace = 9216; /* default size */
|
udp_sendspace = 9216; /* default size */
|
||||||
@@ -392,7 +393,8 @@ struct kernel_net_module_info protocol_info = {
|
|||||||
std_ops
|
std_ops
|
||||||
},
|
},
|
||||||
udp_module_init,
|
udp_module_init,
|
||||||
udp_module_stop
|
udp_module_stop,
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|||||||
Reference in New Issue
Block a user