mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 22:54:01 +00:00
X25: Add if_x25.h and x25 to device identifiers
V2 Feedback from John Hughes. - Add header for userspace implementations such as xot/xoe to use - Use explicit values for interface stability - No changes to driver patches V1 - Use identifiers instead of magic numbers for X25 layer 3 to device interface. - Also fixed checkpatch notes on updated code. [ Add new user header to include/linux/Kbuild -DaveM ] Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f68c224fed
commit
5ebfbc06aa
4 changed files with 48 additions and 16 deletions
|
@ -94,6 +94,7 @@ header-y += if_ppp.h
|
||||||
header-y += if_slip.h
|
header-y += if_slip.h
|
||||||
header-y += if_strip.h
|
header-y += if_strip.h
|
||||||
header-y += if_tun.h
|
header-y += if_tun.h
|
||||||
|
header-y += if_x25.h
|
||||||
header-y += in_route.h
|
header-y += in_route.h
|
||||||
header-y += ioctl.h
|
header-y += ioctl.h
|
||||||
header-y += ip6_tunnel.h
|
header-y += ip6_tunnel.h
|
||||||
|
|
26
include/linux/if_x25.h
Normal file
26
include/linux/if_x25.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Linux X.25 packet to device interface
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _IF_X25_H
|
||||||
|
#define _IF_X25_H
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
|
||||||
|
/* Documentation/networking/x25-iface.txt */
|
||||||
|
#define X25_IFACE_DATA 0x00
|
||||||
|
#define X25_IFACE_CONNECT 0x01
|
||||||
|
#define X25_IFACE_DISCONNECT 0x02
|
||||||
|
#define X25_IFACE_PARAMS 0x03
|
||||||
|
|
||||||
|
#endif /* _IF_X25_H */
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <linux/if_ether.h>
|
#include <linux/if_ether.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
|
#include <linux/if_x25.h>
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
|
|
||||||
static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
|
static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <net/sock.h>
|
#include <net/sock.h>
|
||||||
#include <linux/if_arp.h>
|
#include <linux/if_arp.h>
|
||||||
#include <net/x25.h>
|
#include <net/x25.h>
|
||||||
|
#include <net/x25device.h>
|
||||||
|
|
||||||
static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
|
static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
|
||||||
{
|
{
|
||||||
|
@ -115,19 +116,22 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (skb->data[0]) {
|
switch (skb->data[0]) {
|
||||||
case 0x00:
|
|
||||||
skb_pull(skb, 1);
|
case X25_IFACE_DATA:
|
||||||
if (x25_receive_data(skb, nb)) {
|
skb_pull(skb, 1);
|
||||||
x25_neigh_put(nb);
|
if (x25_receive_data(skb, nb)) {
|
||||||
goto out;
|
x25_neigh_put(nb);
|
||||||
}
|
goto out;
|
||||||
break;
|
}
|
||||||
case 0x01:
|
break;
|
||||||
x25_link_established(nb);
|
|
||||||
break;
|
case X25_IFACE_CONNECT:
|
||||||
case 0x02:
|
x25_link_established(nb);
|
||||||
x25_link_terminated(nb);
|
break;
|
||||||
break;
|
|
||||||
|
case X25_IFACE_DISCONNECT:
|
||||||
|
x25_link_terminated(nb);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
x25_neigh_put(nb);
|
x25_neigh_put(nb);
|
||||||
drop:
|
drop:
|
||||||
|
@ -148,7 +152,7 @@ void x25_establish_link(struct x25_neigh *nb)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ptr = skb_put(skb, 1);
|
ptr = skb_put(skb, 1);
|
||||||
*ptr = 0x01;
|
*ptr = X25_IFACE_CONNECT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
|
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
|
||||||
|
@ -184,7 +188,7 @@ void x25_terminate_link(struct x25_neigh *nb)
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = skb_put(skb, 1);
|
ptr = skb_put(skb, 1);
|
||||||
*ptr = 0x02;
|
*ptr = X25_IFACE_DISCONNECT;
|
||||||
|
|
||||||
skb->protocol = htons(ETH_P_X25);
|
skb->protocol = htons(ETH_P_X25);
|
||||||
skb->dev = nb->dev;
|
skb->dev = nb->dev;
|
||||||
|
@ -200,7 +204,7 @@ void x25_send_frame(struct sk_buff *skb, struct x25_neigh *nb)
|
||||||
switch (nb->dev->type) {
|
switch (nb->dev->type) {
|
||||||
case ARPHRD_X25:
|
case ARPHRD_X25:
|
||||||
dptr = skb_push(skb, 1);
|
dptr = skb_push(skb, 1);
|
||||||
*dptr = 0x00;
|
*dptr = X25_IFACE_DATA;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
|
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
|
||||||
|
|
Loading…
Reference in a new issue