Skip to content

Commit

Permalink
netpoll: prepare for ipv6
Browse files Browse the repository at this point in the history
This patch adjusts some struct and functions, to prepare
for supporting IPv6.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Cong Wang authored and David S. Miller committed Jan 9, 2013
1 parent 0c7768a commit b7394d2
Show file tree
Hide file tree
Showing 3 changed files with 243 additions and 184 deletions.
12 changes: 8 additions & 4 deletions drivers/net/netconsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,14 @@ static ssize_t show_remote_port(struct netconsole_target *nt, char *buf)

static ssize_t show_local_ip(struct netconsole_target *nt, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.local_ip);
if (!nt->np.ipv6)
return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.local_ip);
}

static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip);
if (!nt->np.ipv6)
return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip);
}

static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
Expand Down Expand Up @@ -410,7 +412,8 @@ static ssize_t store_local_ip(struct netconsole_target *nt,
return -EINVAL;
}

nt->np.local_ip = in_aton(buf);
if (!strnchr(buf, count, ':'))
nt->np.local_ip.ip = in_aton(buf);

return strnlen(buf, count);
}
Expand All @@ -426,7 +429,8 @@ static ssize_t store_remote_ip(struct netconsole_target *nt,
return -EINVAL;
}

nt->np.remote_ip = in_aton(buf);
if (!strnchr(buf, count, ':'))
nt->np.remote_ip.ip = in_aton(buf);

return strnlen(buf, count);
}
Expand Down
13 changes: 11 additions & 2 deletions include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@
#include <linux/rcupdate.h>
#include <linux/list.h>

union inet_addr {
__u32 all[4];
__be32 ip;
__be32 ip6[4];
struct in_addr in;
struct in6_addr in6;
};

struct netpoll {
struct net_device *dev;
char dev_name[IFNAMSIZ];
const char *name;
void (*rx_hook)(struct netpoll *, int, char *, int);

__be32 local_ip, remote_ip;
union inet_addr local_ip, remote_ip;
bool ipv6;
u16 local_port, remote_port;
u8 remote_mac[ETH_ALEN];

Expand All @@ -33,7 +42,7 @@ struct netpoll_info {
spinlock_t rx_lock;
struct list_head rx_np; /* netpolls that registered an rx_hook */

struct sk_buff_head arp_tx; /* list of arp requests to reply to */
struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
struct sk_buff_head txq;

struct delayed_work tx_work;
Expand Down
Loading

0 comments on commit b7394d2

Please sign in to comment.