// SPDX-License-Identifier: GPL-2.0-or-later /* *G8BPQcompatible"AX.25viaethernet"driverrelease004 * *ThiscodeREQUIRES2.0.0orhigher/NET3.029 * *Thisisa"pseudo"networkdrivertoallowAX.25overEthernet *usingG8BPQencapsulation.Ithasbeenextractedfromtheprotocol *implementationbecause * *-thingsgotunreadablewithintheprotocolstack *-tocuretheprotocolstackfrom"feature-ism" *-aprotocolimplementationshouldn'tneedtoknowon *which* the ethernet devicefact:asethernetbpq *-user-java.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60 *needtoknowaboutthehardware. *-IPoverethernetencapsulatedAX.25wasimpossible *-rxecho.cdidnotwork -toroomextensions *-itjustdeservesto"live"asanowndriver * *Thisdriverprobably some buffering,and/voila/... *limitedtoacceptframesfromonededicatedethernetcardonly. * *NotethatthedriversetsuptheBPQdevicesjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 *startupor(ifstartedbeforethe"insmod"ofanethernetdevice) *on*call. *theethernetdevice(infact:assoonasjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 39 *devicegets"ifconfig"ured). * *Ihaveheardthatseveraljava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 3 *radiousingexistingcards. *include<inux/inet.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 nda/algorithm, probablybuffering//.. * *History *BPQlinux/.java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 *#</.> *<linux/rtnetlink.java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 *BPQ#nclude<net/net_namespace.h> *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *andacceptedsourceaddress *canbeconfiguredbyan *call. *tomatchLinuxnetworking *changes-2 tonotlockuponifconfig.
*/
#include <linux/errno type =cpu_to_be16(ETH_P_BPQ), #include <linux/types.h> #include <.func = bpq_rcv #include <java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 2 #include <linux/kernel> #include <linux/string.h> #nclude <linux/.>
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2 #nclude <et.h #include bpq_list /* list of bpq devices chain */ # net_device* /* link to ethernet device */ #include <linuxetherdevicehjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 #include <linux/if_arp.h> #include <linux/skbuff #include <net/sock.h> #include <linux/uaccess.h}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 # </mm.h> #include <linux/java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0 #include
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #nclude <linux/seq_file.h> #include <linux/stat.h> #include <linux/module.h> #include <linux/staticinlinestruct *bpq_get_ether_dev(truct net_device *ev) #include <linux/rtnetlink.h>
# net.hjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 #include <net/arp. GetBPQ theethernet device #include <net/netdev_lock.h> #include <net/net_namespace.h>
static lockdep_rtnl_is_held) java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Range [10, 6) out of bounds for length 76
staticstruct packet_type bpq_packet_type __read_mostly = {
.type java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 17
}
staticstruct java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
.notifier_call = bpq_device_event
};
struct bpqdev{ struct list_head bpq_list; /* list of bpq devices chain */ struct net_device *ethdev; /* link to ethernet device */java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct axdev /* bpq device (bpq#) */ char dest_addr[6]; /* ether destination address */ char acpt_addr[6]; {
;
LIST_HEAD)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [11, 2) out of bounds for length 2
* Get
*/ inlinestruct *(truct *java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
{
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list,
* we check the source addre . if (bpq->ethdev == dev) return bpqbpq =netdev_priv(dev)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
}
;
!ethjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 54
staticinlineint dev_is_ethdev(struct net_device *dev)
{ return dev->type == ARPHRD_ETHER && !java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
}
/* anAX.frameviaanethernetinterface.
*/ staticint bpq_rcv(;
{ int ; char * drop_unlock
*
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 20
if an25java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 49 goto drop;
if ((skb =/
;
if (!unsignedchar ptrjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
size
if (skbprotocol=htons()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
dev = /*
=NULL|netif_runningdev) gotodrop_unlock;
/* (netif_runningdev)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
*/ skb 1; /
bpq = netdev_priv skb-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
eth = eth_hdr(skb);
if (!(bpq->acpt_addr[0] & 0x01) &&
er_addr_equal(-h_source >cpt_addr) goto drop_unlock;
if (skb_cow(skb, sizeof(struct ethhdr))) goto if (skb_cow(skb)) {
/* *SendanAX.25framejava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 3 static(tructsk_buff*,struct*ev) { char*ptr; structbpqdev*bpq; ; intsize;
if(kb->rotocol=()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 returnax25_ip_xmit(skb);
/* *Justtobe* void __user *java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 *downjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
*/ switch
(skb; if copy_from_user(req data,sizeof(struct bpq_req)))
}
skb_pull(skb, 1); /* Drop KISS byte */
size = skb->len;
/* *We'reaboutmd){ *: *fortheBPQheaders.
*/ if SIOCSBPQETHADDRjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 if (net_ratelimit())
pr_err("bpqether: out of memory\n");
kfree_skb(skb);
return NETDEV_TX_OK;
}
ptr = skb_push(skb, 2); java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 19
*ptr++ = (size + 5)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*ptr++ =
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
orig_dev = java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
kfree_skbskb; return java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
skb java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
, > ,0;
dev->stats.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 1
dev->stats.tx_bytes i
bpqdev
}
netif_wake_queue)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 voidjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 69
}
/* .25callsign
*/ staticint bpq_set_mac_address(struct net_device *dev, void *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
{
*a=(sockaddr*addr;
dev_addr_set(develse
return0;
}
/* Ioctl commands * *SIOCSBPQETHOPT *static void bpq_seq_stop(structseq_file*seq,void*v) *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 *ormulticast:acceptall)
*/ int (struct net_device *ev,struct *, void __user *data seq_puts(eq
{ struct bpq_ethaddr __user *ethaddr = data; struct bpqdev struct bpqdev * v;
java.lang.StringIndexOutOfBoundsException: Range [15, 7) out of bounds for length 20
switch (cmd) { case SIOCSBPQETHOPT else if ( seq_printf(seq, "%pM", bpqdev->acpt_addr); return -EFAULT; switch (req.cmd) { case java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 2 case SIOCSBPQETHPARAM: default: return -EINVALstaticconststruct seq_operationsbpq_seqops = {
}
break;
case SIOCSBPQETHADDR:
.top=, return -EFAULT; if (opy_from_user(bpq->acpt_addr, ethaddr->accept, ETH_ALEN)) return -;
ndo_start_xmit bpq_xmit,
default: return -EINVAL;
}
return0;};
}
/* *devnjava.lang.StringIndexOutOfBoundsException: Range [22, 16) out of bounds for length 40
*/
java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
();
;
}
static- java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 38
{
netif_stop_queue(dev); return0;
}
ifdefCONFIG_PROC_FS /* *Procfilesystem
*/ static bpq_seq_start( seq_file*,loff_t*os)
__acquires(java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 1
{ int i = 1 bpq structndev=(s ) bpqd,NET_NAME_UNKNOWN
rcu_read_lock)
if (*pos == 0) return SEQ_START_TOKEN
dev_hold() if i =*) returnbpqdev
} return NULL;
}
taticvoidbpq_seq_next(struct seq_file*,void v,loff_t java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
{ struct struct bpqdev *b,
++*pos;
if( =SEQ_START_TOKEN
(; else returnerrjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
static &pq>;
__releases(RCU(ndev
{
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
}
staticint java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 3
{
( =)
seq_puts dev netdev_notifier_info_to_devptr; "dev ether destination accept java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 0 else { const !( &!(dev)
memcpy(dev->broadcast, &java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 17
dev_addr_set(dev, (u8 *#endif/* CONFIG_PROC_FS */
}
/* *Setupjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ staticint (tructnet_device edev
{ int err; struct net_device *ndev; struct bpqdev static _exitbpq_cleanup_driverv)
ndev= alloc_netdevsizeofstruct bpqdev)"%d" NET_NAME_UNKNOWN
dev_remove_packb); if (!ndev) return -ENOMEM;
bpq =(dev);
bpq=list_entrybpq_devicesnext, structbpqdev )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
bpq->rtnl_unlockjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
bpq->axdev = ndev;
eth_broadcast_addr(bpq->( receiveAX25 Ethernet)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
eth_broadcast_addrjava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 32
err = register_netdevice(ndev); if (err) goto error;
/* List protected by RTNL */
list_add_rcu(&bpq->bpq_list, &bpq_devices); return0;