summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2012-11-15 14:21:35 +0400
committerKozlov Dmitry <xeb@mail.ru>2013-01-24 23:51:33 +0400
commit45026d43f6cfbe0f6efa446b47629cb948db5a9d (patch)
treebe206f8519ba8169f7ca8e87f0cfc66b63ef9a74
parent227298572c50013225752ff3af13ffc724d26ddf (diff)
downloadaccel-ppp-45026d43f6cfbe0f6efa446b47629cb948db5a9d.tar.gz
accel-ppp-45026d43f6cfbe0f6efa446b47629cb948db5a9d.zip
merge upstream
-rw-r--r--accel-pppd/CMakeLists.txt1
-rw-r--r--accel-pppd/accel-ppp.conf4
-rw-r--r--accel-pppd/accel-ppp.conf.59
-rw-r--r--accel-pppd/cli/show_sessions.c2
-rw-r--r--accel-pppd/cli/std_cmd.c2
-rw-r--r--accel-pppd/cli/tcp.c4
-rw-r--r--accel-pppd/cli/telnet.c4
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c2
-rw-r--r--accel-pppd/extra/CMakeLists.txt1
-rw-r--r--accel-pppd/include/events.h8
-rw-r--r--accel-pppd/ppp/ppp_ipcp.h2
-rw-r--r--accel-pppd/ppp/ppp_lcp.c8
-rw-r--r--accel-pppd/radius/radius.c12
13 files changed, 49 insertions, 10 deletions
diff --git a/accel-pppd/CMakeLists.txt b/accel-pppd/CMakeLists.txt
index 7b33e684..2fb80b95 100644
--- a/accel-pppd/CMakeLists.txt
+++ b/accel-pppd/CMakeLists.txt
@@ -64,6 +64,7 @@ ADD_EXECUTABLE(accel-pppd
ppp/ppp_ipcp.c
ppp/ipcp_opt_ipaddr.c
ppp/ipcp_opt_dns.c
+ ppp/ipcp_opt_wins.c
ppp/ipv6cp_opt_intfid.c
ppp/ppp_ipv6cp.c
ppp/ppp_ccp.c
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index 2e159de8..7792ba71 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -111,6 +111,10 @@ verbose=1
#dns1=172.16.0.1
#dns2=172.16.1.1
+[wins]
+#wins1=172.16.0.1
+#wins2=172.16.1.1
+
[radius]
#dictionary=/usr/local/share/accel-ppp/radius/dictionary
nas-identifier=accel-ppp
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index 36299ff2..70b6b6be 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -299,6 +299,13 @@ Specifies primary DNS to be sent to peer.
.TP
.BI "dns2=" x.x.x.x
Specifies secondary DNS to be sent to peer.
+.SH [wins]
+.TP
+.BI "wins1=" x.x.x.x
+Specifies primary NBNS to be sent to peer.
+.TP
+.BI "wins2=" x.x.x.x
+Specifies secondary NBNS to be sent to peer.
.SH [dnsv6]
.TP
.BI "dns=" IPv6_address
@@ -684,4 +691,4 @@ Specifies downstream rate limiting method.
.TP
.BI "leaf-qdisc=" "qdisc parameters"
In case if htb is used as up-limiter or down-limiter specified leaf qdisc can be attached automaticaly.
-At present on sfq qdisc is implemented. Parameters are same as for tc: [ limit NUMBER ] [ perturn SECS ] [ quantum BYTES ].
+At present only sfq qdisc is implemented. Parameters are same as for tc: [ limit NUMBER ] [ perturn SECS ] [ quantum BYTES ].
diff --git a/accel-pppd/cli/show_sessions.c b/accel-pppd/cli/show_sessions.c
index 9e0ad2fb..2140decd 100644
--- a/accel-pppd/cli/show_sessions.c
+++ b/accel-pppd/cli/show_sessions.c
@@ -148,7 +148,7 @@ static int show_ses_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
return CLI_CMD_OK;
}
} else if (!strcmp(f[i], "match")) {
- if (i == f_cnt - 1)
+ if (i >= f_cnt - 2)
return CLI_CMD_SYNTAX;
match_key = find_column(f[++i]);
if (!match_key) {
diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c
index d2666d87..7a890d1a 100644
--- a/accel-pppd/cli/std_cmd.c
+++ b/accel-pppd/cli/std_cmd.c
@@ -130,6 +130,8 @@ static int terminate_exec1(char * const *f, int f_cnt, void *cli)
pthread_rwlock_rdlock(&ses_lock);
list_for_each_entry(ses, &ses_list, entry) {
+ if (!ses->username)
+ continue;
if (pcre_exec(re, NULL, ses->username, strlen(ses->username), 0, 0, NULL, 0) < 0)
continue;
if (hard)
diff --git a/accel-pppd/cli/tcp.c b/accel-pppd/cli/tcp.c
index 9ea914c9..b2ed9105 100644
--- a/accel-pppd/cli/tcp.c
+++ b/accel-pppd/cli/tcp.c
@@ -208,8 +208,10 @@ static int cln_write(struct triton_md_handler_t *h)
_free(cln->xmit_buf);
cln->xmit_pos = 0;
- if (list_empty(&cln->xmit_queue))
+ if (list_empty(&cln->xmit_queue)) {
+ cln->xmit_buf = NULL;
break;
+ }
cln->xmit_buf = list_entry(cln->xmit_queue.next, typeof(*cln->xmit_buf), entry);
list_del(&cln->xmit_buf->entry);
diff --git a/accel-pppd/cli/telnet.c b/accel-pppd/cli/telnet.c
index e9e886df..5a42a993 100644
--- a/accel-pppd/cli/telnet.c
+++ b/accel-pppd/cli/telnet.c
@@ -518,8 +518,10 @@ static int cln_write(struct triton_md_handler_t *h)
_free(cln->xmit_buf);
cln->xmit_pos = 0;
- if (list_empty(&cln->xmit_queue))
+ if (list_empty(&cln->xmit_queue)) {
+ cln->xmit_buf = NULL;
break;
+ }
cln->xmit_buf = list_entry(cln->xmit_queue.next, typeof(*cln->xmit_buf), entry);
list_del(&cln->xmit_buf->entry);
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 7fb00ef4..071a782a 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -1318,7 +1318,7 @@ static int l2tp_conn_read(struct triton_md_handler_t *h)
log_debug("duplicate packet %i\n", ntohs(pack->hdr.Ns));
if (!list_empty(&conn->send_queue))
l2tp_retransmit(conn);
- if (l2tp_send_ZLB(conn))
+ else if (l2tp_send_ZLB(conn))
goto drop;
} else {
l2tp_conn_log(log_debug, conn);
diff --git a/accel-pppd/extra/CMakeLists.txt b/accel-pppd/extra/CMakeLists.txt
index ea640b18..d3d48ea4 100644
--- a/accel-pppd/extra/CMakeLists.txt
+++ b/accel-pppd/extra/CMakeLists.txt
@@ -1,6 +1,7 @@
ADD_LIBRARY(sigchld SHARED sigchld.c)
ADD_LIBRARY(pppd_compat SHARED pppd_compat.c)
TARGET_LINK_LIBRARIES(pppd_compat sigchld)
+set_property(TARGET pppd_compat PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib/accel-ppp)
ADD_LIBRARY(ippool SHARED ippool.c)
ADD_LIBRARY(ipv6pool SHARED ipv6pool.c)
ADD_LIBRARY(chap-secrets SHARED chap-secrets.c)
diff --git a/accel-pppd/include/events.h b/accel-pppd/include/events.h
index ca04d757..37dfa82c 100644
--- a/accel-pppd/include/events.h
+++ b/accel-pppd/include/events.h
@@ -21,6 +21,7 @@
#define EV_SHAPER 101
#define EV_MPPE_KEYS 102
#define EV_DNS 103
+#define EV_WINS 104
#define EV_RADIUS_ACCESS_ACCEPT 200
#define EV_RADIUS_COA 201
@@ -57,5 +58,10 @@ struct ev_dns_t
in_addr_t dns2;
};
+struct ev_wins_t
+{
+ struct ap_session *ses;
+ in_addr_t wins1;
+ in_addr_t wins2;
+};
#endif
-
diff --git a/accel-pppd/ppp/ppp_ipcp.h b/accel-pppd/ppp/ppp_ipcp.h
index 301bdcec..74127020 100644
--- a/accel-pppd/ppp/ppp_ipcp.h
+++ b/accel-pppd/ppp/ppp_ipcp.h
@@ -12,6 +12,8 @@
#define CI_ADDR 3 /* IP-Address */
#define CI_DNS1 129 /* Primary-DNS-Address */
#define CI_DNS2 131 /* Secondary-DNS-Address */
+#define CI_WINS1 130 /* Primary-NBNS-Address */
+#define CI_WINS2 132 /* Secondary-NBNS-Address */
struct ipcp_hdr_t
{
diff --git a/accel-pppd/ppp/ppp_lcp.c b/accel-pppd/ppp/ppp_lcp.c
index 2d1e195d..7bec6294 100644
--- a/accel-pppd/ppp/ppp_lcp.c
+++ b/accel-pppd/ppp/ppp_lcp.c
@@ -683,10 +683,10 @@ static void send_echo_request(struct triton_timer_t *t)
return;
}
- if (conf_ppp_verbose) {
- log_ppp_debug("send [LCP EchoReq id=%x <magic %x>]\n", msg.hdr.id, msg.magic);
- ppp_chan_send(lcp->ppp,&msg,ntohs(msg.hdr.len)+2);
- }
+ if (conf_ppp_verbose)
+ log_ppp_debug("send [LCP EchoReq id=%x <magic %x>]\n", msg.hdr.id, lcp->magic);
+
+ ppp_chan_send(lcp->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
static void start_echo(struct ppp_lcp_t *lcp)
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index 67c18e6d..9caf6f0f 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -59,9 +59,11 @@ int rad_proc_attrs(struct rad_req_t *req)
struct rad_attr_t *attr;
struct ipv6db_addr_t *a;
struct ev_dns_t dns;
+ struct ev_wins_t wins;
int res = 0;
dns.ses = NULL;
+ wins.ses = NULL;
req->rpd->acct_interim_interval = conf_acct_interim_interval;
list_for_each_entry(attr, &req->reply->attrs, entry) {
@@ -75,6 +77,14 @@ int rad_proc_attrs(struct rad_req_t *req)
dns.ses = req->rpd->ses;
dns.dns2 = attr->val.ipaddr;
break;
+ case MS_Primary_NBNS_Server:
+ wins.ses = req->rpd->ses;
+ wins.wins1 = attr->val.ipaddr;
+ break;
+ case MS_Secondary_NBNS_Server:
+ wins.ses = req->rpd->ses;
+ wins.wins2 = attr->val.ipaddr;
+ break;
}
continue;
} else if (attr->vendor)
@@ -137,6 +147,8 @@ int rad_proc_attrs(struct rad_req_t *req)
if (dns.ses)
triton_event_fire(EV_DNS, &dns);
+ if (wins.ses)
+ triton_event_fire(EV_WINS, &wins);
return res;
}