Beispiel #1
0
int sc_socket_recvpacket(struct sock* sk, struct sk_buff* skb) {
    TRACEKMOD("### sc_socket_recvpacket\n");

    /* */
    CAPWAP_SKB_CB(skb)->flags = SKB_CAPWAP_FLAG_FROM_DATA_CHANNEL;

    /* */
    sc_capwap_recvpacket(skb);
    return 0;
}
Beispiel #2
0
int sc_capwap_send(struct sc_capwap_session *session, uint8_t* buffer, int length)
{
	struct kvec vec = {
		.iov_base = buffer,
		.iov_len = length,
	};
        struct msghdr msg = {
		.msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL,
        };

	TRACEKMOD("### sc_capwap_send\n");

	return kernel_sendmsg(session->socket, &msg, &vec, 1, vec.iov_len);
}

int sc_capwap_recvpacket(struct sock *sk, struct sk_buff* skb)
{
	struct sc_capwap_session* session;

	TRACEKMOD("### sc_capwap_recvpacket\n");

	CAPWAP_SKB_CB(skb)->flags = SKB_CAPWAP_FLAG_FROM_DATA_CHANNEL;

	sock_hold(sk);

	/* Get session */
	session = (struct sc_capwap_session *)sk->sk_user_data;
	if (!session) {
		TRACEKMOD("*** Session not found\n");
		goto drop;

	}

	/* Remove UDP header */
	if (!skb_pull(skb, sizeof(struct udphdr))) {
		TRACEKMOD("*** Invalid packet\n");
		goto drop;
	}

	/* Parsing packet */
	if (sc_capwap_parsingpacket(session, skb)) {
		TRACEKMOD("*** Parsing error\n");
		goto drop;
	}

	sock_put(sk);
	return 0;

drop:
	sock_put(sk);
	kfree_skb(skb);

	return 0;
}

/* */
struct sc_capwap_session* sc_capwap_recvunknownkeepalive(struct sc_capwap_session* session,
							 const struct sc_capwap_sessionid_element* sessionid)
{
	TRACEKMOD("### sc_capwap_recvunknownkeepalive\n");

	return NULL;
}