aboutsummaryrefslogtreecommitdiff
path: root/lib/libradius/radlib.c
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2011-12-20 11:13:44 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2011-12-20 11:13:44 +0000
commit07d7b74b812aa7eb6d53c4f24e2c1bc7ad8d8ccd (patch)
treeedb0af86ee389aae22d3a4b26a85fe25baab590c /lib/libradius/radlib.c
parent74ab90b71e5ad299fc091c031768d591358bde0f (diff)
downloadsrc-07d7b74b812aa7eb6d53c4f24e2c1bc7ad8d8ccd.tar.gz
src-07d7b74b812aa7eb6d53c4f24e2c1bc7ad8d8ccd.zip
Add binding support to libradius(3).
Submitted by: Sergey Matveychuk <sem33@yandex-team.ru> Approved by: ae (mentor) MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=228730
Diffstat (limited to 'lib/libradius/radlib.c')
-rw-r--r--lib/libradius/radlib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libradius/radlib.c b/lib/libradius/radlib.c
index e4e4a9411800..46a9b58c9e2f 100644
--- a/lib/libradius/radlib.c
+++ b/lib/libradius/radlib.c
@@ -756,9 +756,16 @@ rad_create_request(struct rad_handle *h, int code)
clear_password(h);
h->authentic_pos = 0;
h->out_created = 1;
+ h->bindto = INADDR_ANY;
return 0;
}
+void
+rad_bind_to(struct rad_handle *h, in_addr_t addr)
+{
+ h->bindto = addr;
+}
+
int
rad_create_response(struct rad_handle *h, int code)
{
@@ -857,7 +864,7 @@ rad_init_send_request(struct rad_handle *h, int *fd, struct timeval *tv)
memset(&sin, 0, sizeof sin);
sin.sin_len = sizeof sin;
sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
+ sin.sin_addr.s_addr = h->bindto;
sin.sin_port = htons(0);
if (bind(h->fd, (const struct sockaddr *)&sin,
sizeof sin) == -1) {