diff options
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 3 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 11 | ||||
-rw-r--r-- | accel-pppd/libnetlink/iputils.c | 4 | ||||
-rw-r--r-- | accel-pppd/libnetlink/iputils.h | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index a800c4d..269043e 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 ac971c4..ce6a4cd 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 17f40f3..0e80b89 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 f912434..5779053 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); |