1 #include "linux/kernel.h"
2 #include "linux/stddef.h"
3 #include "linux/init.h"
4 #include "linux/netdevice.h"
5 #include "linux/if_arp.h"
12 struct arg_list_dummy_wrapper argw; /* XXX should be simpler... */
15 void slirp_init(struct net_device *dev, void *data)
17 struct uml_net_private *private;
18 struct slirp_data *spri;
19 struct slirp_init *init = data;
23 spri = (struct slirp_data *) private->user;
24 *spri = ((struct slirp_data)
28 .slip = SLIP_PROTO_INIT,
32 dev->hard_header_len = 0;
33 dev->header_cache_update = NULL;
34 dev->hard_header_cache = NULL;
35 dev->hard_header = NULL;
37 dev->type = ARPHRD_SLIP;
38 dev->tx_queue_len = 256;
39 dev->flags = IFF_NOARP;
40 printk("SLIRP backend - command line:");
41 for(i=0;spri->argw.argv[i]!=NULL;i++) {
42 printk(" '%s'",spri->argw.argv[i]);
47 static unsigned short slirp_protocol(struct sk_buff *skbuff)
49 return(htons(ETH_P_IP));
52 static int slirp_read(int fd, struct sk_buff **skb,
53 struct uml_net_private *lp)
55 return(slirp_user_read(fd, (*skb)->mac.raw, (*skb)->dev->mtu,
56 (struct slirp_data *) &lp->user));
59 static int slirp_write(int fd, struct sk_buff **skb,
60 struct uml_net_private *lp)
62 return(slirp_user_write(fd, (*skb)->data, (*skb)->len,
63 (struct slirp_data *) &lp->user));
66 struct net_kern_info slirp_kern_info = {
68 .protocol = slirp_protocol,
73 static int slirp_setup(char *str, char **mac_out, void *data)
75 struct slirp_init *init = data;
78 *init = ((struct slirp_init)
79 { argw : { { "slirp", NULL } } });
81 str = split_if_spec(str, mac_out, NULL);
83 if(str == NULL) { /* no command line given after MAC addr */
88 if(i>=SLIRP_MAX_ARGS-1) {
89 printk("slirp_setup: truncating slirp arguments\n");
92 init->argw.argv[i++] = str;
93 while(*str && *str!=',') {
94 if(*str=='_') *str=' ';
101 init->argw.argv[i]=NULL;
105 static struct transport slirp_transport = {
106 .list = LIST_HEAD_INIT(slirp_transport.list),
108 .setup = slirp_setup,
109 .user = &slirp_user_info,
110 .kern = &slirp_kern_info,
111 .private_size = sizeof(struct slirp_data),
112 .setup_size = sizeof(struct slirp_init),
115 static int register_slirp(void)
117 register_transport(&slirp_transport);
121 __initcall(register_slirp);
124 * Overrides for Emacs so that we follow Linus's tabbing style.
125 * Emacs will notice this stuff at the end of the file and automatically
126 * adjust the settings for this buffer only. This must remain at the end
128 * ---------------------------------------------------------------------------
130 * c-file-style: "linux"