Lines Matching defs:rth
20 void rtnl_close(struct rtnl_handle *rth)
22 close(rth->fd);
25 int xrtnl_open(struct rtnl_handle *rth/*, unsigned subscriptions*/)
29 memset(rth, 0, sizeof(rth));
31 rth->fd = xsocket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
33 memset(&rth->local, 0, sizeof(rth->local));
34 rth->local.nl_family = AF_NETLINK;
35 /*rth->local.nl_groups = subscriptions;*/
37 xbind(rth->fd, (struct sockaddr*)&rth->local, sizeof(rth->local));
38 addr_len = sizeof(rth->local);
39 if (getsockname(rth->fd, (struct sockaddr*)&rth->local, &addr_len) < 0)
41 if (addr_len != sizeof(rth->local))
43 if (rth->local.nl_family != AF_NETLINK)
44 bb_error_msg_and_die("wrong address family %d", rth->local.nl_family);
45 rth->seq = time(NULL);
49 int xrtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
64 req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
67 return xsendto(rth->fd, (void*)&req, sizeof(req),
71 int rtnl_send(struct rtnl_handle *rth, char *buf, int len)
78 return xsendto(rth->fd, buf, len, (struct sockaddr*)&nladdr, sizeof(nladdr));
81 int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len)
100 nlh.nlmsg_seq = rth->dump = ++rth->seq;
102 return sendmsg(rth->fd, &msg, 0);
105 static int rtnl_dump_filter(struct rtnl_handle *rth,
126 status = recvmsg(rth->fd, &msg, 0);
147 h->nlmsg_pid != rth->local.nl_pid ||
148 h->nlmsg_seq != rth->dump) {
187 int xrtnl_dump_filter(struct rtnl_handle *rth,
191 int ret = rtnl_dump_filter(rth, filter, arg1/*, NULL, NULL*/);