projects
/
project
/
udebug.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e259bbd
)
lib: add netlink handler function
author
Felix Fietkau
<nbd@nbd.name>
Mon, 4 Dec 2023 19:31:03 +0000
(20:31 +0100)
committer
Felix Fietkau
<nbd@nbd.name>
Tue, 5 Dec 2023 09:27:55 +0000
(10:27 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
lib.c
patch
|
blob
|
history
udebug.h
patch
|
blob
|
history
diff --git
a/lib.c
b/lib.c
index 0bb287ec4867cf12f8feba562f63b4df47161a1c..55a272ae0efbc3cbb98381cfc1bb207430ad61e1 100644
(file)
--- a/
lib.c
+++ b/
lib.c
@@
-150,6
+150,27
@@
void udebug_ubus_apply_config(struct udebug *ud, struct udebug_ubus_ring *rings,
}
}
}
}
+void udebug_netlink_msg(struct udebug_buf *buf, uint16_t proto, const void *data, size_t len)
+{
+ struct {
+ uint16_t pkttype;
+ uint16_t arphdr;
+ uint16_t _pad[5];
+ uint16_t proto;
+ } hdr = {
+ .arphdr = cpu_to_be16(824),
+ .proto = cpu_to_be16(proto),
+ };
+
+ if (!udebug_buf_valid(buf))
+ return;
+
+ udebug_entry_init(buf);
+ udebug_entry_append(buf, &hdr, sizeof(hdr));
+ udebug_entry_append(buf, data, len);
+ udebug_entry_add(buf);
+}
+
void udebug_ubus_init(struct udebug_ubus *ctx, struct ubus_context *ubus,
const char *service, udebug_config_cb cb)
{
void udebug_ubus_init(struct udebug_ubus *ctx, struct ubus_context *ubus,
const char *service, udebug_config_cb cb)
{
diff --git
a/udebug.h
b/udebug.h
index ae48837d09d172c2183008d39e335d5c60a49671..88f663b22235c1e711f38dc5a5584f7dfaf49cf5 100644
(file)
--- a/
udebug.h
+++ b/
udebug.h
@@
-19,6
+19,8
@@
struct udebug_ubus {
udebug_config_cb cb;
};
udebug_config_cb cb;
};
+void udebug_netlink_msg(struct udebug_buf *buf, uint16_t proto, const void *data, size_t len);
+
void udebug_ubus_init(struct udebug_ubus *ctx, struct ubus_context *ubus,
const char *service, udebug_config_cb cb);
void udebug_ubus_ring_init(struct udebug *ud, struct udebug_ubus_ring *ring);
void udebug_ubus_init(struct udebug_ubus *ctx, struct ubus_context *ubus,
const char *service, udebug_config_cb cb);
void udebug_ubus_ring_init(struct udebug *ud, struct udebug_ubus_ring *ring);