OpenVPN / OpenVPN/openvpn

add instrumentation around close() calls

Open
#967 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature
Dominant language
C
Stars
14.6k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

In #966 what finally helped tracking down the bug was replacing all close() calls with a call to this macro

#define openvpn_close_socket(s) ({ int r; msg(D_DCO_DEBUG, "%s: openvpn_close_socket(%d)", __func__, (int)s); r = close(s); r; })

my understanding is that this is GCC specific (the bit about the int r; ... ; r; giving the macro the return value of close(s)), so it needs to be conditional.

Also, it needs a good home (not socket.h), and maybe be called openvpn_close() or such... and a decision on the right loglevel to use.

But I guess with multisockets and inotify, there might be more file descriptor hunting coming up, and making this something one can just switch on might come in handy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing issue #966 and locating the close() call sites that need instrumentation. Decide how the macro should be implemented conditionally, where it belongs, what name and log level it should use, and how instrumentation can be switched on; done means the relevant close calls emit useful diagnostics without breaking supported compilers.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.