Skip to content

Commit

Permalink
inetpeer: Add inet_getpeer_v6()
Browse files Browse the repository at this point in the history
Now that all of the infrastructure is in place, we can add
the ipv6 shorthand for peer creation.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 30, 2010
1 parent 021e929 commit 672f007
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/net/inetpeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/spinlock.h>
#include <net/ipv6.h>
#include <asm/atomic.h>

typedef struct {
Expand Down Expand Up @@ -61,6 +62,15 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
return inet_getpeer(&daddr, create);
}

static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int create)
{
inet_peer_address_t daddr;

ipv6_addr_copy((struct in6_addr *)daddr.a6, v6daddr);
daddr.family = AF_INET6;
return inet_getpeer(&daddr, create);
}

/* can be called from BH context or outside */
extern void inet_putpeer(struct inet_peer *p);

Expand Down

0 comments on commit 672f007

Please sign in to comment.