summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-07-12 19:07:26 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-07-12 19:07:26 +0400
commit0df0604e7606b38f1f3fc4a2c92dbad720654f3c (patch)
treecfe57070ccef10ea4efc8adfa85f868dfc1a2573
parent22c8cf9724a2766b5f38afbc250065308c2bd7e2 (diff)
downloadaccel-ppp-0df0604e7606b38f1f3fc4a2c92dbad720654f3c.tar.gz
accel-ppp-0df0604e7606b38f1f3fc4a2c92dbad720654f3c.zip
ipoe: per-interface static dhcp pool of addresses
-rw-r--r--accel-pppd/ctrl/ipoe/dhcpv4.c171
-rw-r--r--accel-pppd/ctrl/ipoe/dhcpv4.h21
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c64
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.h3
-rw-r--r--drivers/ipoe/ipoe.c16
5 files changed, 235 insertions, 40 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c
index 7891181..f1a8876 100644
--- a/accel-pppd/ctrl/ipoe/dhcpv4.c
+++ b/accel-pppd/ctrl/ipoe/dhcpv4.c
@@ -42,7 +42,54 @@ static mempool_t opt_pool;
static int dhcpv4_read(struct triton_md_handler_t *h);
-struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifname)
+static struct dhcpv4_iprange *parse_range(const char *str)
+{
+ unsigned int f1,f2,f3,f4,m,n, mask, start, end, len;
+ struct dhcpv4_iprange *r;
+
+ n = sscanf(str, "%u.%u.%u.%u/%u", &f1, &f2, &f3, &f4, &m);
+
+ if (n != 5)
+ goto parse_err;
+ if (f1 > 255)
+ goto parse_err;
+ if (f2 > 255)
+ goto parse_err;
+ if (f3 > 255)
+ goto parse_err;
+ if (f4 > 255)
+ goto parse_err;
+ if (m == 0 || m > 30)
+ goto parse_err;
+
+ start = (f1 << 24) | (f2 << 16) | (f3 << 8) | f4;
+ mask = ~((1 << (32 - m)) - 1);
+ start = start & mask;
+ end = start | ~mask;
+
+ len = (end - start - 1) / (8 * sizeof(long)) + 1;
+
+ r = _malloc(sizeof(*r) + len * sizeof(long));
+ memset(r, 0, sizeof(*r));
+ memset(r->free, 0xff, len * sizeof(long));
+ r->routerip = start + 1;
+ r->startip = start;
+ r->mask = m;
+ r->len = len;
+ pthread_mutex_init(&r->lock, NULL);
+
+ end -= start;
+ r->free[(end - 1) / ( 8 * sizeof(long))] &= (1 << ((end - 1) % (8 * sizeof(long)) + 1)) - 1;
+ r->free[0] &= ~3;
+
+ return r;
+
+parse_err:
+ log_emerg("dhcpv4: failed to parse range=%s\n", str);
+ return NULL;
+}
+
+struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifname, const char *opt)
{
struct dhcpv4_serv *serv;
int sock, raw_sock;
@@ -50,6 +97,8 @@ struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifna
struct sockaddr_ll ll_addr;
struct ifreq ifr;
int f = 1;
+ char *str0, *str, *ptr1, *ptr2;
+ int end;
memset(&ifr, 0, sizeof(ifr));
@@ -124,6 +173,41 @@ struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifna
serv->hnd.read = dhcpv4_read;
serv->raw_sock = raw_sock;
+ str0 = strchr(opt, ',');
+ if (str0) {
+ str0 = _strdup(str0 + 1);
+ str = str0;
+
+ while (1) {
+ for (ptr1 = str + 1; *ptr1 && *ptr1 != '='; ptr1++);
+
+ if (!*ptr1)
+ break;
+
+ *ptr1 = 0;
+
+ for (ptr2 = ++ptr1; *ptr2 && *ptr2 != ','; ptr2++);
+
+ end = *ptr2 == 0;
+
+ if (!end)
+ *ptr2 = 0;
+
+ if (ptr2 == ptr1)
+ break;
+
+ if (strcmp(str, "range") == 0)
+ serv->range = parse_range(ptr1);
+
+ if (end)
+ break;
+
+ str = ptr2 + 1;
+ }
+
+ _free(str0);
+ }
+
triton_md_register_handler(ctx, &serv->hnd);
triton_md_enable_handler(&serv->hnd, MD_MODE_READ);
@@ -139,6 +223,8 @@ void dhcpv4_free(struct dhcpv4_serv *serv)
{
triton_md_unregister_handler(&serv->hnd);
close(serv->hnd.fd);
+ if (serv->range)
+ _free(serv->range);
_free(serv);
}
@@ -372,7 +458,7 @@ uint16_t ip_csum(uint16_t *buf, int len)
}
-static int dhcpv4_send(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, in_addr_t saddr, in_addr_t daddr)
+static int dhcpv4_send_raw(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, in_addr_t saddr, in_addr_t daddr)
{
uint8_t hdr[sizeof(struct ether_header) + sizeof(struct iphdr) + sizeof(struct udphdr)];
struct ether_header *eth = (struct ether_header *)hdr;
@@ -416,6 +502,32 @@ static int dhcpv4_send(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, in_
return 0;
}
+static int dhcpv4_send_udp(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack)
+{
+ struct sockaddr_in addr;
+ int n;
+ int len = pack->ptr - pack->data;
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(DHCP_CLIENT_PORT);
+ addr.sin_addr.s_addr = pack->hdr->giaddr;
+
+ n = sendto(serv->hnd.fd, pack->data, len, 0, (struct sockaddr *)&addr, sizeof(addr));
+ if (n != len)
+ return -1;
+
+ return 0;
+}
+
+static int dhcpv4_send(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, in_addr_t saddr, in_addr_t daddr)
+{
+ if (pack->hdr->giaddr)
+ return dhcpv4_send_udp(serv, pack);
+
+ return dhcpv4_send_raw(serv, pack, saddr, daddr);
+}
+
void dhcpv4_packet_free(struct dhcpv4_packet *pack)
{
struct dhcpv4_option *opt;
@@ -459,7 +571,7 @@ int dhcpv4_packet_add_opt(struct dhcpv4_packet *pack, int type, const void *data
return 0;
}
-int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_packet *req, struct ap_session *ses, int lease_time)
+int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_packet *req, uint32_t yiaddr, uint32_t siaddr, uint32_t mask, int lease_time)
{
struct dhcpv4_packet *pack;
int val, r;
@@ -478,26 +590,26 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack
pack->hdr->op = DHCP_OP_REPLY;
pack->hdr->ciaddr = 0;
- pack->hdr->yiaddr = ses->ipv4->peer_addr;
+ pack->hdr->yiaddr = yiaddr;
if (msg_type == DHCPOFFER)
- pack->hdr->siaddr = ses->ipv4->addr;
+ pack->hdr->siaddr = siaddr;
else
pack->hdr->siaddr = 0;
if (dhcpv4_packet_add_opt(pack, 53, &msg_type, 1))
goto out_err;
- if (dhcpv4_packet_add_opt(pack, 54, &ses->ipv4->addr, 4))
+ if (dhcpv4_packet_add_opt(pack, 54, &siaddr, 4))
goto out_err;
val = ntohl(lease_time);
if (dhcpv4_packet_add_opt(pack, 51, &val, 4))
goto out_err;
- if (dhcpv4_packet_add_opt(pack, 3, &ses->ipv4->addr, 4))
+ if (dhcpv4_packet_add_opt(pack, 3, &siaddr, 4))
goto out_err;
- val = htonl(~((1 << (32 - ses->ipv4->mask)) - 1));
+ val = htonl(~((1 << (32 - mask)) - 1));
if (dhcpv4_packet_add_opt(pack, 1, &val, 4))
goto out_err;
@@ -519,7 +631,7 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack
dhcpv4_print_packet(pack, log_ppp_info2);
}
- r = dhcpv4_send(serv, pack, ses->ipv4->addr, ses->ipv4->peer_addr);
+ r = dhcpv4_send(serv, pack, siaddr, yiaddr);
dhcpv4_packet_free(pack);
@@ -573,6 +685,47 @@ out_err:
return 0;
}
+int dhcpv4_get_ip(struct dhcpv4_serv *serv, uint32_t *yiaddr, uint32_t *siaddr, int *mask)
+{
+ int i, k;
+
+ if (!serv->range)
+ return 0;
+
+ pthread_mutex_lock(&serv->range->lock);
+
+ while (1) {
+ for (i = serv->range->pos; i < serv->range->len; i++) {
+ k = ffsl(serv->range->free[i]);
+ if (k) {
+ serv->range->free[i] &= ~(1 << (k - 1));
+ serv->range->pos = i;
+ pthread_mutex_unlock(&serv->range->lock);
+ *yiaddr = htonl(serv->range->startip + i * 8 * sizeof(long) + k - 1);
+ *siaddr = htonl(serv->range->routerip);
+ *mask = serv->range->mask;
+ return 1;
+ }
+ }
+
+ if (serv->range->pos == 0)
+ break;
+
+ serv->range->pos = 0;
+ }
+
+ pthread_mutex_unlock(&serv->range->lock);
+ return 0;
+}
+
+void dhcpv4_put_ip(struct dhcpv4_serv *serv, uint32_t ip)
+{
+ int n = ntohl(ip) - serv->range->startip;
+ pthread_mutex_lock(&serv->range->lock);
+ serv->range->free[n / (8 * sizeof(long))] |= 1 << (n % (8 * sizeof(long)));
+ pthread_mutex_unlock(&serv->range->lock);
+}
+
static void load_config()
{
const char *opt;
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.h b/accel-pppd/ctrl/ipoe/dhcpv4.h
index 52e90a3..cf3aac7 100644
--- a/accel-pppd/ctrl/ipoe/dhcpv4.h
+++ b/accel-pppd/ctrl/ipoe/dhcpv4.h
@@ -2,6 +2,7 @@
#define __DHCPV4_H
#include <stdint.h>
+#include <pthread.h>
#include "list.h"
#include "triton.h"
@@ -61,6 +62,18 @@ struct dhcpv4_packet
uint8_t data[0];
};
+struct dhcpv4_iprange
+{
+ struct list_head entry;
+ uint32_t routerip;
+ uint32_t startip;
+ int mask;
+ int pos;
+ int len;
+ pthread_mutex_t lock;
+ unsigned long free[0];
+};
+
struct dhcpv4_serv
{
struct triton_context_t *ctx;
@@ -68,15 +81,16 @@ struct dhcpv4_serv
int raw_sock;
uint8_t hwaddr[6];
void (*recv)(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack);
+ struct dhcpv4_iprange *range;
};
struct ap_session;
-struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifname);
+struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifname, const char *opt);
void dhcpv4_free(struct dhcpv4_serv *);
-int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_packet *req, struct ap_session *ses, int lease_time);
+int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_packet *req, uint32_t yiaddr, uint32_t siaddr, uint32_t mask, int lease_time);
int dhcpv4_send_nak(struct dhcpv4_serv *serv, struct dhcpv4_packet *req);
void dhcpv4_packet_free(struct dhcpv4_packet *pack);
@@ -86,4 +100,7 @@ void dhcpv4_print_options(struct dhcpv4_packet *, void (*)(const char *, ...));
void dhcpv4_print_packet(struct dhcpv4_packet *pack, void (*print)(const char *fmt, ...));
+int dhcpv4_get_ip(struct dhcpv4_serv *serv, uint32_t *yiaddr, uint32_t *siaddr, int *mask);
+void dhcpv4_put_ip(struct dhcpv4_serv *serv, uint32_t ip);
+
#endif
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index bfe65fb..b961ef8 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -102,18 +102,12 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d
if (pack->agent_remote_id && !ses->agent_remote_id)
continue;
- if (pack->client_id && !ses->client_id)
- continue;
-
if (!pack->agent_circuit_id && ses->agent_circuit_id)
continue;
if (!pack->agent_remote_id && ses->agent_remote_id)
continue;
- if (!pack->client_id && ses->client_id)
- continue;
-
if (pack->agent_circuit_id) {
if (pack->agent_circuit_id->len != ses->agent_circuit_id->len)
continue;
@@ -126,8 +120,17 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d
continue;
if (memcmp(pack->agent_remote_id->data, ses->agent_remote_id->data, pack->agent_remote_id->len))
continue;
+
+ return ses;
}
+ if (pack->client_id && !ses->client_id)
+ continue;
+
+ if (!pack->client_id && ses->client_id)
+ continue;
+
+
if (pack->client_id) {
if (pack->client_id->len != ses->client_id->len)
continue;
@@ -258,8 +261,17 @@ static void ipoe_session_start(struct ipoe_session *ses)
else if (!ses->ses.ipv4->mask)
ses->ses.ipv4->mask = 24;
+ if (!ses->yiaddr)
+ ses->yiaddr = ses->ses.ipv4->peer_addr;
+
+ if (!ses->siaddr)
+ ses->siaddr = ses->ses.ipv4->addr;
+
+ if (!ses->mask)
+ ses->mask = 24;
+
if (ses->dhcpv4_request) {
- dhcpv4_send_reply(DHCPOFFER, ses->serv->dhcpv4, ses->dhcpv4_request, &ses->ses, conf_lease_time);
+ dhcpv4_send_reply(DHCPOFFER, ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->mask, conf_lease_time);
dhcpv4_packet_free(ses->dhcpv4_request);
ses->dhcpv4_request = NULL;
@@ -268,7 +280,7 @@ static void ipoe_session_start(struct ipoe_session *ses)
ses->timer.expire_tv.tv_sec = conf_offer_timeout;
triton_timer_add(&ses->ctx, &ses->timer, 0);
} else {
- if (ipoe_nl_modify(ses->ifindex, ses->giaddr, ses->ses.ipv4->peer_addr, NULL, NULL))
+ if (ipoe_nl_modify(ses->ifindex, ses->yiaddr, ses->ses.ipv4->peer_addr, NULL, NULL))
ap_session_terminate(&ses->ses, TERM_NAS_ERROR, 0);
else
ap_session_activate(&ses->ses);
@@ -277,11 +289,18 @@ static void ipoe_session_start(struct ipoe_session *ses)
static void ipoe_session_activate(struct ipoe_session *ses)
{
+ if (ses->ifindex != -1) {
+ if (ipoe_nl_modify(ses->ifindex, ses->yiaddr, ses->ses.ipv4->peer_addr, NULL, NULL)) {
+ ap_session_terminate(&ses->ses, TERM_NAS_ERROR, 0);
+ return;
+ }
+ }
+
ap_session_activate(&ses->ses);
if (ses->dhcpv4_request) {
if (ses->ses.state == AP_STATE_ACTIVE)
- dhcpv4_send_reply(DHCPACK, ses->serv->dhcpv4, ses->dhcpv4_request, &ses->ses, conf_lease_time);
+ dhcpv4_send_reply(DHCPACK, ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->mask, conf_lease_time);
else
dhcpv4_send_nak(ses->serv->dhcpv4, ses->dhcpv4_request);
@@ -298,7 +317,7 @@ static void ipoe_session_keepalive(struct ipoe_session *ses)
ses->xid = ses->dhcpv4_request->hdr->xid;
if (ses->ses.state == AP_STATE_ACTIVE)
- dhcpv4_send_reply(DHCPACK, ses->serv->dhcpv4, ses->dhcpv4_request, &ses->ses, conf_lease_time);
+ dhcpv4_send_reply(DHCPACK, ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->mask, conf_lease_time);
else
dhcpv4_send_nak(ses->serv->dhcpv4, ses->dhcpv4_request);
@@ -366,6 +385,9 @@ static void ipoe_session_finished(struct ap_session *s)
serv_close = ses->serv->need_close && list_empty(&ses->serv->sessions);
pthread_mutex_unlock(&ses->serv->lock);
+ if (ses->yiaddr && ses->serv->dhcpv4 && ses->serv->dhcpv4->range)
+ dhcpv4_put_ip(ses->serv->dhcpv4, ses->yiaddr);
+
if (serv_close)
ipoe_serv_close(&ses->serv->ctx);
@@ -412,6 +434,8 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s
memcpy(ses->hwaddr, pack->hdr->chaddr, 6);
ses->giaddr = pack->hdr->giaddr;
+ dhcpv4_get_ip(serv->dhcpv4, &ses->yiaddr, &ses->siaddr, &ses->mask);
+
if (pack->agent_circuit_id)
dlen += sizeof(struct dhcp_opt) + pack->agent_circuit_id->len;
@@ -513,7 +537,7 @@ static void ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet *p
}
if (ses->ses.ipv4 && ses->ses.state == AP_STATE_ACTIVE && pack->request_ip == ses->ses.ipv4->peer_addr)
- dhcpv4_send_reply(DHCPOFFER, dhcpv4, pack, &ses->ses, conf_lease_time);
+ dhcpv4_send_reply(DHCPOFFER, dhcpv4, pack, ses->yiaddr, ses->siaddr, ses->mask, conf_lease_time);
dhcpv4_packet_free(pack);
}
@@ -528,16 +552,15 @@ static void ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet *p
dhcpv4_send_nak(dhcpv4, pack);
} else {
- if (!ses->ses.ipv4 ||
- (pack->server_id && (pack->server_id != ses->ses.ipv4->addr || pack->request_ip != ses->ses.ipv4->peer_addr)) ||
- (pack->hdr->ciaddr && (pack->hdr->xid != ses->xid || pack->hdr->ciaddr != ses->ses.ipv4->peer_addr))) {
+ if ((pack->server_id && (pack->server_id != ses->siaddr || pack->request_ip != ses->yiaddr)) ||
+ (pack->hdr->ciaddr && (pack->hdr->xid != ses->xid || pack->hdr->ciaddr != ses->yiaddr))) {
if (conf_verbose) {
log_info2("recv ");
dhcpv4_print_packet(pack, log_info2);
}
- if (ses->ses.ipv4 && pack->server_id == ses->ses.ipv4->addr && pack->request_ip && pack->request_ip != ses->ses.ipv4->peer_addr)
+ if (pack->server_id == ses->siaddr && pack->request_ip && pack->request_ip != ses->yiaddr)
dhcpv4_send_nak(dhcpv4, pack);
ap_session_terminate(&ses->ses, TERM_USER_REQUEST, 0);
@@ -611,7 +634,7 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc
ses->ctrl.type = CTRL_TYPE_IPOE;
ses->ctrl.name = "ipoe";
- ses->giaddr = iph->saddr;
+ ses->yiaddr = iph->saddr;
ses->ctrl.calling_station_id = _malloc(17);
ses->ctrl.called_station_id = _malloc(17);
@@ -682,7 +705,7 @@ void ipoe_recv_up(int ifindex, struct ethhdr *eth, struct iphdr *iph)
pthread_mutex_lock(&serv->lock);
list_for_each_entry(ses, &serv->sessions, entry) {
- if (ses->giaddr == iph->saddr) {
+ if (ses->yiaddr == iph->saddr) {
pthread_mutex_unlock(&serv->lock);
return;
}
@@ -812,8 +835,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt)
opt_mode = MODE_L3;
else
goto parse_err;
- } else
- goto parse_err;
+ }
if (end)
break;
@@ -842,7 +864,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt)
}
if (opt_dhcpv4 && !serv->dhcpv4) {
- serv->dhcpv4 = dhcpv4_create(&serv->ctx, serv->ifname);
+ serv->dhcpv4 = dhcpv4_create(&serv->ctx, serv->ifname, opt);
if (serv->dhcpv4)
serv->dhcpv4->recv = ipoe_recv_dhcpv4;
} else if (!opt_dhcpv4 && serv->dhcpv4) {
@@ -872,7 +894,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt)
triton_context_register(&serv->ctx, NULL);
if (serv->opt_dhcpv4) {
- serv->dhcpv4 = dhcpv4_create(&serv->ctx, serv->ifname);
+ serv->dhcpv4 = dhcpv4_create(&serv->ctx, serv->ifname, opt);
if (serv->dhcpv4)
serv->dhcpv4->recv = ipoe_recv_dhcpv4;
}
diff --git a/accel-pppd/ctrl/ipoe/ipoe.h b/accel-pppd/ctrl/ipoe/ipoe.h
index 48bd631..d18db69 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.h
+++ b/accel-pppd/ctrl/ipoe/ipoe.h
@@ -45,6 +45,9 @@ struct ipoe_session
struct dhcp_opt *agent_remote_id;
uint32_t xid;
uint32_t giaddr;
+ uint32_t yiaddr;
+ uint32_t siaddr;
+ int mask;
uint8_t *data;
struct dhcpv4_packet *dhcpv4_request;
int ifindex;
diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c
index 7f1ca96..2d500ef 100644
--- a/drivers/ipoe/ipoe.c
+++ b/drivers/ipoe/ipoe.c
@@ -110,7 +110,7 @@ static int ipoe_do_nat(struct sk_buff *skb, __be32 new_addr, int to_peer);
static void ipoe_queue_u(struct sk_buff *skb, __be32 addr);
static int ipoe_lookup1_u(__be32 addr, unsigned long *ts);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
static const struct net_device_ops ipoe_netdev_ops;
#endif
@@ -874,7 +874,7 @@ static const struct header_ops ipoe_hard_header_ops = {
static void ipoe_netdev_setup(struct net_device *dev)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
dev->hard_start_xmit = ipoe_xmit;
#else
dev->netdev_ops = &ipoe_netdev_ops;
@@ -888,7 +888,7 @@ static void ipoe_netdev_setup(struct net_device *dev)
dev->iflink = 0;
dev->addr_len = ETH_ALEN;
dev->features |= NETIF_F_NETNS_LOCAL;
- dev->header_ops = &ipoe_hard_header_ops,
+ dev->header_ops = &ipoe_hard_header_ops;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
#endif
@@ -995,7 +995,7 @@ static int ipoe_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(msg, hdr);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
return genlmsg_unicast(msg, info->snd_pid);
#else
return genlmsg_unicast(genl_info_net(info), msg, info->snd_pid);
@@ -1066,7 +1066,7 @@ static int ipoe_nl_cmd_create(struct sk_buff *skb, struct genl_info *info)
nla_put_u32(msg, IPOE_ATTR_IFINDEX, ret);
genlmsg_end(msg, hdr);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
return genlmsg_unicast(msg, info->snd_pid);
#else
return genlmsg_unicast(genl_info_net(info), msg, info->snd_pid);
@@ -1095,7 +1095,7 @@ static int ipoe_nl_cmd_delete(struct sk_buff *skb, struct genl_info *info)
down(&ipoe_wlock);
rcu_read_lock();
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
dev = dev_get_by_index_rcu(ifindex);
#else
dev = dev_get_by_index_rcu(&init_net, ifindex);
@@ -1151,7 +1151,7 @@ static int ipoe_nl_cmd_modify(struct sk_buff *skb, struct genl_info *info)
ifindex = nla_get_u32(info->attrs[IPOE_ATTR_IFINDEX]);
rcu_read_lock();
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
dev = dev_get_by_index_rcu(ifindex);
#else
dev = dev_get_by_index_rcu(&init_net, ifindex);
@@ -1395,7 +1395,7 @@ static struct genl_multicast_group ipoe_nl_mcg = {
.name = IPOE_GENL_MCG_PKT,
};
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
static const struct net_device_ops ipoe_netdev_ops = {
.ndo_start_xmit = ipoe_xmit,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)