File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -494,6 +494,25 @@ static int tlshd_genl_put_remote_peerids(struct nl_msg *msg,
494494 return 0 ;
495495}
496496
497+ static int tlshd_genl_put_tag (const char * name ,
498+ __attribute__ ((unused )) void * data )
499+ {
500+ struct nl_msg * msg = data ;
501+ int err ;
502+
503+ err = nla_put_string (msg , HANDSHAKE_A_DONE_TAG , name );
504+ if (err < 0 ) {
505+ tlshd_log_nl_error ("nla_put tag" , err );
506+ return -1 ;
507+ }
508+ return 0 ;
509+ }
510+
511+ static int tlshd_genl_put_tag_list (struct nl_msg * msg )
512+ {
513+ return tlshd_tags_for_each_matched (tlshd_genl_put_tag , (void * )msg );
514+ }
515+
497516/**
498517 * tlshd_genl_done - Indicate handshake has completed successfully
499518 * @parms: buffer filled in with parameters
@@ -551,6 +570,12 @@ void tlshd_genl_done(struct tlshd_handshake_parms *parms)
551570 if (err < 0 )
552571 goto out_free ;
553572
573+ err = tlshd_genl_put_tag_list (msg );
574+ if (err < 0 ) {
575+ tlshd_log_nl_error ("nla_put tag list" , err );
576+ goto out_free ;
577+ }
578+
554579sendit :
555580 if (tlshd_delay_done ) {
556581 /* Undocumented tlshd.conf parameter:
Original file line number Diff line number Diff line change @@ -1669,3 +1669,31 @@ void tlshd_tags_config_shutdown(void)
16691669 tlshd_tags_filter_type_hash_destroy ();
16701670 tlshd_tags_name_destroy ();
16711671}
1672+
1673+ /**
1674+ * tlshd_tags_for_each_matched - Call @cb for each matched tag
1675+ * @cb: callback function
1676+ * @data: data to be passed to each callback
1677+ *
1678+ * Returns zero if the callback returned only zeroes. Otherwise, the
1679+ * first non-zero callback return stops the loop and returns that
1680+ * non-zero value.
1681+ */
1682+ int tlshd_tags_for_each_matched (int (* cb )(const char * name , void * data ),
1683+ void * data )
1684+ {
1685+ GHashTableIter iter ;
1686+ gpointer key , value ;
1687+
1688+ if (!tlshd_tags_tag_hash )
1689+ return 0 ;
1690+
1691+ g_hash_table_iter_init (& iter , tlshd_tags_tag_hash );
1692+ while (g_hash_table_iter_next (& iter , & key , & value )) {
1693+ struct tlshd_tags_tag * tag = (struct tlshd_tags_tag * )value ;
1694+
1695+ if (tag -> ta_matched )
1696+ (cb )(tag -> ta_name , data );
1697+ }
1698+ return 0 ;
1699+ }
Original file line number Diff line number Diff line change @@ -123,6 +123,8 @@ extern void tlshd_quic_serverhello_handshake(struct tlshd_handshake_parms *parms
123123extern bool tlshd_tags_config_init (const char * tagsdir );
124124extern void tlshd_tags_config_shutdown (void );
125125extern void tlshd_tags_match_session (gnutls_session_t session );
126+ extern int tlshd_tags_for_each_matched (int (* cb )(const char * name , void * data ),
127+ void * data );
126128
127129#ifdef HAVE_GNUTLS_QUIC
128130#include <linux/quic.h>
You can’t perform that action at this time.
0 commit comments