Release 4.14 arch/um/drivers/pcap_kern.c
/*
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL.
*/
#include <linux/init.h>
#include <linux/netdevice.h>
#include <net_kern.h>
#include "pcap_user.h"
struct pcap_init {
char *host_if;
int promisc;
int optimize;
char *filter;
};
void pcap_init(struct net_device *dev, void *data)
{
struct uml_net_private *pri;
struct pcap_data *ppri;
struct pcap_init *init = data;
pri = netdev_priv(dev);
ppri = (struct pcap_data *) pri->user;
ppri->host_if = init->host_if;
ppri->promisc = init->promisc;
ppri->optimize = init->optimize;
ppri->filter = init->filter;
printk("pcap backend, host interface %s\n", ppri->host_if);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 77 | 85.56% | 3 | 60.00% |
David S. Miller | 10 | 11.11% | 1 | 20.00% |
Wang Chen | 3 | 3.33% | 1 | 20.00% |
Total | 90 | 100.00% | 5 | 100.00% |
static int pcap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
{
return pcap_user_read(fd, skb_mac_header(skb),
skb->dev->mtu + ETH_HEADER_OTHER,
(struct pcap_data *) &lp->user);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 45 | 93.75% | 1 | 50.00% |
Arnaldo Carvalho de Melo | 3 | 6.25% | 1 | 50.00% |
Total | 48 | 100.00% | 2 | 100.00% |
static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
{
return -EPERM;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 23 | 100.00% | 1 | 100.00% |
Total | 23 | 100.00% | 1 | 100.00% |
static const struct net_kern_info pcap_kern_info = {
.init = pcap_init,
.protocol = eth_protocol,
.read = pcap_read,
.write = pcap_write,
};
int pcap_setup(char *str, char **mac_out, void *data)
{
struct pcap_init *init = data;
char *remain, *host_if = NULL, *options[2] = { NULL, NULL };
int i;
*init = ((struct pcap_init)
{ .host_if = "eth0",
.promisc = 1,
.optimize = 0,
.filter = NULL });
remain = split_if_spec(str, &host_if, &init->filter,
&options[0], &options[1], mac_out, NULL);
if (remain != NULL) {
printk(KERN_ERR "pcap_setup - Extra garbage on "
"specification : '%s'\n", remain);
return 0;
}
if (host_if != NULL)
init->host_if = host_if;
for (i = 0; i < ARRAY_SIZE(options); i++) {
if (options[i] == NULL)
continue;
if (!strcmp(options[i], "promisc"))
init->promisc = 1;
else if (!strcmp(options[i], "nopromisc"))
init->promisc = 0;
else if (!strcmp(options[i], "optimize"))
init->optimize = 1;
else if (!strcmp(options[i], "nooptimize"))
init->optimize = 0;
else {
printk(KERN_ERR "pcap_setup : bad option - '%s'\n",
options[i]);
return 0;
}
}
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 270 | 100.00% | 6 | 100.00% |
Total | 270 | 100.00% | 6 | 100.00% |
static struct transport pcap_transport = {
.list = LIST_HEAD_INIT(pcap_transport.list),
.name = "pcap",
.setup = pcap_setup,
.user = &pcap_user_info,
.kern = &pcap_kern_info,
.private_size = sizeof(struct pcap_data),
.setup_size = sizeof(struct pcap_init),
};
static int register_pcap(void)
{
register_transport(&pcap_transport);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 17 | 100.00% | 2 | 100.00% |
Total | 17 | 100.00% | 2 | 100.00% |
late_initcall(register_pcap);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 552 | 96.84% | 9 | 69.23% |
David S. Miller | 10 | 1.75% | 1 | 7.69% |
Arnaldo Carvalho de Melo | 3 | 0.53% | 1 | 7.69% |
Wang Chen | 3 | 0.53% | 1 | 7.69% |
Al Viro | 2 | 0.35% | 1 | 7.69% |
Total | 570 | 100.00% | 13 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.