]> git.proxmox.com Git - mirror_frr.git/blame - COMMUNITY.md
Merge pull request #1470 from donaldsharp/zebra_multicast
[mirror_frr.git] / COMMUNITY.md
CommitLineData
b0ff7312
QY
1Developing for FRRouting
2=========================
3
4## Table of Contents
f6ee5b52 5
4765f35e 6[TOC]
f6ee5b52 7
02fe6f86
DL
8## General note on this document
9
10This document is "descriptive/post-factual" in that it documents pratices that
11are in use; it is not "definitive/pre-factual" in prescribing practices.
12
13This means that when a procedure changes, it is agreed upon, then put into
14practice, and then documented here. If this document doesn't match reality,
15it's the document that needs to be updated, not reality.
16
17
f6ee5b52
DL
18## Git Structure
19
c545559d 20The master Git for FRRouting resides on Github at
b0ff7312 21[https://github.com/frrouting/frr](https://github.com/FRRouting/frr)
f6ee5b52 22
9b7939d9
DL
23![git branches continually merging to the left from 3 lanes; float-right](doc/git_branches.svg
24"git branch mechanics")
25
f1423462
QY
26There is one main branch for development and a release branch for each major
27release.
f6ee5b52 28
02fe6f86 29New contributions are done against the head of the master branch. The CI
f1423462
QY
30systems will pick up the Github Pull Requests or the new patch from Patchwork,
31run some basic build and functional tests.
f6ee5b52 32
f1423462
QY
33For each major release (1.0, 1.1 etc) a new release branch is created based on
34the master.
f6ee5b52 35
f1423462
QY
36There was an attempt to use a "develop" branch automatically maintained by the
37CI system. This is not currently in active use, though the system is
38operational. If the "develop" branch is in active use and this paragraph is
39still here, this document obviously wasn't updated.
02fe6f86 40
f6ee5b52
DL
41
42## Programming language, Tools and Libraries
43
c545559d
QY
44The core of FRRouting is written in C (gcc or clang supported) and makes use of
45GNU compiler extensions. A few non-essential scripts are implemented in Perl
46and Python. FRRouting requires the following tools to build distribution
47packages: automake, autoconf, texinfo, libtool and gawk and various libraries
48(i.e. libpam and libjson-c).
f6ee5b52
DL
49
50If your contribution requires a new library or other tool, then please
c545559d
QY
51highlight this in your description of the change. Also make sure it’s supported
52by all FRRouting platform OSes or provide a way to build without the library
53(potentially without the new feature) on the other platforms.
f6ee5b52 54
f1423462
QY
55Documentation should be written in Tex (.texi) or Markdown (.md) format with a
56preference for Markdown.
f6ee5b52
DL
57
58
b0ff7312
QY
59## Mailing lists
60
61Italicized lists are private.
62
63| Topic | List |
64|--------------------------------|------------------------------|
65| Development | dev@lists.frrouting.org |
66| Users & Operators | frog@lists.frrouting.org |
67| Announcements | announce@lists.frrouting.org |
68| _Security_ | security@lists.frrouting.org |
69| _Technical Steering Committee_ | tsc@lists.frrouting.org |
f6ee5b52 70
f6ee5b52
DL
71
72### Changelog
73
74The changelog will be the base for the release notes. A changelog entry for
75your changes is usually not required and will be added based on your commit
76messages by the maintainers. However, you are free to include an update to
77the changelog with some better description. The changelog will be the base
78for the release notes.
79
80
81## Submitting Patches and Enhancements
82
b0ff7312
QY
83### Pre-submission Checklist
84
500075b7 85* Format code (see [Developer's Guidelines](#developers-guidelines))
b0ff7312
QY
86* Verify and acknowledge license (see [License for contributions](#license-for-contributions))
87* Ensure you have properly signed off (see [Signing Off](#signing-off))
88* Test building with various configurations:
89 * `buildtest.sh`
90* Verify building source distribution:
91 * `make dist` (and try rebuilding from the resulting tar file)
92* Run unit tests:
93 * `make test`
94* Document Regression Runs and plans for continued maintenance of the feature
95
f6ee5b52
DL
96### License for contributions
97
c545559d 98FRRouting is under a “GPLv2 or later” license. Any code submitted must be
f6ee5b52
DL
99released under the same license (preferred) or any license which allows
100redistribution under this GPLv2 license (eg MIT License).
101
b0ff7312
QY
102### Signing Off
103
104Code submitted to FRRouting must be signed off. We have the same requirements
105for using the signed-off-by process as the Linux kernel. In short, you must
106include a signed-off-by tag in every patch.
f6ee5b52 107
b0ff7312
QY
108`Signed-off-by:` this is a developer's certification that he or she has the
109right to submit the patch for inclusion into the project. It is an agreement to
110the Developer's Certificate of Origin (below). Code without a proper signoff
4b8ac525 111can not and will not be merged.
b0ff7312
QY
112
113If you are unfamiliar with this process, you should read the [official policy
78b7a6e3 114at kernel.org](https://www.kernel.org/doc/html/latest/process/submitting-patches.html) and
b0ff7312
QY
115you might find this article about [participating in the Linux community on the
116Linux Foundation
117website](http://www.linuxfoundation.org/content/how-participate-linux-community-0)
118to be a helpful resource.
119
120In short, when you sign off on a commit, you assert your agreement to all of
121the following:
f6ee5b52
DL
122
123> Developer's Certificate of Origin 1.1
124>
125> By making a contribution to this project, I certify that:
126>
127> (a) The contribution was created in whole or in part by me and I
128> have the right to submit it under the open source license
129> indicated in the file; or
130>
131> (b) The contribution is based upon previous work that, to the best
132> of my knowledge, is covered under an appropriate open source
133> license and I have the right under that license to submit that
134> work with modifications, whether created in whole or in part
135> by me, under the same open source license (unless I am
136> permitted to submit under a different license), as indicated
137> in the file; or
138>
139> (c) The contribution was provided directly to me by some other
140> person who certified (a), (b) or (c) and I have not modified
141> it.
142>
143> (d) I understand and agree that this project and the contribution
144> are public and that a record of the contribution (including all
145> personal information I submit with it, including my sign-off) is
146> maintained indefinitely and may be redistributed consistent with
147> this project or the open source license(s) involved.
148
b0ff7312 149### What do I submit my changes against?
e0ba80e2
DS
150
151We've documented where we would like to have the different fixes applied at
152https://github.com/FRRouting/frr/wiki/Where-Do-I-create-a-Pull-Request-against%3F
f1423462
QY
153If you are unsure where your submission goes, look at that document or ask a
154project maintainer.
f6ee5b52 155
b0ff7312 156### Github pull requests
f6ee5b52 157
b0ff7312 158The preferred method of submitting changes is a Github pull request. Code
f1423462
QY
159submitted by pull request will be automatically tested by one or more CI
160systems. Once the automated tests succeed, other developers will review your
161code for quality and correctness. After any concerns are resolved, your code
162will be merged into the branch it was submitted against.
f6ee5b52 163
b0ff7312 164### Patch submission via mailing list
f6ee5b52 165
b0ff7312
QY
166As an alternative submission method, a patch can be mailed to the development
167mailing list. Patches received on the mailing list will be picked up by
168Patchwork and tested against the latest development branch.
f6ee5b52
DL
169
170The recommended way to send the patch (or series of NN patches) to the list is
b0ff7312 171by using `git send-email` as follows (assuming they are the N most recent
f6ee5b52
DL
172commit(s) in your git history:
173
174```
b0ff7312 175git send-email -NN --annotate --to=dev@lists.frrouting.org
f6ee5b52
DL
176```
177
178If your commits do not already contain a `Signed-off-by` line, then use the
b0ff7312
QY
179following command to add it (after making sure you agree to the Developer
180Certificate of Origin as outlined above):
f6ee5b52
DL
181
182```
b0ff7312 183git send-email -NN --annotate --signoff --to=dev@lists.frrouting.org
f6ee5b52
DL
184```
185
b0ff7312
QY
186Submitting multi-commit patches as a Github pull request is **strongly
187encouraged** and increases the probability of your patch getting reviewed and
188merged in a timely manner.
f6ee5b52
DL
189
190
191## After submitting your changes
192
193* Watch for Continuous Integration (CI) Test results
194 * You should automatically receive an email with the test results within
195 less than 2 hrs of the submission. If you don’t get the email, then check
196 status on the github pull request (if submitted by pull request) or on
4765f35e 197 Patchwork at
b0ff7312 198 [https://patchwork.frrouting.org](https://patchwork.frrouting.org) (if
4765f35e 199 submitted as patch to mailing list).
4b8ac525
QY
200 * Please notify the development mailing list if you think something doesn’t
201 work.
f6ee5b52
DL
202* If the tests failed:
203 * In general, expect the community to ignore the submission until the tests
204 pass.
205 * It is up to you to fix and resubmit.
b0ff7312 206 * This includes fixing existing unit (“make test”) tests if your
f6ee5b52
DL
207 changes broke or changed them.
208 * It also includes fixing distribution packages for the failing
4b8ac525
QY
209 platforms (ie if new libraries are required).
210 * Feel free to ask for help on the development list.
f6ee5b52
DL
211 * Go back to the submission process and repeat until the tests pass.
212* If the tests pass:
b0ff7312
QY
213 * Wait for reviewers. Someone will review your code or be assigned to
214 review your code.
215 * Respond to any comments or concerns the reviewer has.
216 * After all comments and concerns are addressed, expect your patch to be
217 merged.
f6ee5b52
DL
218* Watch out for questions on the mailing list. At this time there will be a
219 manual code review and further (longer) tests by various community members.
b0ff7312 220* Your submission is done once it is merged to the master branch.
f6ee5b52
DL
221
222
a03e3526 223## Developer's Guidelines
f6ee5b52 224
53c2f1b7
QY
225### Commit messages
226
227Commit messages should be formatted in the same way as Linux kernel commit
228messages. The format is roughly
229
91a0d75f
MS
230```
231dir: short summary
53c2f1b7 232
91a0d75f
MS
233extended summary
234```
53c2f1b7
QY
235
236`dir` should be the top level source directory under which the change was made.
237For example, a change in bgpd/rfapi would be formatted as:
238
239`bgpd: short summary`
240
241The first line should be no longer than 50 characters. Subsequent lines should
242be wrapped to 72 characters.
243
c545559d 244### Source file header
f6ee5b52 245
4765f35e
DL
246New files need to have a Copyright header (see [License for
247contributions](#license-for-contributions) above) added to the file. Preferred
248form of the header is as follows:
f6ee5b52
DL
249
250```
251/*
896014f4
DL
252 * Title/Function of file
253 * Copyright (C) YEAR Author’s Name
254 *
255 * This program is free software; you can redistribute it and/or modify it
256 * under the terms of the GNU General Public License as published by the Free
257 * Software Foundation; either version 2 of the License, or (at your option)
258 * any later version.
259 *
260 * This program is distributed in the hope that it will be useful, but WITHOUT
261 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
262 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
263 * more details.
264 *
265 * You should have received a copy of the GNU General Public License along
266 * with this program; see the file COPYING; if not, write to the Free Software
267 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
f6ee5b52 268 */
4765f35e
DL
269
270#include <zebra.h>
f6ee5b52
DL
271```
272
c545559d 273### Adding copyright claims to existing files
f6ee5b52
DL
274
275When adding copyright claims for modifications to an existing file, please
276preface the claim with "Portions: " on a line before it and indent the
277"Copyright ..." string. If such a case already exists, add your indented claim
278immediately after. E.g.:
279
280```
281Portions:
282 Copyright (C) 2010 Entity A ....
283 Copyright (C) 2016 Your name [optional brief change description]
284```
285
c545559d 286### Code formatting
f6ee5b52 287
b0ff7312
QY
288FRR uses Linux kernel style except where noted below. Code which does not
289comply with these style guidelines will not be accepted.
02fe6f86 290
b0ff7312 291To assist with compliance, in the project root there is a .clang-format
6058ea8c
QY
292configuration file which can be used with the `clang-format` tool from the LLVM
293project. In the `tools/` directory there is a Python script named `indent.py`
294that wraps clang-format and handles some edge cases specific to FRR. If you are
295submitting a new file, it is recommended to run that script over the new file
296after ensuring that the latest stable release of `clang-format` is in your
297PATH.
02fe6f86
DL
298
299**Whitespace changes in untouched parts of the code are not acceptable in
300patches that change actual code.** To change/fix formatting issues, please
301create a separate patch that only does formatting changes and nothing else.
302
b0ff7312 303#### Style documentation
6058ea8c 304Kernel and BSD styles are documented externally:
02fe6f86 305
6058ea8c
QY
306* [https://www.kernel.org/doc/html/latest/process/coding-style.html](https://www.kernel.org/doc/html/latest/process/coding-style.html)
307* [http://man.openbsd.org/style](http://man.openbsd.org/style)
02fe6f86 308
6058ea8c 309For GNU coding style, use `indent` with the following invocation:
f6ee5b52
DL
310
311```
312indent -nut -nfc1 file_for_submission.c
313```
314
6058ea8c
QY
315#### Exceptions
316
317FRR project code comes from a variety of sources, so there are some stylistic
c545559d 318exceptions in place. They are organized here by branch.
02fe6f86 319
6058ea8c 320**For `master`:**
02fe6f86 321
6058ea8c 322BSD coding style applies to:
02fe6f86 323
c545559d 324* `ldpd/`
02fe6f86 325
6058ea8c
QY
326`babeld` uses, approximately, the following style:
327
328* K&R style braces
329* Indents are 4 spaces
330* Function return types are on their own line
331
332
333**For `stable/3.0` and `stable/2.0`:**
334
335GNU coding style apply to the following parts:
336
c545559d
QY
337* `lib/`
338* `zebra/`
339* `bgpd/`
340* `ospfd/`
341* `ospf6d/`
342* `isisd/`
343* `ripd/`
344* `ripngd/`
345* `vtysh/`
02fe6f86 346
6058ea8c 347BSD coding style applies to:
02fe6f86 348
c545559d 349* `ldpd/`
02fe6f86 350
02fe6f86 351
a03e3526
QY
352### Documentation
353
354FRRouting is a large and complex software project developed by many different
355people over a long period of time. Without adequate documentation, it can be
356exceedingly difficult to understand code segments, APIs and other interfaces.
357In the interest of keeping the project healthy and maintainable, you should
358make every effort to document your code so that other people can understand
359what it does without needing to closely read the code itself.
360
361Some specific guidelines that contributors should follow are:
362
363* Functions exposed in header files should have descriptive comments above
364 their signatures in the header file. At a minimum, a function comment should
365 contain information about the return value, parameters, and a general summary
366 of the function's purpose. Documentation on parameter values can be omitted
367 if it is (very) obvious what they are used for.
368
369 Function comments must follow the style for multiline comments laid out in
370 the kernel style guide.
371
372Example:
373
374```
375/*
376 * Determines whether or not a string is cool.
377 *
378 * @param text - the string to check for coolness
379 * @param is_clccfc - whether capslock is cruise control for cool
380 * @return 7 if the text is cool, 0 otherwise
381 */
382int check_coolness(const char *text, bool is_clccfc);
383```
384
385The Javadoc-style annotations are not required, but you should still strive to
386make it equally clear what parameters and return values are used for.
387
388* Static functions should have descriptive comments in the same form as above
389 if what they do is not immediately obvious. Use good engineering judgement
390 when deciding whether a comment is necessary. If you are unsure, document
391 your code.
392
393* Global variables, static or not, should have a comment describing their use.
394
395* **For new code in `lib/`, these guidelines are hard requirements.**
396
397
398If you are contributing code that adds significant user-visible functionality
399or introduces a new API, please document it in `doc/`. Markdown and LaTeX are
400acceptable formats, although Markdown is currently preferred for new
401documentation. This may change in the near future.
402
403Finally, if you come across some code that is undocumented and feel like going
404above and beyond, document it! We absolutely appreciate and accept patches that
405document previously undocumented code.
f6ee5b52 406
c545559d 407### Compile-time conditional code
f6ee5b52 408
f1423462
QY
409Many users access FRR via binary packages from 3rd party sources; compile-time
410code puts inclusion/exclusion in the hands of the package maintainer. Please
411think very carefully before making code conditional at compile time, as it
412increases regression testing, maintenance burdens, and user confusion. In
413particular, please avoid gratuitous `--enable-…` switches to the configure
414script - in general, code should be of high quality and in working condition,
415or it shouldn’t be in FRR at all.
f6ee5b52
DL
416
417When code must be compile-time conditional, try have the compiler make it
c545559d
QY
418conditional rather than the C pre-processor so that it will still be checked by
419the compiler, even if disabled. For example,
f6ee5b52
DL
420
421```
422if (SOME_SYMBOL)
423 frobnicate();
424```
425
c545559d 426is preferred to
f6ee5b52
DL
427
428```
429#ifdef SOME_SYMBOL
430frobnicate ();
431#endif /* SOME_SYMBOL */
432```
433
434Note that the former approach requires ensuring that `SOME_SYMBOL` will be
435defined (watch your `AC_DEFINE`s).
7ce0cb3c 436
c545559d 437### Debug-guards in code
7ce0cb3c 438
f1423462
QY
439Debugging statements are an important methodology to allow developers to fix
440issues found in the code after it has been released. The caveat here is that
441the developer must remember that people will be using the code at scale and in
442ways that can be unexpected for the original implementor. As such debugs
443**MUST** be guarded in such a way that they can be turned off. FRR has the
444ability to turn on/off debugs from the CLI and it is expected that the
445developer will use this convention to allow control of their debugs.
19c7f43f 446
c545559d 447### CLI changes
19c7f43f 448
f1423462
QY
449CLI's are a complicated ugly beast. Additions or changes to the CLI should use
450a DEFUN to encapsulate one setting as much as is possible. Additionally as new
451DEFUN's are added to the system, documentation should be provided for the new
452commands.
e887b2b8
LB
453
454### Backwards Compatibility
455
f1423462
QY
456As a general principle, changes to CLI and code in the lib/ directory should be
457made in a backwards compatible fashion. This means that changes that are purely
458stylistic in nature should be avoided, e.g., renaming an existing macro or
459library function name without any functional change. When adding new parameters
460to common functions, it is also good to consider if this too should be done in
461a backward compatible fashion, e.g., by preserving the old form in addition to
e887b2b8
LB
462adding the new form.
463
f1423462
QY
464This is not to say that minor or even major functional changes to CLI and
465common code should be avoided, but rather that the benefit gained from a change
466should be weighed against the added cost/complexity to existing code. Also,
467that when making such changes, it is good to preserve compatibility when
468possible to do so without introducing maintenance overhead/cost. It is also
469important to keep in mind, existing code includes code that may reside in
470private repositories (and is yet to be submitted) or code that has yet to be
471migrated from Quagga to FRR.
817302b8
DL
472
473That said, compatibility measures can (and should) be removed when either:
474
f1423462
QY
475* they become a significant burden, e.g. when data structures change and the
476 compatibility measure would need a complex adaptation layer or becomes
817302b8 477 flat-out impossible
f1423462
QY
478* some measure of time (dependent on the specific case) has passed, so that the
479 compatibility grace period is considered expired.
817302b8
DL
480
481In all cases, compatibility pieces should be marked with compiler/preprocessor
482annotations to print warnings at compile time, pointing to the appropriate
483update path. A `-Werror` build should fail if compatibility bits are used.
a03e3526
QY
484
485### Miscellaneous
486
487When in doubt, follow the guidelines in the Linux kernel style guide, or ask on
488the development mailing list / public Slack instance.