]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - net/ax25/ax25_ds_in.c
Documentation: Delete dead OSS-related kernel parameter.
[mirror_ubuntu-jammy-kernel.git] / net / ax25 / ax25_ds_in.c
CommitLineData
1da177e4
LT
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
8 * Copyright (C) Joerg Reuter DL1BKE (jreuter@yaina.de)
9 */
10#include <linux/errno.h>
11#include <linux/types.h>
12#include <linux/socket.h>
13#include <linux/in.h>
14#include <linux/kernel.h>
1da177e4
LT
15#include <linux/timer.h>
16#include <linux/string.h>
17#include <linux/sockios.h>
18#include <linux/net.h>
19#include <net/ax25.h>
20#include <linux/inet.h>
21#include <linux/netdevice.h>
22#include <linux/skbuff.h>
23#include <net/sock.h>
c752f073 24#include <net/tcp_states.h>
1da177e4
LT
25#include <asm/uaccess.h>
26#include <asm/system.h>
27#include <linux/fcntl.h>
28#include <linux/mm.h>
29#include <linux/interrupt.h>
30
31/*
32 * State machine for state 1, Awaiting Connection State.
33 * The handling of the timer(s) is in file ax25_ds_timer.c.
34 * Handling of state 0 and connection release is in ax25.c.
35 */
36static int ax25_ds_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type)
37{
38 switch (frametype) {
39 case AX25_SABM:
40 ax25->modulus = AX25_MODULUS;
41 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
42 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
43 break;
44
45 case AX25_SABME:
46 ax25->modulus = AX25_EMODULUS;
47 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW];
48 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
49 break;
50
51 case AX25_DISC:
52 ax25_send_control(ax25, AX25_DM, pf, AX25_RESPONSE);
53 break;
54
55 case AX25_UA:
56 ax25_calculate_rtt(ax25);
57 ax25_stop_t1timer(ax25);
58 ax25_start_t3timer(ax25);
59 ax25_start_idletimer(ax25);
60 ax25->vs = 0;
61 ax25->va = 0;
62 ax25->vr = 0;
63 ax25->state = AX25_STATE_3;
64 ax25->n2count = 0;
65 if (ax25->sk != NULL) {
66 bh_lock_sock(ax25->sk);
67 ax25->sk->sk_state = TCP_ESTABLISHED;
68 /*
69 * For WAIT_SABM connections we will produce an accept
70 * ready socket here
71 */
72 if (!sock_flag(ax25->sk, SOCK_DEAD))
73 ax25->sk->sk_state_change(ax25->sk);
74 bh_unlock_sock(ax25->sk);
75 }
76 ax25_dama_on(ax25);
77
78