DECLARE_RWSEM(rxrpc_conns_sem);
unsigned long rxrpc_conn_timeout = 60 * 60;
+static void rxrpc_conn_do_timeout(struct rxrpc_connection *conn);
+
static void __rxrpc_conn_timeout(rxrpc_timer_t *timer)
{
struct rxrpc_connection *conn =
_enter("%p",peer);
/* allocate and initialise a connection record */
- conn = kmalloc(sizeof(struct rxrpc_connection), GFP_KERNEL);
+ conn = kzalloc(sizeof(struct rxrpc_connection), GFP_KERNEL);
if (!conn) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
- memset(conn, 0, sizeof(struct rxrpc_connection));
atomic_set(&conn->usage, 1);
INIT_LIST_HEAD(&conn->link);
* create a new connection record for outgoing connections
*/
int rxrpc_create_connection(struct rxrpc_transport *trans,
- uint16_t port,
- uint32_t addr,
+ __be16 port,
+ __be32 addr,
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn)
struct rxrpc_connection *candidate, *conn;
struct rxrpc_peer *peer;
struct list_head *_p;
- uint32_t connid;
+ __be32 connid;
int ret;
_enter("%p{%hu},%u,%hu", trans, trans->port, ntohs(port), service_id);
spin_unlock(&peer->conn_gylock);
/* pick the new candidate */
- _debug("created connection: {%08x} [out]", htonl(candidate->conn_id));
+ _debug("created connection: {%08x} [out]", ntohl(candidate->conn_id));
atomic_inc(&peer->conn_count);
conn = candidate;
candidate = NULL;
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
- _debug("resurrecting connection: {%08x} [out]", htonl(conn->conn_id));
+ _debug("resurrecting connection: {%08x} [out]", ntohl(conn->conn_id));
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
list_del_init(&conn->link);
{
struct rxrpc_connection *conn, *candidate = NULL;
struct list_head *_p;
+ struct sk_buff *pkt = msg->pkt;
int ret, fresh = 0;
- u32 x_epoch, x_connid;
- u16 x_port, x_secix, x_servid;
+ __be32 x_epoch, x_connid;
+ __be16 x_port, x_servid;
+ __u32 x_secix;
u8 x_clflag;
_enter("%p{{%hu}},%u,%hu",
peer,
peer->trans->port,
- ntohs(msg->pkt->h.uh->source),
+ ntohs(pkt->h.uh->source),
ntohs(msg->hdr.serviceId));
- x_port = msg->pkt->h.uh->source;
+ x_port = pkt->h.uh->source;
x_epoch = msg->hdr.epoch;
x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED;
x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK);
/* fill in the specifics */
candidate->addr.sin_family = AF_INET;
candidate->addr.sin_port = x_port;
- candidate->addr.sin_addr.s_addr = msg->pkt->nh.iph->saddr;
+ candidate->addr.sin_addr.s_addr = pkt->nh.iph->saddr;
candidate->in_epoch = x_epoch;
candidate->out_epoch = x_epoch;
candidate->in_clientflag = RXRPC_CLIENT_INITIATED;
}
/* we can now add the new candidate to the list */
- _debug("created connection: {%08x} [in]", htonl(candidate->conn_id));
+ _debug("created connection: {%08x} [in]", ntohl(candidate->conn_id));
rxrpc_get_peer(peer);
conn = candidate;
candidate = NULL;
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
- _debug("resurrecting connection: {%08x} [in]", htonl(conn->conn_id));
+ _debug("resurrecting connection: {%08x} [in]", ntohl(conn->conn_id));
rxrpc_get_peer(peer);
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
}
/* move to graveyard queue */
- _debug("burying connection: {%08x}", htonl(conn->conn_id));
- list_del(&conn->link);
- list_add_tail(&conn->link, &peer->conn_graveyard);
+ _debug("burying connection: {%08x}", ntohl(conn->conn_id));
+ list_move_tail(&conn->link, &peer->conn_graveyard);
rxrpc_krxtimod_add_timer(&conn->timeout, rxrpc_conn_timeout * HZ);
/*
* free a connection record
*/
-void rxrpc_conn_do_timeout(struct rxrpc_connection *conn)
+static void rxrpc_conn_do_timeout(struct rxrpc_connection *conn)
{
struct rxrpc_peer *peer;
}
_debug("--- Destroying Connection %p{%08x} ---",
- conn, htonl(conn->conn_id));
+ conn, ntohl(conn->conn_id));
down_write(&rxrpc_conns_sem);
list_del(&conn->proc_link);
uint8_t type,
int dcount,
struct kvec diov[],
- int alloc_flags,
+ gfp_t alloc_flags,
struct rxrpc_message **_msg)
{
struct rxrpc_message *msg;
return -EINVAL;
}
- msg = kmalloc(sizeof(struct rxrpc_message), alloc_flags);
+ msg = kzalloc(sizeof(struct rxrpc_message), alloc_flags);
if (!msg) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
- memset(msg, 0, sizeof(*msg));
atomic_set(&msg->usage, 1);
INIT_LIST_HEAD(&msg->link);
_net("Sending message type %d of %Zd bytes to %08x:%d",
msg->hdr.type,
msg->dsize,
- htonl(conn->addr.sin_addr.s_addr),
- htons(conn->addr.sin_port));
+ ntohl(conn->addr.sin_addr.s_addr),
+ ntohs(conn->addr.sin_port));
/* send the message */
ret = kernel_sendmsg(conn->trans->socket, &msghdr,
struct rxrpc_message *msg)
{
struct rxrpc_message *pmsg;
+ struct dst_entry *dst;
struct list_head *_p;
unsigned cix, seq;
int ret = 0;
}
_proto("Received packet %%%u [%u] on call %hu:%u:%u",
- htonl(msg->hdr.serial),
- htonl(msg->hdr.seq),
- htons(msg->hdr.serviceId),
- htonl(conn->conn_id),
- htonl(call->call_id));
+ ntohl(msg->hdr.serial),
+ ntohl(msg->hdr.seq),
+ ntohs(msg->hdr.serviceId),
+ ntohl(conn->conn_id),
+ ntohl(call->call_id));
call->pkt_rcv_count++;
- if (msg->pkt->dst && msg->pkt->dst->dev)
+ dst = msg->pkt->dst;
+ if (dst && dst->dev)
conn->peer->if_mtu =
- msg->pkt->dst->dev->mtu -
- msg->pkt->dst->dev->hard_header_len;
+ dst->dev->mtu - dst->dev->hard_header_len;
/* queue on the call in seq order */
rxrpc_get_message(msg);