forked from osmocom/wireshark
wiretap: Register a systemd Journal Export Block
The block is lightweight and doesn't have any options so the create function doesn't really do anything, but it needs to be registered so that when systemd journal files are opened, the wtap_block_create() call works and doesn't segfault. Fix #17875
This commit is contained in:
parent
7da31cb139
commit
203820f3d0
|
@ -1623,6 +1623,12 @@ static void pkt_create(wtap_block_t block)
|
|||
block->mandatory_data = NULL;
|
||||
}
|
||||
|
||||
static void sjeb_create(wtap_block_t block)
|
||||
{
|
||||
/* Ensure this is null, so when g_free is called on it, it simply returns */
|
||||
block->mandatory_data = NULL;
|
||||
}
|
||||
|
||||
static void cb_create(wtap_block_t block)
|
||||
{
|
||||
/* Ensure this is null, so when g_free is called on it, it simply returns */
|
||||
|
@ -1853,6 +1859,16 @@ void wtap_opttypes_initialize(void)
|
|||
WTAP_OPTTYPE_FLAG_MULTIPLE_ALLOWED
|
||||
};
|
||||
|
||||
static wtap_blocktype_t journal_block = {
|
||||
WTAP_BLOCK_SYSTEMD_JOURNAL_EXPORT, /* block_type */
|
||||
"SJEB", /* name */
|
||||
"systemd Journal Export Block", /* description */
|
||||
sjeb_create, /* create */
|
||||
NULL, /* free_mand */
|
||||
NULL, /* copy_mand */
|
||||
NULL /* options */
|
||||
};
|
||||
|
||||
static wtap_blocktype_t cb_block = {
|
||||
WTAP_BLOCK_CUSTOM, /* block_type */
|
||||
"CB", /* name */
|
||||
|
@ -1923,6 +1939,11 @@ void wtap_opttypes_initialize(void)
|
|||
wtap_opttype_option_register(&pkt_block, OPT_PKT_HASH, &pkt_hash);
|
||||
wtap_opttype_option_register(&pkt_block, OPT_PKT_VERDICT, &pkt_verdict);
|
||||
|
||||
/*
|
||||
* Register the SJEB and the (no) options that can appear in it.
|
||||
*/
|
||||
wtap_opttype_block_register(&journal_block);
|
||||
|
||||
/*
|
||||
* Register the CB and the options that can appear in it.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue