diff options
Diffstat (limited to 'igmp.c')
-rw-r--r-- | igmp.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -395,7 +395,13 @@ igmp_read_cb(struct cfg *cfg, struct uring_task *task, int res) if (res < 0 || task->dead) return; - igmp_parse(cfg, igmp, res); + task->tbuf->len = res; + + if (task->addr.storage.ss_family == AF_PACKET || + task->addr.ll.sll_protocol == htons(ETH_P_IP)) + igmp_parse(cfg, igmp, res); + else + fprintf(stderr, "Invalid packet type received\n"); uring_tbuf_read(cfg, &igmp->task, igmp_read_cb); } @@ -550,7 +556,8 @@ igmp_init(struct cfg *cfg) uring_task_init(&igmp->task, "igmp", uring_parent(cfg), igmp_free); uring_task_set_fd(&igmp->task, sfd); uring_task_set_buf(&igmp->task, &igmp->tbuf); - uring_tbuf_read(cfg, &igmp->task, igmp_read_cb); + igmp->task.addr.addrlen = sizeof(igmp->task.addr.ll); + uring_tbuf_recvmsg(cfg, &igmp->task, igmp_read_cb); cfg->igmp = igmp; |