1 #include "linux/config.h"
2 #include "linux/kernel.h"
3 #include "linux/stddef.h"
4 #include "linux/init.h"
5 #include "linux/netdevice.h"
6 #include "linux/if_arp.h"
16 void slip_init(struct net_device
*dev
, void *data
)
18 struct uml_net_private
*private;
19 struct slip_data
*spri
;
20 struct slip_init
*init
= data
;
23 spri
= (struct slip_data
*) private->user
;
25 memset(spri
->name
, 0, sizeof(spri
->name
));
27 spri
->gate_addr
= init
->gate_addr
;
31 slip_proto_init(&spri
->slip
);
34 dev
->header_cache_update
= NULL
;
35 dev
->hard_header_cache
= NULL
;
36 dev
->hard_header
= NULL
;
37 dev
->hard_header_len
= 0;
39 dev
->type
= ARPHRD_SLIP
;
40 dev
->tx_queue_len
= 256;
41 dev
->flags
= IFF_NOARP
;
42 printk("SLIP backend - SLIP IP = %s\n", spri
->gate_addr
);
45 static unsigned short slip_protocol(struct sk_buff
*skbuff
)
47 return(htons(ETH_P_IP
));
50 static int slip_read(int fd
, struct sk_buff
**skb
,
51 struct uml_net_private
*lp
)
53 return(slip_user_read(fd
, (*skb
)->mac
.raw
, (*skb
)->dev
->mtu
,
54 (struct slip_data
*) &lp
->user
));
57 static int slip_write(int fd
, struct sk_buff
**skb
,
58 struct uml_net_private
*lp
)
60 return(slip_user_write(fd
, (*skb
)->data
, (*skb
)->len
,
61 (struct slip_data
*) &lp
->user
));
64 struct net_kern_info slip_kern_info
= {
66 .protocol
= slip_protocol
,
71 static int slip_setup(char *str
, char **mac_out
, void *data
)
73 struct slip_init
*init
= data
;
75 *init
= ((struct slip_init
)
76 { .gate_addr
= NULL
});
79 init
->gate_addr
= str
;
83 static struct transport slip_transport
= {
84 .list
= LIST_HEAD_INIT(slip_transport
.list
),
87 .user
= &slip_user_info
,
88 .kern
= &slip_kern_info
,
89 .private_size
= sizeof(struct slip_data
),
90 .setup_size
= sizeof(struct slip_init
),
93 static int register_slip(void)
95 register_transport(&slip_transport
);
99 __initcall(register_slip
);