~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/um/drivers/slip_kern.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  4  */
  5 
  6 #include <linux/if_arp.h>
  7 #include <linux/init.h>
  8 #include <linux/netdevice.h>
  9 #include <net_kern.h>
 10 #include "slip.h"
 11 
 12 struct slip_init {
 13         char *gate_addr;
 14 };
 15 
 16 static void slip_init(struct net_device *dev, void *data)
 17 {
 18         struct uml_net_private *private;
 19         struct slip_data *spri;
 20         struct slip_init *init = data;
 21 
 22         private = netdev_priv(dev);
 23         spri = (struct slip_data *) private->user;
 24 
 25         memset(spri->name, 0, sizeof(spri->name));
 26         spri->addr = NULL;
 27         spri->gate_addr = init->gate_addr;
 28         spri->slave = -1;
 29         spri->dev = dev;
 30 
 31         slip_proto_init(&spri->slip);
 32 
 33         dev->hard_header_len = 0;
 34         dev->header_ops = NULL;
 35         dev->addr_len = 0;
 36         dev->type = ARPHRD_SLIP;
 37         dev->tx_queue_len = 256;
 38         dev->flags = IFF_NOARP;
 39         printk("SLIP backend - SLIP IP = %s\n", spri->gate_addr);
 40 }
 41 
 42 static unsigned short slip_protocol(struct sk_buff *skbuff)
 43 {
 44         return htons(ETH_P_IP);
 45 }
 46 
 47 static int slip_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
 48 {
 49         return slip_user_read(fd, skb_mac_header(skb), skb->dev->mtu,
 50                               (struct slip_data *) &lp->user);
 51 }
 52 
 53 static int slip_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
 54 {
 55         return slip_user_write(fd, skb->data, skb->len,
 56                                (struct slip_data *) &lp->user);
 57 }
 58 
 59 static const struct net_kern_info slip_kern_info = {
 60         .init                   = slip_init,
 61         .protocol               = slip_protocol,
 62         .read                   = slip_read,
 63         .write                  = slip_write,
 64 };
 65 
 66 static int slip_setup(char *str, char **mac_out, void *data)
 67 {
 68         struct slip_init *init = data;
 69 
 70         *init = ((struct slip_init) { .gate_addr = NULL });
 71 
 72         if (str[0] != '\0')
 73                 init->gate_addr = str;
 74         return 1;
 75 }
 76 
 77 static struct transport slip_transport = {
 78         .list           = LIST_HEAD_INIT(slip_transport.list),
 79         .name           = "slip",
 80         .setup          = slip_setup,
 81         .user           = &slip_user_info,
 82         .kern           = &slip_kern_info,
 83         .private_size   = sizeof(struct slip_data),
 84         .setup_size     = sizeof(struct slip_init),
 85 };
 86 
 87 static int register_slip(void)
 88 {
 89         register_transport(&slip_transport);
 90         return 0;
 91 }
 92 
 93 late_initcall(register_slip);
 94 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php