summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2013-06-13 22:21:32 +0400
committerDmitry Kozlov <xeb@mail.ru>2013-06-13 22:21:32 +0400
commitf94444646b54259c11dc7e8dbebdcf834a0250cc (patch)
tree87c3098b4a5d843de445228d0725adadfe2b0eb5
parent338e86560f0bb991852f977ff5376a2d9fb71b20 (diff)
downloadaccel-ppp-f94444646b54259c11dc7e8dbebdcf834a0250cc.tar.gz
accel-ppp-f94444646b54259c11dc7e8dbebdcf834a0250cc.zip
ipoe: introduced 'proto' option that will be used for inserted routes
-rw-r--r--accel-pppd/accel-ppp.conf.53
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c11
-rw-r--r--accel-pppd/libnetlink/iputils.c4
-rw-r--r--accel-pppd/libnetlink/iputils.h2
4 files changed, 15 insertions, 5 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index a800c4d4..269043eb 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -300,6 +300,9 @@ parameter specifies ip address to use as source when adding route to client.
.TP
.BI "local-net=" x.x.x.x/mask
Specifies networks from which packets will be treated as unclassified. You may specify multiple local-net options.
+.TP
+.BI "proto=" n
+Specifies number of protocol to be used for inserted routes.
.SH [dns]
.TP
.BI "dns1=" x.x.x.x
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index ac971c40..ce6a4cd0 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -77,6 +77,7 @@ static int conf_lease_time = 600;
static int conf_lease_timeout = 660;
static int conf_verbose;
static const char *conf_agent_remote_id;
+static int conf_proto;
static unsigned int stat_starting;
static unsigned int stat_active;
@@ -624,9 +625,9 @@ static void ipoe_ifcfg_add(struct ipoe_session *ses)
log_ppp_warn("ipoe: failed to add addess to interface '%s'\n", serv->ifname);
pthread_mutex_unlock(&serv->lock);
}
- if (iproute_add(serv->ifindex, ses->serv->opt_src ? ses->serv->opt_src : ses->router, ses->yiaddr))
+ if (iproute_add(serv->ifindex, ses->serv->opt_src ? ses->serv->opt_src : ses->router, ses->yiaddr, conf_proto))
log_ppp_warn("ipoe: failed to add route to interface '%s'\n", serv->ifname);
- } else if (iproute_add(serv->ifindex, ses->serv->opt_src ? ses->serv->opt_src : ses->router, ses->yiaddr))
+ } else if (iproute_add(serv->ifindex, ses->serv->opt_src ? ses->serv->opt_src : ses->router, ses->yiaddr, conf_proto))
log_ppp_warn("ipoe: failed to add route to interface '%s'\n", serv->ifname);
ses->ifcfg = 1;
@@ -2091,6 +2092,12 @@ static void load_config(void)
if (!conf_dhcpv4 && !conf_up)
conf_dhcpv4 = 1;
+ opt = conf_get_opt("ipoe", "proto");
+ if (opt && atoi(opt) > 0)
+ conf_proto = atoi(opt);
+ else
+ conf_proto = 0;
+
#ifdef RADIUS
if (triton_module_loaded("radius"))
load_radius_attrs();
diff --git a/accel-pppd/libnetlink/iputils.c b/accel-pppd/libnetlink/iputils.c
index 17f40f3a..0e80b89c 100644
--- a/accel-pppd/libnetlink/iputils.c
+++ b/accel-pppd/libnetlink/iputils.c
@@ -224,7 +224,7 @@ int __export ipaddr_del(int ifindex, in_addr_t addr)
return 0;
}
-int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst)
+int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, int proto)
{
struct ipaddr_req {
struct nlmsghdr n;
@@ -246,7 +246,7 @@ int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst)
req.i.rtm_family = AF_INET;
req.i.rtm_table = RT_TABLE_MAIN;
req.i.rtm_scope = RT_SCOPE_LINK;
- req.i.rtm_protocol = RTPROT_BOOT;
+ req.i.rtm_protocol = proto;
req.i.rtm_type = RTN_UNICAST;
req.i.rtm_dst_len = 32;
diff --git a/accel-pppd/libnetlink/iputils.h b/accel-pppd/libnetlink/iputils.h
index f9124343..57790539 100644
--- a/accel-pppd/libnetlink/iputils.h
+++ b/accel-pppd/libnetlink/iputils.h
@@ -11,7 +11,7 @@ int iplink_get_stats(int ifindex, struct rtnl_link_stats *stats);
int ipaddr_add(int ifindex, in_addr_t addr, int mask);
int ipaddr_del(int ifindex, in_addr_t addr);
-int iproute_add(int ifindex, in_addr_t src, in_addr_t dst);
+int iproute_add(int ifindex, in_addr_t src, in_addr_t dst, int proto);
int iproute_del(int ifindex, in_addr_t dst);
int iprule_add(uint32_t addr, int table);