2 title: Conventions for working on Quagga
4 geometry: a4paper,scale=0.82
9 \large This is a living document describing the processes and guidelines
10 for working on Quagga. You *must* read Section
11 ["REQUIRED READING"](#sec:required), before contributing to Quagga.
13 Suggestions for updates, via the
14 [quagga-dev list](http://lists.quagga.net/mailman/listinfo/quagga-dev),
20 OBJECTIVES {#sec:goals}
23 The objectives of the Quagga project are to develop and implement high
24 quality routing protocols and related software, maximising:
27 * Quagga is and will remain a copyleft, free software project
28 * Some non-core parts may be available under compatible, permissive
29 licenses to facilitate code sharing, where contributors agree.
30 * The test and integration orchestration infrastructure shall be free
31 software, developed similarly to the rest of Quagga. Proprietary
32 conformance suites may be among the test tools orchestrated.
33 * Openness and transparency
34 * The business of the project shall be conducted on its public email
35 lists, to the greatest extent possible.
36 * The design of the software will be governed by open discussion on
37 the public email lists.
38 * Participants shall endeavour to be transparent about their interests
39 in the project, and any associations likely to be relevant.
41 * The licenses of all copyright holders will be respected, and the
42 project will err in their favour where there is reasonable doubt or
43 legal advice to that effect.
44 * Participants will behave with respect for others, and in a manner that
45 builds and maintains the trust needed for productive collaboration.
47 See also the Section on [CODE OF CONDUCT](#sec:codeconduct).
49 Governance {#sec:governance}
52 Quagga is a Sociocracy, as it has been since its earliest days.
54 Quagga was forked from GNU Zebra by Paul Jakma, who holds the domain name.
55 Governance was soon devolved to a collective group, the maintainers,
56 consisting of those who regularly contributed and reviewed code. The
57 details can easily be changed.
59 You are free to use reason to _persuade_ others to adopt some alternative.
60 If, after that, you truly can not abide by what is mutually agreeable, you
61 are asked to do the honourable thing: take your copy of the code, make your
62 apologies, and be on your way with good grace.
64 Those who repeatedly violate the [Code of Conduct](#sec:codeconduct) will be
67 Holding of project assets
68 -------------------------
70 One or more mature, independent trustees, with technical and free software
71 experience, will be appointed as the executor(s) for key assets of the
72 project to ensure continuity, such as the domain name.
74 Should a corporate vehicle ever be created to hold such assets it __must__:
76 * Publish up to date accounts on a regular business.
77 * Generally operate openly and transparently.
78 * Have control distributed, with a significant degree of control held
79 independent of any contributors with business interests in the software.
80 * Carry out no other business itself that may be seen to conflict or compete
81 with the business of others in the community.
82 * Have all officers disclose all interests that could be
83 seen to have a bearing on the project, as far as is reasonable.
85 It not clear at this time that the overheads and potential liabilities of
86 such a vehicle would be appropriate for this project. These principles
87 should though still be applied, where possible, to any non-corporate body
88 formed around the project.
90 CODE OF CONDUCT {#sec:codeconduct}
93 Participants will treat each other with respect and integrity. Participants
94 will build and treasure the trust that is required for parties to
95 successfully collaborate together on free software. Particularly when those
96 parties may have competing interests. The following principles and
97 guidelines should be followed to foster that trust:
99 * Participants should be open about their goals, and their interests.
100 - Business associations with other participants should be disclosed,
101 so far as is reasonable and where applicable. E.g., if there is voting
102 on matters, or in endorsements or objections to contributions.
103 - Other associations and interests that may be relevant should be
104 disclosed, to the degree necessary to avoid any perception
105 by others of conflicts of interests or of deception.
106 - Be open about your goals, so as to maximise the common understanding
107 and minimise any misunderstandings and disputes.
108 * Design should be done in the open
109 - Do your design on list, ahead of significant implementation. Avoid
110 "Surprise!" development where possible.
111 - Where significant implementation work must be done behind closed
112 doors, accept that you may be asked to rework it, potentially from
113 scratch once you take it public.
114 - Get "buy in" from others ahead of time, to avoid disappointment.
116 - Feedback on design should be constructive, thoughtful and
118 - Avoid personalising matters. Discuss the idea, the code, the abstract
119 subject and avoid unnecessary personal pronouns.
120 - Avoid language that paints either party into a corner. Leave some room
121 for doubt. Ask questions, rather than make assertions, where possible.
122 * Disputes should be resolved through calm, analytic discussion
123 - Separate out as much of the matter under dispute into principles that
124 can be agreed on, and into the objective domain (by measurement or
126 - Seek ways to resolve any remaining subjective differences by alternate
127 paths that can accommodate both sides, e.g., through abstraction or
131 - Avoid passive-aggressive behaviours. E.g., tit-for-tat
132 non-constructive behaviour. Be explicit.
133 - It is acceptable for management to allocate resources on development
134 according to their need. It is not acceptable to try use external,
135 management intervention to over-turn positions held by participants.
137 REQUIRED READING {#sec:required}
140 Note well: By proposing a change to Quagga, by whatever means, you are
143 - To licence your contribution according to the licence of any files in
144 Quagga being modified, _and_ according to the COPYING file in the
145 top-level directory of Quagga, other than where the contribution
146 explicitly and clearly indicates otherwise.
148 - That it is your responsibility to ensure you hold whatever rights are
149 required to be able to contribute your changes under the licenses of the
150 files in Quagga being modified, and the top-level COPYING file.
152 - That it is your responsibility to give with the contribution a full
153 account of all interests held and claims in the contribution; such as
154 through copyright, trademark and patent laws or otherwise; that are known
155 to you or your associates (e.g. your employer).
157 Before contributing to Quagga, you *must* also read
158 [Section COMMIT MESSAGES](#sec:commit-messages).
160 You _should_ ideally read the entire document, as it contains useful
161 information on the community norms and how to implement them.
163 Please note that authorship and any relevant other rights information should
164 be _explicitly_ stated with the contribution. A "Signed-off-by" line is
165 _not_ sufficient. The "Signed-off-by" line is not used by the Quagga
168 You may document applicable copyright claims to files being modified or
169 added by your contribution. For new files, the standard way is to add a
170 string in the following format near the beginning of the file:
172 Copyright (C) <Year> <name of person/entity>[, optional contact details]
174 When adding copyright claims for modifications to an existing file, please
175 preface the claim with "Portions: " on a line before it and indent the
176 "Copyright ..." string. If such a case already exists, add your indented
177 claim immediately after. E.g.:
180 Copyright (C) <Year> <Entity A> ....
181 Copyright (C) <Year> <Your details> [optional brief change description]
184 GUIDELINES FOR HACKING ON QUAGGA {#sec:guidelines}
185 ================================
187 GNU coding standards apply. Indentation follows the result of
188 invoking GNU indent (as of 2.2.8a) with the -–nut argument.
190 Originally, tabs were used instead of spaces, with tabs are every 8 columns.
191 However, tab’s interoperability issues mean space characters are now preferred for
192 new changes. We generally only clean up whitespace when code is unmaintainable
193 due to whitespace issues, to minimise merging conflicts.
195 Be particularly careful not to break platforms/protocols that you
198 Parsers or packet-writers of data from untrusted parties, particularly
199 remote ones, *MUST* use the lib/stream bounded-buffer abstraction, and use
200 its checked getters and putters. Twiddling of pointers based on contents of
201 untrusted data is _strongly_ discouraged - any such code is not acceptable,
202 unless there are very good reasons (e.g. compatibility with external or old
203 code that is not easily rewritten).
205 New code should have good comments, which explain why the code is correct.
206 Changes to existing code should in many cases upgrade the comments when
207 necessary for a reviewer to conclude that the change has no unintended
210 Each file in the Git repository should have a git format-placeholder (like
211 an RCS Id keyword), somewhere very near the top, commented out appropriately
212 for the file type. The placeholder used for Quagga (replacing \<dollar\>
215 `$QuaggaId: <dollar>Format:%an, %ai, %h<dollar> $`
217 See line 2 of HACKING.tex, the source for this document, for an example.
219 This placeholder string will be expanded out by the ‘git archive’ commands,
220 which is used to generate the tar archives for snapshots and releases.
222 Please document fully the proper use of a new function in the header file
223 in which it is declared. And please consult existing headers for
224 documentation on how to use existing functions. In particular, please consult
227 <span>lib/log.h</span> logging levels and usage guidance
229 <span>[more to be added]</span>
231 If changing an exported interface, please try to deprecate the interface in
232 an orderly manner. If at all possible, try to retain the old deprecated
233 interface as is, or functionally equivalent. Make a note of when the
234 interface was deprecated and guard the deprecated interface definitions in
235 the header file, i.e.:
237 /* Deprecated: 20050406 */
238 #if !defined(QUAGGA_NO_DEPRECATED_INTERFACES)
239 #warning "Using deprecated <libname> (interface(s)|function(s))"
241 #endif /* QUAGGA_NO_DEPRECATED_INTERFACES */
243 This is to ensure that the core Quagga sources do not use the deprecated
244 interfaces (you should update Quagga sources to use new interfaces, if
245 applicable), while allowing external sources to continue to build.
246 Deprecated interfaces should be excised in the next unstable cycle.
248 Note: If you wish, you can test for GCC and use a function
249 marked with the ’deprecated’ attribute. However, you must provide the
250 warning for other compilers.
252 If changing or removing a command definition, *ensure* that you
253 properly deprecate it - use the \_DEPRECATED form of the appropriate DEFUN
254 macro. This is *critical*. Even if the command can no longer
255 function, you *MUST* still implement it as a do-nothing stub.
257 Failure to follow this causes grief for systems administrators, as an
258 upgrade may cause daemons to fail to start because of unrecognised commands.
259 Deprecated commands should be excised in the next unstable cycle. A list of
260 deprecated commands should be collated for each release.
262 See also [Section SHARED LIBRARY VERSIONING](#sec:dll-versioning) below.
264 YOUR FIRST CONTRIBUTIONS
265 ========================
267 Routing protocols can be very complex sometimes. Then, working with an
268 Opensource community can be complex too, but usually friendly with
269 anyone who is ready to be willing to do it properly.
271 - First, start doing simple tasks. Quagga’s patchwork is a good place
272 to start with. Pickup some patches, apply them on your git trie,
273 review them and send your ack’t or review comments. Then, a
274 maintainer will apply the patch if ack’t or the author will have to
275 provide a new update. It help a lot to drain the patchwork queues.
276 See <http://patchwork.quagga.net/project/quagga/list/>
278 - The more you’ll review patches from patchwork, the more the Quagga’s
279 maintainers will be willing to consider some patches you will be
282 - start using git clone, pwclient
283 <http://patchwork.quagga.net/help/pwclient/>
285 $ pwclient list -s new
288 179 New [quagga-dev,6648] Re: quagga on FreeBSD 4.11 (gcc-2.95)
289 181 New [quagga-dev,6660] proxy-arp patch
292 $ pwclient git-am 1046
294 HANDY GUIDELINES FOR MAINTAINERS
295 ================================
297 Get your cloned trie:
299 git clone vjardin@git.sv.gnu.org:/srv/git/quagga.git
301 Apply some ack’t patches:
304 Applying patch #1046 using 'git am'
305 Description: [quagga-dev,11595] zebra: route_unlock_node is missing in "show ip[v6] route <prefix>" commands
306 Applying: zebra: route_unlock_node is missing in "show ip[v6] route <prefix>" commands
308 Run a quick review. If the ack’t was not done properly, you know who you have
315 Set the patch to accepted on patchwork
317 pwclient update -s Accepted 1046
319 COMPILE-TIME CONDITIONAL CODE
320 =============================
322 Please think very carefully before making code conditional at compile time,
323 as it increases maintenance burdens and user confusion. In particular,
324 please avoid gratuitous -–enable-… switches to the configure script -
325 typically code should be good enough to be in Quagga, or it shouldn’t be
328 When code must be compile-time conditional, try have the compiler make it
329 conditional rather than the C pre-processor - so that it will still be
330 checked by the compiler, even if disabled. I.e. this:
339 #endif /* SOME_SYMBOL */
341 Note that the former approach requires ensuring that SOME\_SYMBOL will
342 be defined (watch your AC\_DEFINEs).
344 COMMIT MESSAGES {#sec:commit-messages}
345 ======================================
347 The commit message requirements are:
349 - The message *MUST* provide a suitable one-line summary followed by a
350 blank line as the very first line of the message, in the form:
352 `topic: high-level, one line summary`
354 Where topic would tend to be name of a subdirectory, and/or daemon, unless
355 there’s a more suitable topic (e.g. ’build’). This topic is used to
356 organise change summaries in release announcements.
358 - It should have a suitable “body”, which tries to address the
359 following areas, so as to help reviewers and future browsers of the
360 code-base understand why the change is correct (note also the code
361 comment requirements):
363 - The motivation for the change (does it fix a bug, if so which?
366 - The general approach taken, and trade-offs versus any other
369 - Any testing undertaken or other information affecting the confidence
370 that can be had in the change.
372 - Information to allow reviewers to be able to tell which specific
373 changes to the code are intended (and hence be able to spot any accidental
376 - The commit message *must* give details of all the authors of the change,
377 beyond the person listed in the Author field. Any and all affiliations
378 which may have a bearing on copyright in any way should be clearly
379 stated, unless those affiliations are already obvious from other
380 details, e.g. from the email address. This would cover employment and
381 contracting obligations (give details).
383 Note: Do not rely on "Signed-off-by" for this, be explicit.
385 - If the change introduces a new dependency on any code or other
386 copyrighted material, please explicitly note this. Give details of what
387 that external material is, the copyright licence the material may be
388 used under, and the nature of the dependency.
390 The one-line summary must be limited to 54 characters, and all other
391 lines to 72 characters.
393 Commit message bodies in the Quagga project have typically taken the
396 - An optional introduction, describing the change generally.
398 - A short description of each specific change made, preferably:
402 - function by function (use of “ditto”, or globs is allowed)
404 Contributors are strongly encouraged to follow this form.
406 This itemised commit messages allows reviewers to have confidence that the
407 author has self-reviewed every line of the patch, as well as providing
408 reviewers a clear index of which changes are intended, and descriptions for
409 them (C-to-english descriptions are not desirable - some discretion is
410 useful). For short patches, a per-function/file break-down may be
411 redundant. For longer patches, such a break-down may be essential. A
412 contrived example (where the general discussion is obviously somewhat
413 redundant, given the one-line summary):
415 > zebra: Enhance frob FSM to detect loss of frob
417 > Add a new DOWN state to the frob state machine to allow the barinator to
418 > detect loss of frob.
420 > * frob.h: (struct frob) Add DOWN state flag.
421 > * frob.c: (frob_change) set/clear DOWN appropriately on state change.
422 > * bar.c: (barinate) Check frob for DOWN state.
424 Please have a look at the git commit logs to get a feel for what the norms
427 Note that the commit message format follows git norms, so that “git log
428 –oneline” will have useful output.
430 HACKING THE BUILD SYSTEM
431 ========================
433 If you change or add to the build system (configure.ac, any Makefile.am,
434 etc.), please heck that the following things still work:
438 - resulting dist tarball builds
442 This can be achieved by running 'make distcheck'
444 The quagga.net site relies on make dist to work to generate snapshots. It
445 must work. Common problems are to forget to have some additional file
446 included in the dist, or to have a make rule refer to a source file without
447 using the srcdir variable.
454 - Edit configure.ac, bump the version and commit the change with
455 a "release: <version" subject.
457 The 'release.sh' script should then be used. It should be run with 2
458 arguments, the release tag for the release to be carried, and the tag of the
459 previous release, e.g.:
461 release.sh quagga-1.1.1 quagga-1.1.0
463 The 'release.sh' will carry out these steps for you:
465 - Tag the appropriate commit with a release tag (follow existing
468 git tag -u <release signing key id> <quagga-release-tag>
470 - Create a fresh tar archive of the quagga.net repository, and do a
471 test build. Use git archive to ensure it consists of files in the
472 repository, and to carry out the keyword expansions. Do NOT do this in
473 a subdirectory of the Quagga sources, autoconf will think it’s a
474 sub-package and fail to include neccessary files.
476 git archive ... <quagga-release-tag> | tar xC ..
478 autoreconf -i && ./configure && make && make dist-gzip
480 - Similarly test the dist tarball produced. This is the tarball to be
481 released. This is important.
483 - Sign the dist tarball to be released
485 gpg -u 54CD2E60 -a --detach-sign quagga-0.99.99.99.tar
487 The 'release.sh' script, if finishes successfully, will print out
488 instructions on the files it has created and the details on remaining steps
489 to be carried out to complete the release. Which roughly are:
491 - Upload the release tarball, its PGP signature, and the full changelog
492 to the public release area on Savannah
494 - Add the version number on https://bugzilla.quagga.net/, under
495 Administration, Products, “Quagga”, Edit versions, Add a version.
497 - Post a news entry on Savannah
499 - Send a mail to quagga-dev and quagga-users
501 If any errors occur, move tags as needed and start over again with the
502 release.sh script. Do not try to append stuff to tarballs, as this has
503 produced non-standards-conforming tarballs in the past.
505 [TODO: collation of a list of deprecated commands. Possibly can be
506 scripted to extract from vtysh/vtysh\_cmd.c]
511 Require versions of support tools are listed in INSTALL.quagga.txt.
512 Required versions should only be done with due deliberation, as it can
513 cause environments to no longer be able to compile quagga.
515 SHARED LIBRARY VERSIONING {#sec:dll-versioning}
516 =========================
518 [this section is at the moment just gdt’s opinion]
520 Quagga builds several shared libaries (lib/libzebra, ospfd/libospf,
521 ospfclient/libsopfapiclient). These may be used by external programs,
522 e.g. a new routing protocol that works with the zebra daemon, or
523 ospfapi clients. The libtool info pages (node Versioning) explain
524 when major and minor version numbers should be changed. These values
525 are set in Makefile.am near the definition of the library. If you
526 make a change that requires changing the shared library version,
527 please update Makefile.am.
529 libospf exports far more than it should, and is needed by ospfapi
530 clients. Only bump libospf for changes to functions for which it is
531 reasonable for a user of ospfapi to call, and please err on the side
534 There is no support intended for installing part of zebra. The core
535 library libzebra and the included daemons should always be built and
538 GIT COMMIT SUBMISSION {#sec:git-submission}
539 =====================
541 The preferred method for submitting changes is to provide git commits via a
542 publicly-accessible git repository, which the maintainers can easily pull.
544 The commits should be in a branch based off the Quagga.net master - a
545 “feature branch”. Ideally there should be no commits to this branch other
546 than those in master, and those intended to be submitted. However, merge
547 commits to this branch from the Quagga master are permitted, though strongly
548 discouraged - use another (potentially local and throw-away) branch to test
549 merge with the latest Quagga master.
551 Recommended practice is to keep different logical sets of changes on
552 separate branches - “topic” or “feature” branches. This allows you to still
553 merge them together to one branch (potentially local and/or “throw-away”)
554 for testing or use, while retaining smaller, independent branches that are
557 All content guidelines in [Section PATCH SUBMISSION](#sec:patch-submission)
560 PATCH SUBMISSION {#sec:patch-submission}
563 - For complex changes, contributors are strongly encouraged to first
564 start a design discussion on the quagga-dev list *before* starting
567 - Send a clean diff against the ’master’ branch of the quagga.git
568 repository, in unified diff format, preferably with the ’-p’
569 argument to show C function affected by any chunk, and with the -w
570 and -b arguments to minimise changes. E.g:
572 git diff -up mybranch..remotes/quagga.net/master
574 It is preferable to use git format-patch, and even more preferred to
575 publish a git repository (see
576 [Section GIT COMMIT SUBMISSION](#sec:git-submission)).
578 If not using git format-patch, Include the commit message in the
581 - After a commit, code should have comments explaining to the reviewer
582 why it is correct, without reference to history. The commit message
583 should explain why the change is correct.
585 - Include NEWS entries as appropriate.
587 - Include only one semantic change or group of changes per patch.
589 - Do not make gratuitous changes to whitespace. See the w and b
592 - Changes should be arranged so that the least controversial and most
593 trivial are first, and the most complex or more controversial are
594 last. This will maximise how many the Quagga maintainers can merge,
595 even if some other commits need further work.
597 - Providing a unit-test is strongly encouraged. Doing so will make it
598 much easier for maintainers to have confidence that they will be
599 able to support your change.
601 - New code should be arranged so that it easy to verify and test. E.g.
602 stateful logic should be separated out from functional logic as much
603 as possible: wherever possible, move complex logic out to smaller
604 helper functions which access no state other than their arguments.
606 - State on which platforms and with what daemons the patch has been
607 tested. Understand that if the set of testing locations is small,
608 and the patch might have unforeseen or hard to fix consequences that
609 there may be a call for testers on quagga-dev, and that the patch
610 may be blocked until test results appear.
612 If there are no users for a platform on quagga-dev who are able and
613 willing to verify -current occasionally, that platform may be
614 dropped from the “should be checked” list.
619 - Only apply patches that meet the submission guidelines.
621 - If the patch might break something, issue a call for testing on the
624 - Give an appropriate commit message (see above), and use the –author
625 argument to git-commit, if required, to ensure proper attribution
626 (you should still be listed as committer)
628 - Immediately after commiting, double-check (with git-log and/or
629 gitk). If there’s a small mistake you can easily fix it with ‘git
632 - When merging a branch, always use an explicit merge commit. Giving
633 –no-ff ensures a merge commit is created which documents “this human
634 decided to merge this branch at this time”.
636 STABLE PLATFORMS AND DAEMONS
637 ============================
639 The list of platforms that should be tested follow. This is a list
640 derived from what quagga is thought to run on and for which
641 maintainers can test or there are people on quagga-dev who are able
642 and willing to verify that -current does or does not work correctly.
644 - BSD (Free, Net or Open, any platform)
646 - GNU/Linux (any distribution, i386)
648 - Solaris (strict alignment, any platform)
650 - future: NetBSD/sparc64
652 The list of daemons that are thought to be stable and that should be
665 Daemons which are in a testing phase are
676 * The project homepage is at:
678 <https://www.quagga.net>
681 * Bugs can be reported via Bugzilla at:
683 <https://bugzilla.quagga.net>
685 * Buildbot runs CI tests, and is at:
687 <https://buildbot.quagga.net>
689 It tests commits and jobs submitted on local changes via
690 'buildbot try ...' for developers.
692 * Patchwork tracks any patches emailed to the quagga-dev list, and is at:
694 <https://patchwork.quagga.net/project/quagga/list/>
700 The buildbot client can be used to test changes before committing, with
703 - Ask for a buildbot account
705 - Install the buildbot client
707 - Configure it, e.g.:
710 $ cat ~/.buildbot/options
711 try_master = 'radia.quagga.net:8031'
712 try_username = 'paul'
713 try_password = 'password123'
715 try_branch = 'master'
717 $ buildbot try -c pb --get-builder-names
718 using 'pb' connect method
719 The following builders are available for the try scheduler:
724 - You can then submit your local changes to try build:
730 or use the -b argument to limit to a specific builder (recommended).
733 $ buildbot try -c pb -b build-distcheck
736 - To test a series of locally committed change use git diff:
739 git diff <base rev>.. | buildbot try -c pb --vc git \
740 -b build-centos-7 --branch=volatile/next --diff=- -p 1