From 122b75cef8e86f523b91d1753369373f2a907eed Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 9 Nov 2009 16:34:09 +0100 Subject: [PATCH] Set correctly source address for sent packets (if specified in contract) --- fwp/lib/fwp/fwp_endpoint.c | 2 +- fwp/lib/fwp/fwp_vres.c | 3 ++- fwp/lib/fwp/fwp_vres.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fwp/lib/fwp/fwp_endpoint.c b/fwp/lib/fwp/fwp_endpoint.c index 7eb7d0b..93756af 100644 --- a/fwp/lib/fwp/fwp_endpoint.c +++ b/fwp/lib/fwp/fwp_endpoint.c @@ -397,7 +397,7 @@ int fwp_send_endpoint_bind(struct fwp_endpoint *ep, fwp_vres_t *vres) return FRSH_ERR_ALREADY_BOUND; ep->vres = vres; - rv = fwp_vres_bind(vres, ep, ep->sockd); + rv = fwp_vres_bind(vres, ep, ep->sockd, &ep->src); return rv; } diff --git a/fwp/lib/fwp/fwp_vres.c b/fwp/lib/fwp/fwp_vres.c index 64c5a70..ad6cf0e 100644 --- a/fwp/lib/fwp/fwp_vres.c +++ b/fwp/lib/fwp/fwp_vres.c @@ -514,7 +514,7 @@ static void* fwp_vres_tx_thread(void *_vres) } /*int fwp_vres_bind(fwp_vres_t *vres, struct fwp_endpoint *epoint)*/ -int fwp_vres_bind(fwp_vres_t *vres, struct fwp_endpoint *ep, int sockd) +int fwp_vres_bind(fwp_vres_t *vres, struct fwp_endpoint *ep, int sockd, struct in_addr *src) { int rv = 0; @@ -531,6 +531,7 @@ int fwp_vres_bind(fwp_vres_t *vres, struct fwp_endpoint *ep, int sockd) } vres->ac_sockd = sockd; + *src = vres->params.src; rv = fwp_vres_set_ac(vres->ac_sockd, vres->params.ac_id); if (rv) goto err; diff --git a/fwp/lib/fwp/fwp_vres.h b/fwp/lib/fwp/fwp_vres.h index 62561f5..aa76104 100644 --- a/fwp/lib/fwp/fwp_vres.h +++ b/fwp/lib/fwp/fwp_vres.h @@ -97,7 +97,7 @@ int fwp_vres_consume_budget(struct fwp_vres *vres, size_t size, bool can_block); struct fwp_endpoint; int fwp_vres_enqueue(struct fwp_vres *vres, struct fwp_endpoint *ep, const void *msg, size_t size); -int fwp_vres_bind(fwp_vres_t *vres, struct fwp_endpoint *ep, int sockd); +int fwp_vres_bind(fwp_vres_t *vres, struct fwp_endpoint *ep, int sockd, struct in_addr *src); int fwp_vres_unbind(fwp_vres_t *vres); extern fwp_vres_params_t fwp_vres_params_default; -- 2.39.2