Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214545
b: refs/heads/master
c: 6482f55
h: refs/heads/master
i:
  214543: bda5a27
v: v3
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Sep 16, 2010
1 parent b6c7364 commit c3c84fa
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 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: 7fedd7e5dfeb0f6bd69ee120b5c44a5e49892e47
refs/heads/master: 6482f554e2b9cbe733d63124765104f29cf0c9ad
5 changes: 5 additions & 0 deletions trunk/include/net/phonet/pep.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
#define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4)

enum {
PNS_PIPE_CREATE_REQ = 0x00,
PNS_PIPE_CREATE_RESP,
PNS_PIPE_REMOVE_REQ,
PNS_PIPE_REMOVE_RESP,

PNS_PIPE_DATA = 0x20,
PNS_PIPE_ALIGNED_DATA,

Expand Down
27 changes: 26 additions & 1 deletion trunk/net/phonet/pep.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,28 @@ static int pep_do_rcv(struct sock *sk, struct sk_buff *skb)
return err;
}

static int pipe_do_remove(struct sock *sk)
{
struct pep_sock *pn = pep_sk(sk);
struct pnpipehdr *ph;
struct sk_buff *skb;

skb = alloc_skb(MAX_PNPIPE_HEADER, GFP_KERNEL);
if (!skb)
return -ENOMEM;

skb_reserve(skb, MAX_PNPIPE_HEADER);
__skb_push(skb, sizeof(*ph));
skb_reset_transport_header(skb);
ph = pnp_hdr(skb);
ph->utid = 0;
ph->message_id = PNS_PIPE_REMOVE_REQ;
ph->pipe_handle = pn->pipe_handle;
ph->data[0] = PAD;

return pn_skb_send(sk, skb, &pipe_srv);
}

/* associated socket ceases to exist */
static void pep_sock_close(struct sock *sk, long timeout)
{
Expand All @@ -638,7 +660,10 @@ static void pep_sock_close(struct sock *sk, long timeout)
sk_for_each_safe(sknode, p, n, &pn->ackq)
sk_del_node_init(sknode);
sk->sk_state = TCP_CLOSE;
}
} else if ((1 << sk->sk_state) & (TCPF_SYN_RECV|TCPF_ESTABLISHED))
/* Forcefully remove dangling Phonet pipe */
pipe_do_remove(sk);

ifindex = pn->ifindex;
pn->ifindex = 0;
release_sock(sk);
Expand Down

0 comments on commit c3c84fa

Please sign in to comment.