cregit-Linux how code gets into the kernel

Release 4.10 drivers/net/ppp/pppox.c

Directory: drivers/net/ppp
/** -*- linux-c -*- ***********************************************************
 * Linux PPP over X/Ethernet (PPPoX/PPPoE) Sockets
 *
 * PPPoX --- Generic PPP encapsulation socket family
 * PPPoE --- PPP over Ethernet (RFC 2516)
 *
 *
 * Version:     0.5.2
 *
 * Author:      Michal Ostrowski <mostrows@speakeasy.net>
 *
 * 051000 :     Initialization cleanup
 *
 * License:
 *              This program is free software; you can redistribute it and/or
 *              modify it under the terms of the GNU General Public License
 *              as published by the Free Software Foundation; either version
 *              2 of the License, or (at your option) any later version.
 *
 */

#include <linux/string.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/net.h>
#include <linux/init.h>
#include <linux/if_pppox.h>
#include <linux/ppp_defs.h>
#include <linux/ppp-ioctl.h>
#include <linux/ppp_channel.h>
#include <linux/kmod.h>

#include <net/sock.h>

#include <linux/uaccess.h>


static const struct pppox_proto *pppox_protos[PX_MAX_PROTO + 1];


int register_pppox_proto(int proto_num, const struct pppox_proto *pp) { if (proto_num < 0 || proto_num > PX_MAX_PROTO) return -EINVAL; if (pppox_protos[proto_num]) return -EALREADY; pppox_protos[proto_num] = pp; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git4693.88%133.33%
arnaldo carvalho de meloarnaldo carvalho de melo24.08%133.33%
eric dumazeteric dumazet12.04%133.33%
Total49100.00%3100.00%


void unregister_pppox_proto(int proto_num) { if (proto_num >= 0 && proto_num <= PX_MAX_PROTO) pppox_protos[proto_num] = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git2496.00%150.00%
arnaldo carvalho de meloarnaldo carvalho de melo14.00%150.00%
Total25100.00%2100.00%


void pppox_unbind_sock(struct sock *sk) { /* Clear connection to ppp device, if attached. */ if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED)) { ppp_unregister_channel(&pppox_sk(sk)->chan); sk->sk_state = PPPOX_DEAD; } }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git3173.81%120.00%
michal ostrowskimichal ostrowski511.90%120.00%
david s. millerdavid s. miller37.14%120.00%
arnaldo carvalho de meloarnaldo carvalho de melo24.76%120.00%
florian zumbiehlflorian zumbiehl12.38%120.00%
Total42100.00%5100.00%

EXPORT_SYMBOL(register_pppox_proto); EXPORT_SYMBOL(unregister_pppox_proto); EXPORT_SYMBOL(pppox_unbind_sock);
int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; struct pppox_sock *po = pppox_sk(sk); int rc; lock_sock(sk); switch (cmd) { case PPPIOCGCHAN: { int index; rc = -ENOTCONN; if (!(sk->sk_state & PPPOX_CONNECTED)) break; rc = -EINVAL; index = ppp_channel_index(&po->chan); if (put_user(index , (int __user *) arg)) break; rc = 0; sk->sk_state |= PPPOX_BOUND; break; } default: rc = pppox_protos[sk->sk_protocol]->ioctl ? pppox_protos[sk->sk_protocol]->ioctl(sock, cmd, arg) : -ENOTTY; } release_sock(sk); return rc; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git12882.05%114.29%
arnaldo carvalho de meloarnaldo carvalho de melo1610.26%342.86%
florian zumbiehlflorian zumbiehl63.85%114.29%
david s. millerdavid s. miller53.21%114.29%
al viroal viro10.64%114.29%
Total156100.00%7100.00%

EXPORT_SYMBOL(pppox_ioctl);
static int pppox_create(struct net *net, struct socket *sock, int protocol, int kern) { int rc = -EPROTOTYPE; if (protocol < 0 || protocol > PX_MAX_PROTO) goto out; rc = -EPROTONOSUPPORT; if (!pppox_protos[protocol]) request_module("net-pf-%d-proto-%d", PF_PPPOX, protocol); if (!pppox_protos[protocol] || !try_module_get(pppox_protos[protocol]->owner)) goto out; rc = pppox_protos[protocol]->create(net, sock, kern); module_put(pppox_protos[protocol]->owner); out: return rc; }

Contributors

PersonTokensPropCommitsCommitProp
arnaldo carvalho de meloarnaldo carvalho de melo4538.79%327.27%
pre-gitpre-git4135.34%19.09%
james chapmanjames chapman1311.21%19.09%
eric w. biedermaneric w. biederman97.76%218.18%
eric pariseric paris32.59%19.09%
guillaume naultguillaume nault32.59%19.09%
linus torvaldslinus torvalds10.86%19.09%
johannes bergjohannes berg10.86%19.09%
Total116100.00%11100.00%

static const struct net_proto_family pppox_proto_family = { .family = PF_PPPOX, .create = pppox_create, .owner = THIS_MODULE, };
static int __init pppox_init(void) { return sock_register(&pppox_proto_family); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1487.50%360.00%
arnaldo carvalho de meloarnaldo carvalho de melo16.25%120.00%
linus torvaldslinus torvalds16.25%120.00%
Total16100.00%5100.00%


static void __exit pppox_exit(void) { sock_unregister(PF_PPPOX); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1392.86%266.67%
linus torvaldslinus torvalds17.14%133.33%
Total14100.00%3100.00%

module_init(pppox_init); module_exit(pppox_exit); MODULE_AUTHOR("Michal Ostrowski <mostrows@speakeasy.net>"); MODULE_DESCRIPTION("PPP over Ethernet driver (generic socket layer)"); MODULE_LICENSE("GPL"); MODULE_ALIAS_NETPROTO(PF_PPPOX);

Overall Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git37368.32%310.71%
arnaldo carvalho de meloarnaldo carvalho de melo8515.57%725.00%
linus torvaldslinus torvalds203.66%310.71%
james chapmanjames chapman162.93%13.57%
david s. millerdavid s. miller132.38%27.14%
eric w. biedermaneric w. biederman91.65%27.14%
guillaume naultguillaume nault81.47%13.57%
florian zumbiehlflorian zumbiehl71.28%27.14%
michal ostrowskimichal ostrowski61.10%13.57%
eric pariseric paris30.55%13.57%
eric dumazeteric dumazet20.37%13.57%
stephen hemmingerstephen hemminger10.18%13.57%
al viroal viro10.18%13.57%
johannes bergjohannes berg10.18%13.57%
paul mackerraspaul mackerras10.18%13.57%
Total546100.00%28100.00%
Directory: drivers/net/ppp
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.