summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-02-04 12:32:41 +0100
committerStefan Metzmacher <metze@samba.org>2011-02-04 15:04:58 +0100
commitff935ddf8b22be269abb730904d324efb1e3e8f2 (patch)
treebe73ff2d0642d426e952efdae01e5f57ce29a79f /source3
parent902fbd91a19c414b61bc18ef24d7d84b30d37b1b (diff)
downloadsamba-ff935ddf8b22be269abb730904d324efb1e3e8f2.tar.gz
samba-ff935ddf8b22be269abb730904d324efb1e3e8f2.tar.bz2
samba-ff935ddf8b22be269abb730904d324efb1e3e8f2.zip
s3:lib/addrchange: let addrchange_done() retry and ignore unknown message types
Messages like RTM_NEWLINK should be just ignored. metze
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/addrchange.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source3/lib/addrchange.c b/source3/lib/addrchange.c
index f3606e2812..45e04a9e01 100644
--- a/source3/lib/addrchange.c
+++ b/source3/lib/addrchange.c
@@ -83,6 +83,8 @@ static int addrchange_context_destructor(struct addrchange_context *c)
}
struct addrchange_state {
+ struct tevent_context *ev;
+ struct addrchange_context *ctx;
uint8_t buf[8192];
struct sockaddr_storage fromaddr;
socklen_t fromaddr_len;
@@ -104,14 +106,15 @@ struct tevent_req *addrchange_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
+ state->ev = ev;
+ state->ctx = ctx;
state->fromaddr_len = sizeof(state->fromaddr);
-
- subreq = recvfrom_send(state, ev, ctx->sock,
+ subreq = recvfrom_send(state, state->ev, state->ctx->sock,
state->buf, sizeof(state->buf), 0,
&state->fromaddr, &state->fromaddr_len);
if (tevent_req_nomem(subreq, req)) {
- return tevent_req_post(req, ev);
+ return tevent_req_post(req, state->ev);
}
tevent_req_set_callback(subreq, addrchange_done, req);
return req;
@@ -166,8 +169,16 @@ static void addrchange_done(struct tevent_req *subreq)
state->type = ADDRCHANGE_DEL;
break;
default:
- DEBUG(10, ("Got unexpected type %d\n", h->nlmsg_type));
- tevent_req_nterror(req, NT_STATUS_INVALID_ADDRESS);
+ DEBUG(10, ("Got unexpected type %d - ignoring\n", h->nlmsg_type));
+
+ state->fromaddr_len = sizeof(state->fromaddr);
+ subreq = recvfrom_send(state, state->ev, state->ctx->sock,
+ state->buf, sizeof(state->buf), 0,
+ &state->fromaddr, &state->fromaddr_len);
+ if (tevent_req_nomem(subreq, req)) {
+ return;
+ }
+ tevent_req_set_callback(subreq, addrchange_done, req);
return;
}