Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22213
b: refs/heads/master
c: b61fafc
h: refs/heads/master
i:
  22211: 3fa6fb0
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed Mar 21, 2006
1 parent 7df00be commit 2eb0008
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 142 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46f09ffa7db595f49fb42338e013417756816d37
refs/heads/master: b61fafc4ef3faf54236d57e3b230ca19167663bf
7 changes: 4 additions & 3 deletions trunk/net/dccp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ obj-$(CONFIG_IPV6) += dccp_ipv6.o

dccp_ipv6-y := ipv6.o

obj-$(CONFIG_IP_DCCP) += dccp.o
obj-$(CONFIG_IP_DCCP) += dccp.o dccp_ipv4.o

dccp-y := ccid.o feat.o input.o ipv4.o minisocks.o options.o output.o proto.o \
timer.o
dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o

dccp_ipv4-y := ipv4.o

dccp-$(CONFIG_IP_DCCP_ACKVEC) += ackvec.o

Expand Down
6 changes: 0 additions & 6 deletions trunk/net/dccp/dccp.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ extern void dccp_time_wait(struct sock *sk, int state, int timeo);

#define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */

extern struct proto dccp_prot;

/* is seq1 < seq2 ? */
static inline int before48(const u64 seq1, const u64 seq2)
{
Expand Down Expand Up @@ -209,10 +207,6 @@ extern struct sock *dccp_create_openreq_child(struct sock *sk,

extern int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);

extern void dccp_v4_err(struct sk_buff *skb, u32);

extern int dccp_v4_rcv(struct sk_buff *skb);

extern struct sock *dccp_v4_request_recv_sock(struct sock *sk,
struct sk_buff *skb,
struct request_sock *req,
Expand Down
140 changes: 135 additions & 5 deletions trunk/net/dccp/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
#include <linux/random.h>

#include <net/icmp.h>
#include <net/inet_common.h>
#include <net/inet_hashtables.h>
#include <net/inet_sock.h>
#include <net/protocol.h>
#include <net/sock.h>
#include <net/timewait_sock.h>
#include <net/tcp_states.h>
Expand Down Expand Up @@ -285,7 +287,7 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req,
* check at all. A more general error queue to queue errors for later handling
* is probably better.
*/
void dccp_v4_err(struct sk_buff *skb, u32 info)
static void dccp_v4_err(struct sk_buff *skb, u32 info)
{
const struct iphdr *iph = (struct iphdr *)skb->data;
const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data +
Expand Down Expand Up @@ -639,6 +641,8 @@ int dccp_v4_checksum(const struct sk_buff *skb, const __be32 saddr,
IPPROTO_DCCP, tmp);
}

EXPORT_SYMBOL_GPL(dccp_v4_checksum);

static int dccp_v4_verify_checksum(struct sk_buff *skb,
const __be32 saddr, const __be32 daddr)
{
Expand Down Expand Up @@ -871,7 +875,7 @@ int dccp_invalid_packet(struct sk_buff *skb)
EXPORT_SYMBOL_GPL(dccp_invalid_packet);

/* this is called when real data arrives */
int dccp_v4_rcv(struct sk_buff *skb)
static int dccp_v4_rcv(struct sk_buff *skb)
{
const struct dccp_hdr *dh;
struct sock *sk;
Expand Down Expand Up @@ -978,7 +982,7 @@ int dccp_v4_rcv(struct sk_buff *skb)
goto no_dccp_socket;
}

struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
.queue_xmit = ip_queue_xmit,
.send_check = dccp_v4_send_check,
.rebuild_header = inet_sk_rebuild_header,
Expand Down Expand Up @@ -1018,7 +1022,7 @@ static struct timewait_sock_ops dccp_timewait_sock_ops = {
.twsk_obj_size = sizeof(struct inet_timewait_sock),
};

struct proto dccp_prot = {
struct proto dccp_v4_prot = {
.name = "DCCP",
.owner = THIS_MODULE,
.close = dccp_close,
Expand All @@ -1044,4 +1048,130 @@ struct proto dccp_prot = {
.twsk_prot = &dccp_timewait_sock_ops,
};

EXPORT_SYMBOL_GPL(dccp_prot);
static struct net_protocol dccp_v4_protocol = {
.handler = dccp_v4_rcv,
.err_handler = dccp_v4_err,
.no_policy = 1,
};

static const struct proto_ops inet_dccp_ops = {
.family = PF_INET,
.owner = THIS_MODULE,
.release = inet_release,
.bind = inet_bind,
.connect = inet_stream_connect,
.socketpair = sock_no_socketpair,
.accept = inet_accept,
.getname = inet_getname,
/* FIXME: work on tcp_poll to rename it to inet_csk_poll */
.poll = dccp_poll,
.ioctl = inet_ioctl,
/* FIXME: work on inet_listen to rename it to sock_common_listen */
.listen = inet_dccp_listen,
.shutdown = inet_shutdown,
.setsockopt = sock_common_setsockopt,
.getsockopt = sock_common_getsockopt,
.sendmsg = inet_sendmsg,
.recvmsg = sock_common_recvmsg,
.mmap = sock_no_mmap,
.sendpage = sock_no_sendpage,
};

static struct inet_protosw dccp_v4_protosw = {
.type = SOCK_DCCP,
.protocol = IPPROTO_DCCP,
.prot = &dccp_v4_prot,
.ops = &inet_dccp_ops,
.capability = -1,
.no_check = 0,
.flags = INET_PROTOSW_ICSK,
};

/*
* This is the global socket data structure used for responding to
* the Out-of-the-blue (OOTB) packets. A control sock will be created
* for this socket at the initialization time.
*/
struct socket *dccp_ctl_socket;

static char dccp_ctl_socket_err_msg[] __initdata =
KERN_ERR "DCCP: Failed to create the control socket.\n";

static int __init dccp_ctl_sock_init(void)
{
int rc = sock_create_kern(PF_INET, SOCK_DCCP, IPPROTO_DCCP,
&dccp_ctl_socket);
if (rc < 0)
printk(dccp_ctl_socket_err_msg);
else {
dccp_ctl_socket->sk->sk_allocation = GFP_ATOMIC;
inet_sk(dccp_ctl_socket->sk)->uc_ttl = -1;

/* Unhash it so that IP input processing does not even
* see it, we do not wish this socket to see incoming
* packets.
*/
dccp_ctl_socket->sk->sk_prot->unhash(dccp_ctl_socket->sk);
}

return rc;
}

#ifdef CONFIG_IP_DCCP_UNLOAD_HACK
void dccp_ctl_sock_exit(void)
{
if (dccp_ctl_socket != NULL) {
sock_release(dccp_ctl_socket);
dccp_ctl_socket = NULL;
}
}

EXPORT_SYMBOL_GPL(dccp_ctl_sock_exit);
#endif

static int __init dccp_v4_init(void)
{
int err = proto_register(&dccp_v4_prot, 1);

if (err != 0)
goto out;

err = inet_add_protocol(&dccp_v4_protocol, IPPROTO_DCCP);
if (err != 0)
goto out_proto_unregister;

inet_register_protosw(&dccp_v4_protosw);

err = dccp_ctl_sock_init();
if (err)
goto out_unregister_protosw;
out:
return err;
out_unregister_protosw:
inet_unregister_protosw(&dccp_v4_protosw);
inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP);
out_proto_unregister:
proto_unregister(&dccp_v4_prot);
goto out;
}

static void __exit dccp_v4_exit(void)
{
inet_unregister_protosw(&dccp_v4_protosw);
inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP);
proto_unregister(&dccp_v4_prot);
}

module_init(dccp_v4_init);
module_exit(dccp_v4_exit);

/*
* __stringify doesn't likes enums, so use SOCK_DCCP (6) and IPPROTO_DCCP (33)
* values directly, Also cover the case where the protocol is not specified,
* i.e. net-pf-PF_INET-proto-0-type-SOCK_DCCP
*/
MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-33-type-6");
MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-0-type-6");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>");
MODULE_DESCRIPTION("DCCP - Datagram Congestion Controlled Protocol");
2 changes: 2 additions & 0 deletions trunk/net/dccp/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
return -1;
}

EXPORT_SYMBOL_GPL(dccp_parse_options);

static void dccp_encode_value_var(const u32 value, unsigned char *to,
const unsigned int len)
{
Expand Down
2 changes: 2 additions & 0 deletions trunk/net/dccp/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ void dccp_send_sync(struct sock *sk, const u64 seq,
dccp_transmit_skb(sk, skb);
}

EXPORT_SYMBOL_GPL(dccp_send_sync);

/*
* Send a DCCP_PKT_CLOSE/CLOSEREQ. The caller locks the socket for us. This
* cannot be allowed to fail queueing a DCCP_PKT_CLOSE/CLOSEREQ frame under
Expand Down
Loading

0 comments on commit 2eb0008

Please sign in to comment.