Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57159
b: refs/heads/master
c: a2efcfa
h: refs/heads/master
i:
  57157: 2f84ef5
  57155: abca7a3
  57151: ee741d1
v: v3
  • Loading branch information
David S. Miller committed May 31, 2007
1 parent d2c83e9 commit 62c6f7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ddc31ce311b65fc3c30ec9ca5baf688a882260bc
refs/heads/master: a2efcfa04865eaaa88b870f4babf12f4c1fc4f83
31 changes: 4 additions & 27 deletions trunk/net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,6 @@

#define CONFIG_SOCK_PACKET 1

/*
Proposed replacement for SIOC{ADD,DEL}MULTI and
IFF_PROMISC, IFF_ALLMULTI flags.
It is more expensive, but I believe,
it is really correct solution: reentereble, safe and fault tolerant.
IFF_PROMISC/IFF_ALLMULTI/SIOC{ADD/DEL}MULTI are faked by keeping
reference count and global flag, so that real status is
(gflag|(count != 0)), so that we can use obsolete faulty interface
not harming clever users.
*/
#define CONFIG_PACKET_MULTICAST 1

/*
Assumptions:
- if device has no dev->hard_header routine, it adds and removes ll header
Expand Down Expand Up @@ -159,7 +145,6 @@ static atomic_t packet_socks_nr;

/* Private packet socket structures. */

#ifdef CONFIG_PACKET_MULTICAST
struct packet_mclist
{
struct packet_mclist *next;
Expand All @@ -179,7 +164,7 @@ struct packet_mreq_max
unsigned short mr_alen;
unsigned char mr_address[MAX_ADDR_LEN];
};
#endif

#ifdef CONFIG_PACKET_MMAP
static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing);
#endif
Expand All @@ -205,9 +190,7 @@ struct packet_sock {
origdev:1;
int ifindex; /* bound device */
__be16 num;
#ifdef CONFIG_PACKET_MULTICAST
struct packet_mclist *mclist;
#endif
#ifdef CONFIG_PACKET_MMAP
atomic_t mapped;
unsigned int pg_vec_order;
Expand Down Expand Up @@ -851,9 +834,7 @@ static int packet_release(struct socket *sock)
__sock_put(sk);
}

#ifdef CONFIG_PACKET_MULTICAST
packet_flush_mclist(sk);
#endif

#ifdef CONFIG_PACKET_MMAP
if (po->pg_vec) {
Expand Down Expand Up @@ -1221,7 +1202,6 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
return 0;
}

#ifdef CONFIG_PACKET_MULTICAST
static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what)
{
switch (i->type) {
Expand Down Expand Up @@ -1349,7 +1329,6 @@ static void packet_flush_mclist(struct sock *sk)
}
rtnl_unlock();
}
#endif

static int
packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
Expand All @@ -1362,7 +1341,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
return -ENOPROTOOPT;

switch(optname) {
#ifdef CONFIG_PACKET_MULTICAST
case PACKET_ADD_MEMBERSHIP:
case PACKET_DROP_MEMBERSHIP:
{
Expand All @@ -1383,7 +1361,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
ret = packet_mc_drop(sk, &mreq);
return ret;
}
#endif

#ifdef CONFIG_PACKET_MMAP
case PACKET_RX_RING:
{
Expand Down Expand Up @@ -1506,11 +1484,10 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void

switch (msg) {
case NETDEV_UNREGISTER:
#ifdef CONFIG_PACKET_MULTICAST
if (po->mclist)
packet_dev_mclist(dev, po->mclist, -1);
// fallthrough
#endif
/* fallthrough */

case NETDEV_DOWN:
if (dev->ifindex == po->ifindex) {
spin_lock(&po->bind_lock);
Expand Down

0 comments on commit 62c6f7b

Please sign in to comment.