View | Details | Raw Unified
Collapse All | Expand All

(-) a/include/net/rose.h (-4 / +6 lines)
 Lines 6-12    Link Here 
#ifndef _ROSE_H
#ifndef _ROSE_H
#define _ROSE_H 
#define _ROSE_H 
#include <linux/rose.h>
#include <linux/rose.h>
#include <net/sock.h>
#define	ROSE_ADDR_LEN			5
#define	ROSE_ADDR_LEN			5
 Lines 114-120    Link Here 
	unsigned int		rand;
	unsigned int		rand;
};
};
typedef struct {
struct rose_sock {
	struct sock		sock;
	rose_address		source_addr,   dest_addr;
	rose_address		source_addr,   dest_addr;
	ax25_address		source_call,   dest_call;
	ax25_address		source_call,   dest_call;
	unsigned char		source_ndigis, dest_ndigis;
	unsigned char		source_ndigis, dest_ndigis;
 Lines 135-144    Link Here 
	struct rose_facilities_struct facilities;
	struct rose_facilities_struct facilities;
	struct timer_list	timer;
	struct timer_list	timer;
	struct timer_list	idletimer;
	struct timer_list	idletimer;
	struct sock		*sk;		/* Backlink to socket */
};
} rose_cb;
#define rose_sk(__sk) ((rose_cb *)(__sk)->sk_protinfo)
#define rose_sk(sk) ((struct rose_sock *)(sk))
/* af_rose.c */
/* af_rose.c */
extern ax25_address rose_callsign;
extern ax25_address rose_callsign;
(-) a/net/rose/af_rose.c (-37 / +20 lines)
 Lines 128-151    Link Here 
static struct sock *rose_alloc_sock(void)
static struct sock *rose_alloc_sock(void)
{
{
	rose_cb *rose;
	return sk_alloc(PF_ROSE, GFP_ATOMIC, sizeof(struct rose_sock), NULL);
	struct sock *sk = sk_alloc(PF_ROSE, GFP_ATOMIC, 1, NULL);
	if (!sk)
		goto out;
	rose = sk->sk_protinfo = kmalloc(sizeof(*rose), GFP_ATOMIC);
	if (!rose)
		goto frees;
	memset(rose, 0x00, sizeof(*rose));
	rose->sk = sk;
out:
	return sk;
frees:
	sk_free(sk);
	sk = NULL;
	goto out;
}
}
/*
/*
 Lines 169-175    Link Here 
	spin_lock_bh(&rose_list_lock);
	spin_lock_bh(&rose_list_lock);
	sk_for_each(s, node, &rose_list) {
	sk_for_each(s, node, &rose_list) {
		rose_cb *rose = rose_sk(s);
		struct rose_sock *rose = rose_sk(s);
		if (rose->neighbour == neigh) {
		if (rose->neighbour == neigh) {
			rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
			rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
 Lines 190-196    Link Here 
	spin_lock_bh(&rose_list_lock);
	spin_lock_bh(&rose_list_lock);
	sk_for_each(s, node, &rose_list) {
	sk_for_each(s, node, &rose_list) {
		rose_cb *rose = rose_sk(s);
		struct rose_sock *rose = rose_sk(s);
		if (rose->device == dev) {
		if (rose->device == dev) {
			rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
			rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
 Lines 247-253    Link Here 
	spin_lock_bh(&rose_list_lock);
	spin_lock_bh(&rose_list_lock);
	sk_for_each(s, node, &rose_list) {
	sk_for_each(s, node, &rose_list) {
		rose_cb *rose = rose_sk(s);
		struct rose_sock *rose = rose_sk(s);
		if (!rosecmp(&rose->source_addr, addr) &&
		if (!rosecmp(&rose->source_addr, addr) &&
		    !ax25cmp(&rose->source_call, call) &&
		    !ax25cmp(&rose->source_call, call) &&
 Lines 256-262    Link Here 
	}
	}
	sk_for_each(s, node, &rose_list) {
	sk_for_each(s, node, &rose_list) {
		rose_cb *rose = rose_sk(s);
		struct rose_sock *rose = rose_sk(s);
		if (!rosecmp(&rose->source_addr, addr) &&
		if (!rosecmp(&rose->source_addr, addr) &&
		    !ax25cmp(&rose->source_call, &null_ax25_address) &&
		    !ax25cmp(&rose->source_call, &null_ax25_address) &&
 Lines 279-285    Link Here 
	spin_lock_bh(&rose_list_lock);
	spin_lock_bh(&rose_list_lock);
	sk_for_each(s, node, &rose_list) {
	sk_for_each(s, node, &rose_list) {
		rose_cb *rose = rose_sk(s);
		struct rose_sock *rose = rose_sk(s);
		if (rose->lci == lci && rose->neighbour == neigh)
		if (rose->lci == lci && rose->neighbour == neigh)
			goto found;
			goto found;
 Lines 372-378    Link Here 
	char __user *optval, int optlen)
	char __user *optval, int optlen)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	int opt;
	int opt;
	if (level != SOL_ROSE)
	if (level != SOL_ROSE)
 Lines 432-438    Link Here 
	char __user *optval, int __user *optlen)
	char __user *optval, int __user *optlen)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	int val = 0;
	int val = 0;
	int len;
	int len;
 Lines 491-497    Link Here 
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	if (sk->sk_state != TCP_LISTEN) {
	if (sk->sk_state != TCP_LISTEN) {
		rose_cb *rose = rose_sk(sk);
		struct rose_sock *rose = rose_sk(sk);
		rose->dest_ndigis = 0;
		rose->dest_ndigis = 0;
		memset(&rose->dest_addr, 0, ROSE_ADDR_LEN);
		memset(&rose->dest_addr, 0, ROSE_ADDR_LEN);
 Lines 508-514    Link Here 
static int rose_create(struct socket *sock, int protocol)
static int rose_create(struct socket *sock, int protocol)
{
{
	struct sock *sk;
	struct sock *sk;
	rose_cb *rose;
	struct rose_sock *rose;
	if (sock->type != SOCK_SEQPACKET || protocol != 0)
	if (sock->type != SOCK_SEQPACKET || protocol != 0)
		return -ESOCKTNOSUPPORT;
		return -ESOCKTNOSUPPORT;
 Lines 547-553    Link Here 
static struct sock *rose_make_new(struct sock *osk)
static struct sock *rose_make_new(struct sock *osk)
{
{
	struct sock *sk;
	struct sock *sk;
	rose_cb *rose, *orose;
	struct rose_sock *rose, *orose;
	if (osk->sk_type != SOCK_SEQPACKET)
	if (osk->sk_type != SOCK_SEQPACKET)
		return NULL;
		return NULL;
 Lines 600-606    Link Here 
static int rose_release(struct socket *sock)
static int rose_release(struct socket *sock)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose;
	struct rose_sock *rose;
	if (sk == NULL) return 0;
	if (sk == NULL) return 0;
 Lines 646-652    Link Here 
static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;
	struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;
	struct net_device *dev;
	struct net_device *dev;
	ax25_address *user, *source;
	ax25_address *user, *source;
 Lines 705-711    Link Here 
static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags)
static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;
	struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;
	unsigned char cause, diagnostic;
	unsigned char cause, diagnostic;
	ax25_address *user;
	ax25_address *user;
 Lines 906-912    Link Here 
{
{
	struct full_sockaddr_rose *srose = (struct full_sockaddr_rose *)uaddr;
	struct full_sockaddr_rose *srose = (struct full_sockaddr_rose *)uaddr;
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	int n;
	int n;
	if (peer != 0) {
	if (peer != 0) {
 Lines 935-941    Link Here 
{
{
	struct sock *sk;
	struct sock *sk;
	struct sock *make;
	struct sock *make;
	rose_cb *make_rose;
	struct rose_sock *make_rose;
	struct rose_facilities_struct facilities;
	struct rose_facilities_struct facilities;
	int n, len;
	int n, len;
 Lines 1016-1022    Link Here 
			struct msghdr *msg, size_t len)
			struct msghdr *msg, size_t len)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	struct sockaddr_rose *usrose = (struct sockaddr_rose *)msg->msg_name;
	struct sockaddr_rose *usrose = (struct sockaddr_rose *)msg->msg_name;
	int err;
	int err;
	struct full_sockaddr_rose srose;
	struct full_sockaddr_rose srose;
 Lines 1186-1192    Link Here 
			struct msghdr *msg, size_t size, int flags)
			struct msghdr *msg, size_t size, int flags)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	struct sockaddr_rose *srose = (struct sockaddr_rose *)msg->msg_name;
	struct sockaddr_rose *srose = (struct sockaddr_rose *)msg->msg_name;
	size_t copied;
	size_t copied;
	unsigned char *asmptr;
	unsigned char *asmptr;
 Lines 1251-1257    Link Here 
static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
{
	struct sock *sk = sock->sk;
	struct sock *sk = sock->sk;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	void __user *argp = (void __user *)arg;
	void __user *argp = (void __user *)arg;
	switch (cmd) {
	switch (cmd) {
 Lines 1386-1392    Link Here 
	else {
	else {
		struct sock *s = v;
		struct sock *s = v;
		rose_cb *rose = rose_sk(s);
		struct rose_sock *rose = rose_sk(s);
		const char *devname, *callsign;
		const char *devname, *callsign;
		const struct net_device *dev = rose->device;
		const struct net_device *dev = rose->device;
(-) a/net/rose/rose_in.c (-5 / +5 lines)
 Lines 41-47    Link Here 
 */
 */
static int rose_state1_machine(struct sock *sk, struct sk_buff *skb, int frametype)
static int rose_state1_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	switch (frametype) {
	switch (frametype) {
	case ROSE_CALL_ACCEPTED:
	case ROSE_CALL_ACCEPTED:
 Lines 78-84    Link Here 
 */
 */
static int rose_state2_machine(struct sock *sk, struct sk_buff *skb, int frametype)
static int rose_state2_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	switch (frametype) {
	switch (frametype) {
	case ROSE_CLEAR_REQUEST:
	case ROSE_CLEAR_REQUEST:
 Lines 106-112    Link Here 
 */
 */
static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype, int ns, int nr, int q, int d, int m)
static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype, int ns, int nr, int q, int d, int m)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	int queued = 0;
	int queued = 0;
	switch (frametype) {
	switch (frametype) {
 Lines 216-222    Link Here 
 */
 */
static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int frametype)
static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	switch (frametype) {
	switch (frametype) {
	case ROSE_RESET_REQUEST:
	case ROSE_RESET_REQUEST:
 Lines 265-271    Link Here 
/* Higher level upcall for a LAPB frame */
/* Higher level upcall for a LAPB frame */
int rose_process_rx_frame(struct sock *sk, struct sk_buff *skb)
int rose_process_rx_frame(struct sock *sk, struct sk_buff *skb)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	int queued = 0, frametype, ns, nr, q, d, m;
	int queued = 0, frametype, ns, nr, q, d, m;
	if (rose->state == ROSE_STATE_0)
	if (rose->state == ROSE_STATE_0)
(-) a/net/rose/rose_out.c (-3 / +3 lines)
 Lines 33-39    Link Here 
 */
 */
static void rose_send_iframe(struct sock *sk, struct sk_buff *skb)
static void rose_send_iframe(struct sock *sk, struct sk_buff *skb)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	if (skb == NULL)
	if (skb == NULL)
		return;
		return;
 Lines 48-54    Link Here 
void rose_kick(struct sock *sk)
void rose_kick(struct sock *sk)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	struct sk_buff *skb, *skbn;
	struct sk_buff *skb, *skbn;
	unsigned short start, end;
	unsigned short start, end;
 Lines 112-118    Link Here 
void rose_enquiry_response(struct sock *sk)
void rose_enquiry_response(struct sock *sk)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	if (rose->condition & ROSE_COND_OWN_RX_BUSY)
	if (rose->condition & ROSE_COND_OWN_RX_BUSY)
		rose_write_internal(sk, ROSE_RNR);
		rose_write_internal(sk, ROSE_RNR);
(-) a/net/rose/rose_route.c (-2 / +4 lines)
 Lines 727-733    Link Here 
		}
		}
		if (rose_route.mask > 10) /* Mask can't be more than 10 digits */
		if (rose_route.mask > 10) /* Mask can't be more than 10 digits */
			return -EINVAL;
			return -EINVAL;
		if (rose_route.ndigis > 8) /* No more than 8 digipeats */
			return -EINVAL;
		err = rose_add_node(&rose_route, dev);
		err = rose_add_node(&rose_route, dev);
		dev_put(dev);
		dev_put(dev);
		return err;
		return err;
 Lines 899-905    Link Here 
	 */
	 */
	if ((sk = rose_find_socket(lci, rose_neigh)) != NULL) {
	if ((sk = rose_find_socket(lci, rose_neigh)) != NULL) {
		if (frametype == ROSE_CALL_REQUEST) {
		if (frametype == ROSE_CALL_REQUEST) {
			rose_cb *rose = rose_sk(sk);
			struct rose_sock *rose = rose_sk(sk);
			/* Remove an existing unused socket */
			/* Remove an existing unused socket */
			rose_clear_queues(sk);
			rose_clear_queues(sk);
			rose->cause	 = ROSE_NETWORK_CONGESTION;
			rose->cause	 = ROSE_NETWORK_CONGESTION;
(-) a/net/rose/rose_subr.c (-6 / +6 lines)
 Lines 28-34    Link Here 
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <net/rose.h>
#include <net/rose.h>
static int rose_create_facilities(unsigned char *buffer, rose_cb *rose);
static int rose_create_facilities(unsigned char *buffer, struct rose_sock *rose);
/*
/*
 *	This routine purges all of the queues of frames.
 *	This routine purges all of the queues of frames.
 Lines 47-53    Link Here 
void rose_frames_acked(struct sock *sk, unsigned short nr)
void rose_frames_acked(struct sock *sk, unsigned short nr)
{
{
	struct sk_buff *skb;
	struct sk_buff *skb;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	/*
	/*
	 * Remove all the ack-ed frames from the ack queue.
	 * Remove all the ack-ed frames from the ack queue.
 Lines 85-91    Link Here 
 */
 */
int rose_validate_nr(struct sock *sk, unsigned short nr)
int rose_validate_nr(struct sock *sk, unsigned short nr)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	unsigned short vc = rose->va;
	unsigned short vc = rose->va;
	while (vc != rose->vs) {
	while (vc != rose->vs) {
 Lines 102-108    Link Here 
 */
 */
void rose_write_internal(struct sock *sk, int frametype)
void rose_write_internal(struct sock *sk, int frametype)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	struct sk_buff *skb;
	struct sk_buff *skb;
	unsigned char  *dptr;
	unsigned char  *dptr;
	unsigned char  lci1, lci2;
	unsigned char  lci1, lci2;
 Lines 396-402    Link Here 
	return 1;
	return 1;
}
}
static int rose_create_facilities(unsigned char *buffer, rose_cb *rose)
static int rose_create_facilities(unsigned char *buffer, struct rose_sock *rose)
{
{
	unsigned char *p = buffer + 1;
	unsigned char *p = buffer + 1;
	char *callsign;
	char *callsign;
 Lines 492-498    Link Here 
void rose_disconnect(struct sock *sk, int reason, int cause, int diagnostic)
void rose_disconnect(struct sock *sk, int reason, int cause, int diagnostic)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	rose_stop_timer(sk);
	rose_stop_timer(sk);
	rose_stop_idletimer(sk);
	rose_stop_idletimer(sk);
(-) a/net/rose/rose_timer.c (-7 / +7 lines)
 Lines 46-52    Link Here 
void rose_start_t1timer(struct sock *sk)
void rose_start_t1timer(struct sock *sk)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	del_timer(&rose->timer);
	del_timer(&rose->timer);
 Lines 59-65    Link Here 
void rose_start_t2timer(struct sock *sk)
void rose_start_t2timer(struct sock *sk)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	del_timer(&rose->timer);
	del_timer(&rose->timer);
 Lines 72-78    Link Here 
void rose_start_t3timer(struct sock *sk)
void rose_start_t3timer(struct sock *sk)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	del_timer(&rose->timer);
	del_timer(&rose->timer);
 Lines 85-91    Link Here 
void rose_start_hbtimer(struct sock *sk)
void rose_start_hbtimer(struct sock *sk)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	del_timer(&rose->timer);
	del_timer(&rose->timer);
 Lines 98-104    Link Here 
void rose_start_idletimer(struct sock *sk)
void rose_start_idletimer(struct sock *sk)
{
{
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	del_timer(&rose->idletimer);
	del_timer(&rose->idletimer);
 Lines 129-135    Link Here 
static void rose_heartbeat_expiry(unsigned long param)
static void rose_heartbeat_expiry(unsigned long param)
{
{
	struct sock *sk = (struct sock *)param;
	struct sock *sk = (struct sock *)param;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	bh_lock_sock(sk);
	bh_lock_sock(sk);
	switch (rose->state) {
	switch (rose->state) {
 Lines 166-172    Link Here 
static void rose_timer_expiry(unsigned long param)
static void rose_timer_expiry(unsigned long param)
{
{
	struct sock *sk = (struct sock *)param;
	struct sock *sk = (struct sock *)param;
	rose_cb *rose = rose_sk(sk);
	struct rose_sock *rose = rose_sk(sk);
	bh_lock_sock(sk);
	bh_lock_sock(sk);
	switch (rose->state) {
	switch (rose->state) {
(-) a/drivers/scsi/st.c (-1 / +7 lines)
 Lines 3461-3471    Link Here 
		case SCSI_IOCTL_GET_BUS_NUMBER:
		case SCSI_IOCTL_GET_BUS_NUMBER:
			break;
			break;
		default:
		default:
			i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
			if (!capable(CAP_SYS_ADMIN))
				i = -EPERM;
			else
				i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
			if (i != -ENOTTY)
			if (i != -ENOTTY)
				return i;
				return i;
			break;
			break;
	}
	}
	if (!capable(CAP_SYS_ADMIN) &&
	    (cmd_in == SCSI_IOCTL_START_UNIT || cmd_in == SCSI_IOCTL_STOP_UNIT))
		return -EPERM;
	return scsi_ioctl(STp->device, cmd_in, p);
	return scsi_ioctl(STp->device, cmd_in, p);
 out:
 out: