blob: 0358fed2df7345c41cdb2baf7ac6b4dd75ba316b [file] [log] [blame]
gdtd9fd04c2003-12-19 19:20:25 +00001-*- mode: text; -*-
Paul Jakmad6bb5aa2008-08-26 22:15:03 +01002$QuaggaId: Format:%an, %ai, %h$ $
3
4Contents:
5
6* GUIDELINES FOR HACKING ON QUAGGA
7* COMPILE-TIME CONDITIONAL CODE
8* COMMIT MESSAGE
9* HACKING THE BUILD SYSTEM
10* RELEASE PROCEDURE
11* SHARED LIBRARY VERSIONING
12* RELEASE PROCEDURE
13* TOOL VERSIONS
14* SHARED LIBRARY VERSIONING
15* PATCH SUBMISSION
16* PATCH APPLICATION
17* STABLE PLATFORMS AND DAEMONS
18* IMPORT OR UPDATE VENDOR SPECIFIC ROUTING PROTOCOLS
gdtd9fd04c2003-12-19 19:20:25 +000019
Greg Troxela8e474a2010-11-03 07:22:00 -040020
gdtd9fd04c2003-12-19 19:20:25 +000021GUIDELINES FOR HACKING ON QUAGGA
22
gdtd9fd04c2003-12-19 19:20:25 +000023[this is a draft in progress]
24
hasso863076d2004-09-01 20:13:23 +000025GNU coding standards apply. Indentation follows the result of
26invoking GNU indent (as of 2.2.8a) with no arguments. Note that this
27uses tabs instead of spaces where possible for leading whitespace, and
28assumes that tabs are every 8 columns. Do not attempt to redefine the
29location of tab stops. Note also that some indentation does not
30follow GNU style. This is a historical accident, and we generally
31only clean up whitespace when code is unmaintainable due to whitespace
32issues, as fewer changes from zebra lead to easier merges.
33
34For GNU emacs, use indentation style "gnu".
35
36For Vim, use the following lines (note that tabs are at 8, and that
37softtabstop sets the indentation level):
38
39set tabstop=8
40set softtabstop=2
41set shiftwidth=2
42set noexpandtab
gdtd9fd04c2003-12-19 19:20:25 +000043
gdt2934f282004-01-05 20:09:00 +000044Be particularly careful not to break platforms/protocols that you
45cannot test.
46
47New code should have good comments, and changes to existing code
48should in many cases upgrade the comments when necessary for a
49reviewer to conclude that the change has no unintended consequences.
50
Paul Jakmad6bb5aa2008-08-26 22:15:03 +010051Each file in the Git repository should have a git format-placeholder (like
52an RCS Id keyword), somewhere very near the top, commented out appropriately
53for the file type. The placeholder used for Quagga (replacing <dollar> with
54$) is:
55
56 $QuaggaId: <dollar>Format:%an, %ai, %h<dollar> $
57
58See line 2 of HACKING for an example;
59
60This placeholder string will be expanded out by the 'git archive' commands,
61wihch is used to generate the tar archives for snapshots and releases.
gdt697877e2004-11-15 19:23:47 +000062
ajs5e764772004-12-03 19:03:33 +000063Please document fully the proper use of a new function in the header file
64in which it is declared. And please consult existing headers for
65documentation on how to use existing functions. In particular, please consult
66these header files:
67
68 lib/log.h logging levels and usage guidance
69 [more to be added]
70
paul1eb8ef22005-04-07 07:30:20 +000071If changing an exported interface, please try to deprecate the interface in
72an orderly manner. If at all possible, try to retain the old deprecated
73interface as is, or functionally equivalent. Make a note of when the
74interface was deprecated and guard the deprecated interface definitions in
75the header file, ie:
76
77/* Deprecated: 20050406 */
78#if !defined(QUAGGA_NO_DEPRECATED_INTERFACES)
79#warning "Using deprecated <libname> (interface(s)|function(s))"
80...
81#endif /* QUAGGA_NO_DEPRECATED_INTERFACES */
82
83To ensure that the core Quagga sources do not use the deprecated interfaces
84(you should update Quagga sources to use new interfaces, if applicable)
85while allowing external sources to continue to build. Deprecated interfaces
86should be excised in the next unstable cycle.
87
paul74a2dd72005-04-25 00:37:03 +000088Note: If you wish, you can test for GCC and use a function
89marked with the 'deprecated' attribute. However, you must provide the
90#warning for other compilers.
91
paul1eb8ef22005-04-07 07:30:20 +000092If changing or removing a command definition, *ensure* that you properly
93deprecate it - use the _DEPRECATED form of the appropriate DEFUN macro. This
94is *critical*. Even if the command can no longer function, you *must* still
95implement it as a do-nothing stub. Failure to follow this causes grief for
96systems administrators. Deprecated commands should be excised in the next
97unstable cycle. A list of deprecated commands should be collated for each
98release.
99
100See also below regarding SHARED LIBRARY VERSIONING.
ajs5e764772004-12-03 19:03:33 +0000101
Greg Troxela8e474a2010-11-03 07:22:00 -0400102
Paul Jakma750e8142008-07-22 21:11:48 +0000103COMPILE-TIME CONDITIONAL CODE
104
105Please think very carefully before making code conditional at compile time,
106as it increases maintenance burdens and user confusion. In particular,
107please avoid gratuitious --enable-.... switches to the configure script -
108typically code should be good enough to be in Quagga, or it shouldn't be
109there at all.
110
111When code must be compile-time conditional, try have the compiler make it
112conditional rather than the C pre-processor. I.e. this:
113
114 if (SOME_SYMBOL)
115 frobnicate();
116
117rather than:
118
119 #ifdef SOME_SYMBOL
120 frobnicate ();
121 #endif /* SOME_SYMBOL */
122
123Note that the former approach requires ensuring that SOME_SYMBOL will be
124defined (watch your AC_DEFINEs).
paul74a2dd72005-04-25 00:37:03 +0000125
Greg Troxela8e474a2010-11-03 07:22:00 -0400126
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100127COMMIT MESSAGES
gdt2934f282004-01-05 20:09:00 +0000128
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100129The commit message should provide:
gdt2934f282004-01-05 20:09:00 +0000130
Greg Troxeld7a97792010-11-03 07:20:38 -0400131* A suitable one-line summary followed by a blank line as the very
132 first line of the message, in the form:
gdt2934f282004-01-05 20:09:00 +0000133
Paul Jakma3de42772009-07-28 16:04:35 +0100134 topic: high-level, one line summary
paulca6383b2005-11-10 10:21:19 +0000135
Paul Jakma3de42772009-07-28 16:04:35 +0100136 Where topic would tend to be name of a subdirectory, and/or daemon, unless
137 there's a more suitable topic (e.g. 'build'). This topic is used to
138 organise change summaries in release announcements.
paulca6383b2005-11-10 10:21:19 +0000139
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100140* An optional introduction, discussing the general intent of the change.
Paul Jakma3de42772009-07-28 16:04:35 +0100141* A short description of each change made, preferably:
paulca6383b2005-11-10 10:21:19 +0000142 * file by file
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100143 * function by function (use of "ditto", or globs is allowed)
paulca6383b2005-11-10 10:21:19 +0000144
Paul Jakma3de42772009-07-28 16:04:35 +0100145to provide a short description of the general intent of the patch, in terms
146of the problem it solves and how it achieves it, to help reviewers
Greg Troxela8e474a2010-11-03 07:22:00 -0400147understand.
Paul Jakma3de42772009-07-28 16:04:35 +0100148
Greg Troxeld7a97792010-11-03 07:20:38 -0400149The one-line summary must be limited to 54 characters, and all other
150lines to 72 characters.
paulca6383b2005-11-10 10:21:19 +0000151
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100152The reason for such itemised commit messages is to encourage the author to
153self-review every line of the patch, as well as provide reviewers an index
Greg Troxela8e474a2010-11-03 07:22:00 -0400154of which changes are intended, along with a short description for each.
Paul Jakma3de42772009-07-28 16:04:35 +0100155Some discretion is obviously required. A C-to-english description is not
156desireable. For short patches, a per-function/file break-down may be
157redundant. For longer patches, such a break-down may be essential.
158
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100159An example (where the general discussion is obviously somewhat redundant,
160given the one-line summary):
161
Paul Jakma3de42772009-07-28 16:04:35 +0100162zebra: Enhance frob FSM to detect loss of frob
paulca6383b2005-11-10 10:21:19 +0000163
Paul Jakma3de42772009-07-28 16:04:35 +0100164* (general) Add a new DOWN state to the frob state machine
Greg Troxela8e474a2010-11-03 07:22:00 -0400165 to allow the barinator to detect loss of frob.
Paul Jakma3de42772009-07-28 16:04:35 +0100166* frob.h: (struct frob) Add DOWN state flag.
167* frob.c: (frob_change) set/clear DOWN appropriately on state change.
168* bar.c: (barinate) Check frob for DOWN state.
paul1f8f61a2004-11-05 23:38:20 +0000169
Greg Troxeld7a97792010-11-03 07:20:38 -0400170Note that the commit message format follows git norms, so that "git
171log --oneline" will have useful output.
paul74a2dd72005-04-25 00:37:03 +0000172
173HACKING THE BUILD SYSTEM
174
175If you change or add to the build system (configure.ac, any Makefile.am,
176etc.), try to check that the following things still work:
177
178 - make dist
179 - resulting dist tarball builds
Greg Troxela8e474a2010-11-03 07:22:00 -0400180 - out-of-tree builds
paul74a2dd72005-04-25 00:37:03 +0000181
182The quagga.net site relies on make dist to work to generate snapshots. It
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100183must work. Common problems are to forget to have some additional file
paul74a2dd72005-04-25 00:37:03 +0000184included in the dist, or to have a make rule refer to a source file without
185using the srcdir variable.
186
Greg Troxela8e474a2010-11-03 07:22:00 -0400187
gdt0d7e9132005-02-23 16:20:07 +0000188RELEASE PROCEDURE
189
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100190* Tag the apppropriate commit with a release tag (follow existing
191 conventions).
gdt0d7e9132005-02-23 16:20:07 +0000192 [This enables recreating the release, and is just good CM practice.]
193
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100194* Create a fresh tar archive of the quagga.net repository, and do a test
195 build:
gdt0d7e9132005-02-23 16:20:07 +0000196
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100197 git-clone git:///code.quagga.net/quagga.git quagga
198 git-archive --remote=git://code.quagga.net/quagga.git \
199 --prefix=quagga-release/ master | tar -xf -
200 cd quagga-release
gdt0d7e9132005-02-23 16:20:07 +0000201
Paul Jakma3de42772009-07-28 16:04:35 +0100202 autoreconf -i
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100203 ./configure
204 make
205 make dist
gdt0d7e9132005-02-23 16:20:07 +0000206
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100207The tarball which 'make dist' creates is the tarball to be released! The
208git-archive step ensures you're working with code corresponding to that in
209the official repository, and also carries out keyword expansion. If any
Greg Troxela8e474a2010-11-03 07:22:00 -0400210errors occur, move tags as needed and start over from the fresh checkouts.
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100211Do not append to tarballs, as this has produced non-standards-conforming
212tarballs in the past.
gdt0d7e9132005-02-23 16:20:07 +0000213
Paul Jakma3de42772009-07-28 16:04:35 +0100214See also: http://wiki.quagga.net/index.php/Main/Processes
215
paul1eb8ef22005-04-07 07:30:20 +0000216[TODO: collation of a list of deprecated commands. Possibly can be scripted
217to extract from vtysh/vtysh_cmd.c]
218
paul74a2dd72005-04-25 00:37:03 +0000219
gdtfbb67092004-11-15 17:29:11 +0000220TOOL VERSIONS
221
222Require versions of support tools are listed in INSTALL.quagga.txt.
223Required versions should only be done with due deliberation, as it can
224cause environments to no longer be able to compile quagga.
225
paul74a2dd72005-04-25 00:37:03 +0000226
gdtb7a97f82004-07-23 16:23:56 +0000227SHARED LIBRARY VERSIONING
228
229[this section is at the moment just gdt's opinion]
230
231Quagga builds several shared libaries (lib/libzebra, ospfd/libospf,
232ospfclient/libsopfapiclient). These may be used by external programs,
233e.g. a new routing protocol that works with the zebra daemon, or
234ospfapi clients. The libtool info pages (node Versioning) explain
235when major and minor version numbers should be changed. These values
236are set in Makefile.am near the definition of the library. If you
237make a change that requires changing the shared library version,
238please update Makefile.am.
239
240libospf exports far more than it should, and is needed by ospfapi
241clients. Only bump libospf for changes to functions for which it is
242reasonable for a user of ospfapi to call, and please err on the side
243of not bumping.
244
245There is no support intended for installing part of zebra. The core
246library libzebra and the included daemons should always be built and
247installed together.
248
paul74a2dd72005-04-25 00:37:03 +0000249
Greg Troxel5195e172010-11-03 07:37:23 -0400250GIT COMMIT SUBSMISSION
251
252The preferred method for changes is to provide git commits via a
253publically-accessible git repository.
254
255All content guidelines in PATCH SUBMISSION apply.
256
257
gdtd9fd04c2003-12-19 19:20:25 +0000258PATCH SUBMISSION
259
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100260* Send a clean diff against the 'master' branch of the quagga.git
Greg Troxela8e474a2010-11-03 07:22:00 -0400261 repository, in unified diff format, preferably with the '-p' argument to
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100262 show C function affected by any chunk, and with the -w and -b arguments to
Greg Troxela8e474a2010-11-03 07:22:00 -0400263 minimise changes. E.g:
gdtd9fd04c2003-12-19 19:20:25 +0000264
Paul Jakma3de42772009-07-28 16:04:35 +0100265 git diff -up mybranch..remotes/quagga.net/master
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100266
Greg Troxel5195e172010-11-03 07:37:23 -0400267 It is preferable to use git format-patch, and even more preferred to
268 publish a git repostory.
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100269
Greg Troxel5195e172010-11-03 07:37:23 -0400270 If not using git format-patch, Include the commit message in the email.
271
272* After a commit, code should have comments explaining to the reviewer
273 why it is correct, without reference to history. The commit message
274 should explain why the change is correct.
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100275
Greg Troxela8e474a2010-11-03 07:22:00 -0400276* Include NEWS entries as appropriate.
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100277
gdt18323bb2004-11-05 13:17:20 +0000278* Include only one semantic change or group of changes per patch.
gdtd9fd04c2003-12-19 19:20:25 +0000279
paul85cf0a02004-01-09 16:34:54 +0000280* Do not make gratuitous changes to whitespace. See the w and b arguments
281 to diff.
gdtd9fd04c2003-12-19 19:20:25 +0000282
283* State on which platforms and with what daemons the patch has been
284 tested. Understand that if the set of testing locations is small,
285 and the patch might have unforeseen or hard to fix consequences that
286 there may be a call for testers on quagga-dev, and that the patch
287 may be blocked until test results appear.
288
289 If there are no users for a platform on quagga-dev who are able and
290 willing to verify -current occasionally, that platform may be
291 dropped from the "should be checked" list.
292
paul74a2dd72005-04-25 00:37:03 +0000293
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100294PATCH APPLICATION
gdtd9fd04c2003-12-19 19:20:25 +0000295
296* Only apply patches that meet the submission guidelines.
297
gdtd9fd04c2003-12-19 19:20:25 +0000298* If the patch might break something, issue a call for testing on the
299 mailinglist.
300
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100301* Give an appropriate commit message (see above), and use the --author
302 argument to git-commit, if required, to ensure proper attribution (you
303 should still be listed as committer)
304
305* Immediately after commiting, double-check (with git-log and/or gitk). If
306 there's a small mistake you can easily fix it with 'git commit --amend ..'
paul4134ceb2004-05-13 13:38:06 +0000307
gdtd9fd04c2003-12-19 19:20:25 +0000308* By committing a patch, you are responsible for fixing problems
309 resulting from it (or backing it out).
310
paul74a2dd72005-04-25 00:37:03 +0000311
gdtd9fd04c2003-12-19 19:20:25 +0000312STABLE PLATFORMS AND DAEMONS
313
314The list of platforms that should be tested follow. This is a list
315derived from what quagga is thought to run on and for which
316maintainers can test or there are people on quagga-dev who are able
317and willing to verify that -current does or does not work correctly.
318
319 BSD (Free, Net or Open, any platform) # without capabilities
320 GNU/Linux (any distribution, i386)
paul1f8f61a2004-11-05 23:38:20 +0000321 Solaris (strict alignment, any platform)
gdt18323bb2004-11-05 13:17:20 +0000322 [future: NetBSD/sparc64]
gdtd9fd04c2003-12-19 19:20:25 +0000323
324The list of daemons that are thought to be stable and that should be
325tested are:
326
327 zebra
328 bgpd
329 ripd
330 ospfd
331 ripngd
gdt1f431d22003-12-22 15:45:01 +0000332
gdt18323bb2004-11-05 13:17:20 +0000333Daemons which are in a testing phase are
334
335 ospf6d
336 isisd
ajs8035e9f2004-12-22 03:16:59 +0000337 watchquagga
gdt18323bb2004-11-05 13:17:20 +0000338
paul74a2dd72005-04-25 00:37:03 +0000339
jardin9e867fe2003-12-23 08:56:18 +0000340IMPORT OR UPDATE VENDOR SPECIFIC ROUTING PROTOCOLS
341
342The source code of Quagga is based on two vendors:
343
344 zebra_org (http://www.zebra.org/)
345 isisd_sf (http://isisd.sf.net/)
346
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100347To import code from further sources, e.g. for archival purposes without
348necessarily having to review and/or fix some changeset, create a branch from
349'master':
gdt18323bb2004-11-05 13:17:20 +0000350
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100351 git checkout -b archive/foo master
352 <apply changes>
353 git commit -a "Joe Bar <joe@example.com>"
354 git push quagga archive/foo
jardin9e867fe2003-12-23 08:56:18 +0000355
Paul Jakmad6bb5aa2008-08-26 22:15:03 +0100356presuming 'quagga' corresponds to a file in your .git/remotes with
357configuration for the appropriate Quagga.net repository.