Skip to content

Commit f690437

Browse files
committed
CONTRIBUTING: Number/renumber the items lists
For some unknown reason, resynchronization at 6) is necessary to avoid going back 1. We can currently refer to: 1. to 11. in the 'How to add new code and to update existing code' part 1. to 15. in the 'Code style and generic remarks' part Remove a trailing space. [skip ci]
1 parent 72b1580 commit f690437

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed

CONTRIBUTING.md

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -36,37 +36,37 @@ and ask!
3636

3737
## How to add new code and to update existing code
3838

39-
0) Check that there isn't a pull request already opened for the changes you
39+
1) Check that there isn't a pull request already opened for the changes you
4040
intend to make.
4141

4242
1) [Fork](https://help.github.com/articles/fork-a-repo/) the Tcpdump
4343
[repository](https://github.com/the-tcpdump-group/tcpdump).
4444

45-
2) The easiest way to test your changes on multiple operating systems and
45+
1) The easiest way to test your changes on multiple operating systems and
4646
architectures is to let the upstream CI test your pull request (more on
4747
this below).
4848

49-
3) Setup your git working copy
49+
1) Setup your git working copy
5050
```
5151
git clone https://github.com/<username>/tcpdump.git
5252
cd tcpdump
5353
git remote add upstream https://github.com/the-tcpdump-group/tcpdump
5454
git fetch upstream
5555
```
5656

57-
4) Do a `touch .devel` in your working directory.
57+
1) Do a `touch .devel` in your working directory.
5858
Currently, the effect is
5959
* add (via `configure`, in `Makefile`) some warnings options (`-Wall`,
6060
`-Wmissing-prototypes`, `-Wstrict-prototypes`, ...) to the compiler if it
6161
supports these options,
6262
* have the `Makefile` support `make depend` and the `configure` script run it.
6363

64-
5) Configure and build
64+
1) Configure and build
6565
```
6666
./configure && make -s && make check
6767
```
6868

69-
6) Add/update tests
69+
1) Add/update tests
7070
The `tests` directory contains regression tests of the dissection of captured
7171
packets. Those captured packets were saved running tcpdump with option
7272
`-w sample.pcap`. Additional options, such as `-n`, are used to create relevant
@@ -96,73 +96,73 @@ and ask!
9696
It is often useful to have test outputs with different verbosity levels
9797
(none, `-v`, `-vv`, `-vvv`, etc.) depending on the code.
9898

99-
7) Test using `make check` (current build options) and `./build_matrix.sh`
99+
1) Test using `make check` (current build options) and `./build_matrix.sh`
100100
(a multitude of build options, build systems and compilers). If you can,
101101
test on more than one operating system. Don't send a pull request until
102102
all tests pass.
103103

104-
8) Try to rebase your commits to keep the history simple.
104+
1) Try to rebase your commits to keep the history simple.
105105
```
106106
git fetch upstream
107107
git rebase upstream/master
108108
```
109109
(If the rebase fails and you cannot resolve, issue `git rebase --abort`
110110
and ask for help in the pull request comment.)
111111

112-
9) Once 100% happy, put your work into your forked repository using `git push`.
112+
1) Once 100% happy, put your work into your forked repository using `git push`.
113113

114-
10) [Initiate and send](https://help.github.com/articles/using-pull-requests/)
114+
1) [Initiate and send](https://help.github.com/articles/using-pull-requests/)
115115
a pull request.
116116
This will trigger the upstream repository CI tests.
117117

118118

119119
## Code style and generic remarks
120-
* A thorough reading of some other printers code is useful.
121-
122-
* To help learn how tcpdump works or to help debugging:
123-
You can configure and build tcpdump with the instrumentation of functions:
124-
```
125-
$ ./configure --enable-instrument-functions
126-
$ make -s clean all
127-
```
128-
129-
This generates instrumentation calls for entry and exit to functions.
130-
Just after function entry and just before function exit, these
131-
profiling functions are called and print the function names with
132-
indentation and call level.
133-
134-
If entering in a function, it prints also the calling function name with
135-
file name and line number. There may be a small shift in the line number.
136-
137-
In some cases, with Clang 11, the file number is unknown (printed '??')
138-
or the line number is unknown (printed '?'). In this case, use GCC.
139-
140-
If the environment variable INSTRUMENT is
141-
- unset or set to an empty string, print nothing, like with no
142-
instrumentation
143-
- set to "all" or "a", print all the functions names
144-
- set to "global" or "g", print only the global functions names
145-
146-
This allows to run:
147-
```
148-
$ INSTRUMENT=a ./tcpdump ...
149-
$ INSTRUMENT=g ./tcpdump ...
150-
$ INSTRUMENT= ./tcpdump ...
151-
```
152-
or
153-
```
154-
$ export INSTRUMENT=global
155-
$ ./tcpdump ...
156-
```
157-
158-
The library libbfd is used, therefore the binutils-dev package is required.
159-
160-
* Put the normative reference if any as comments (RFC, etc.).
161-
162-
* Put the format of packets/headers/options as comments if there is no
120+
1) A thorough reading of some other printers code is useful.
121+
122+
1) To help learn how tcpdump works or to help debugging:
123+
You can configure and build tcpdump with the instrumentation of functions:
124+
```
125+
$ ./configure --enable-instrument-functions
126+
$ make -s clean all
127+
```
128+
129+
This generates instrumentation calls for entry and exit to functions.
130+
Just after function entry and just before function exit, these
131+
profiling functions are called and print the function names with
132+
indentation and call level.
133+
134+
If entering in a function, it prints also the calling function name with
135+
file name and line number. There may be a small shift in the line number.
136+
137+
In some cases, with Clang 11, the file number is unknown (printed '??')
138+
or the line number is unknown (printed '?'). In this case, use GCC.
139+
140+
If the environment variable INSTRUMENT is
141+
- unset or set to an empty string, print nothing, like with no
142+
instrumentation
143+
- set to "all" or "a", print all the functions names
144+
- set to "global" or "g", print only the global functions names
145+
146+
This allows to run:
147+
```
148+
$ INSTRUMENT=a ./tcpdump ...
149+
$ INSTRUMENT=g ./tcpdump ...
150+
$ INSTRUMENT= ./tcpdump ...
151+
```
152+
or
153+
```
154+
$ export INSTRUMENT=global
155+
$ ./tcpdump ...
156+
```
157+
158+
The library libbfd is used, therefore the binutils-dev package is required.
159+
160+
1) Put the normative reference if any as comments (RFC, etc.).
161+
162+
1) Put the format of packets/headers/options as comments if there is no
163163
published normative reference.
164164

165-
* The printer may receive incomplete packet in the buffer, truncated at any
165+
1) The printer may receive incomplete packet in the buffer, truncated at any
166166
random position, for example by capturing with `-s size` option.
167167
This means that an attempt to fetch packet data based on the expected
168168
format of the packet may run the risk of overrunning the buffer.
@@ -319,11 +319,11 @@ and ask!
319319
DLCI, if the address is a valid Q.922 header, and an error indication
320320
otherwise;
321321

322-
* `LINKADDR_EUI64`, `LINKADDR_ATM`, `LINKADDR_OTHER` -
322+
* `LINKADDR_EUI64`, `LINKADDR_ATM`, `LINKADDR_OTHER` -
323323
the string is a sequence of XX:XX:... values for the bytes
324324
of the address.
325325

326-
* When defining a structure corresponding to a packet or part of a
326+
6) When defining a structure corresponding to a packet or part of a
327327
packet, so that a pointer to packet data can be cast to a pointer to
328328
that structure and that structure pointer used to refer to fields in
329329
the packet, use the `nd_*` types for the structure members.
@@ -356,20 +356,20 @@ and ask!
356356
The `nd_*` type for a byte in a sequence of bytes is `nd_byte`; an
357357
*N*-byte sequence should be declared as `nd_byte[N]`.
358358

359-
* Do invalid packet checks in code: Think that your code can receive in input
359+
1) Do invalid packet checks in code: Think that your code can receive in input
360360
not only a valid packet but any arbitrary random sequence of octets (packet
361361
* built malformed originally by the sender or by a fuzz tester,
362362
* became corrupted in transit or for some other reason).
363363

364364
Print with: `nd_print_invalid(ndo); /* to print " (invalid)" */`
365365

366-
* Use `struct tok` for indexed strings and print them with
366+
1) Use `struct tok` for indexed strings and print them with
367367
`tok2str()` or `bittok2str()` (for flags).
368368
All `struct tok` must end with `{ 0, NULL }`.
369369

370-
* Avoid empty lines in output of printers.
370+
1) Avoid empty lines in output of printers.
371371

372-
* A commit message must have:
372+
1) A commit message must have:
373373
```
374374
First line: Capitalized short summary in the imperative (50 chars or less)
375375
@@ -381,14 +381,14 @@ and ask!
381381
the body.
382382
```
383383

384-
* Avoid non-ASCII characters in code and commit messages.
384+
1) Avoid non-ASCII characters in code and commit messages.
385385

386-
* Use the style of the modified sources.
386+
1) Use the style of the modified sources.
387387

388-
* Don't mix declarations and code.
388+
1) Don't mix declarations and code.
389389

390-
* tcpdump requires a compiler that supports C99 or later, so C99
390+
1) tcpdump requires a compiler that supports C99 or later, so C99
391391
features may be used in code, but C11 or later features should not be
392392
used.
393393

394-
* Avoid trailing tabs/spaces
394+
1) Avoid trailing tabs/spaces

0 commit comments

Comments
 (0)