summaryrefslogtreecommitdiff
path: root/doc/developer
diff options
context:
space:
mode:
Diffstat (limited to 'doc/developer')
-rw-r--r--doc/developer/building-docker.rst101
-rw-r--r--doc/developer/building.rst1
-rw-r--r--doc/developer/lua.rst2
-rw-r--r--doc/developer/topotests-jsontopo.rst6
-rw-r--r--doc/developer/topotests.rst6
-rw-r--r--doc/developer/workflow.rst30
6 files changed, 143 insertions, 3 deletions
diff --git a/doc/developer/building-docker.rst b/doc/developer/building-docker.rst
new file mode 100644
index 0000000000..852a295fd0
--- /dev/null
+++ b/doc/developer/building-docker.rst
@@ -0,0 +1,101 @@
+Docker
+======
+
+This page covers how to build FRR Docker images.
+
+Images
+""""""
+FRR has Docker build infrastructure to produce Docker images containing
+source-built FRR on the following base platforms:
+
+* Alpine
+* Centos 7
+* Centos 8
+
+The following platform images may also be built, but these simply install a
+binary package from an existing repository and do not perform source builds:
+
+* Debian 10
+
+Some of these are available on `DockerHub
+<https://hub.docker.com/repository/docker/frrouting/frr/tags?page=1>`_.
+
+There is no guarantee on what is and is not available from DockerHub at time of
+writing.
+
+Scripts
+"""""""
+
+Some platforms contain an included build script that may be run from the host.
+This will set appropriate packaging environment variables and clean up
+intermediate build images.
+
+These scripts serve another purpose. They allow building platform packages
+without needing the platform. For example, the Centos 8 docker image can also
+be leveraged to build Centos 8 RPMs that can then be used separately from
+Docker.
+
+If you are only interested in the Docker images and don't want the cleanup
+functionality of the scripts you can ignore them and perform a normal Docker
+build. If you want to build multi-arch docker images this is required as the
+scripts do not support using Buildkit for multi-arch builds.
+
+Building Alpine Image
+---------------------
+
+Script::
+
+ ./docker/alpine/build.sh
+
+No script::
+
+ docker build -f docker/alpine/Dockerfile .
+
+No script, multi-arch (ex. amd64, arm64, armv7)::
+
+ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -f docker/alpine/Dockerfile -t frr:latest .
+
+
+Building Debian Image
+---------------------
+
+::
+
+ cd docker/debian
+ docker build .
+
+Multi-arch (ex. amd64, arm64, armv7)::
+
+ cd docker/debian
+ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t frr-debian:latest .
+
+Building Centos 7 Image
+-----------------------
+
+Script::
+
+ ./docker/centos-7/build.sh
+
+No script::
+
+ docker build -f docker/centos-7/Dockerfile .
+
+No script, multi-arch (ex. amd64, arm64)::
+
+ docker buildx build --platform linux/amd64,linux/arm64 -f docker/centos-7/Dockerfile -t frr-centos7:latest .
+
+
+Building Centos 8 Image
+-----------------------
+
+Script::
+
+ ./docker/centos-8/build.sh
+
+No script::
+
+ docker build -f docker/centos-8/Dockerfile .
+
+No script, multi-arch (ex. amd64, arm64)::
+
+ docker buildx build --platform linux/amd64,linux/arm64 -f docker/centos-8/Dockerfile -t frr-centos8:latest .
diff --git a/doc/developer/building.rst b/doc/developer/building.rst
index 9d1b5b60ad..fbe1f24d35 100644
--- a/doc/developer/building.rst
+++ b/doc/developer/building.rst
@@ -28,3 +28,4 @@ Building FRR
building-frr-for-ubuntu1804
building-frr-for-ubuntu2004
building-frr-for-archlinux
+ building-docker
diff --git a/doc/developer/lua.rst b/doc/developer/lua.rst
index 23eb35fc58..3315c31ad7 100644
--- a/doc/developer/lua.rst
+++ b/doc/developer/lua.rst
@@ -53,7 +53,7 @@ follow these steps:
zlog_debug(string.format("afi: %d: %s %d ifdx: %d aspath: %s localpref: %d",
prefix.family, prefix.route, nexthop.metric,
nexthop.ifindex, nexthop.aspath, nexthop.localpref))
-
+
nexthop.metric = 33
nexthop.localpref = 13
return 3
diff --git a/doc/developer/topotests-jsontopo.rst b/doc/developer/topotests-jsontopo.rst
index bbae80f11d..1c77cd7be1 100644
--- a/doc/developer/topotests-jsontopo.rst
+++ b/doc/developer/topotests-jsontopo.rst
@@ -55,8 +55,14 @@ This is the recommended test writing routine:
* Create topology from json
* Create configuration from json
* Write the tests
+* Format the new code using `black <https://github.com/psf/black>`_
* Create a Pull Request
+.. Note::
+
+ BGP tests MUST use generous convergence timeouts - you must ensure
+ that any test involving BGP uses a convergence timeout of at least
+ 130 seconds.
File Hierarchy
^^^^^^^^^^^^^^
diff --git a/doc/developer/topotests.rst b/doc/developer/topotests.rst
index 7e627781e0..b32f2bbf49 100644
--- a/doc/developer/topotests.rst
+++ b/doc/developer/topotests.rst
@@ -363,6 +363,12 @@ This is the recommended test writing routine:
- Format the new code using `black <https://github.com/psf/black>`_
- Create a Pull Request
+.. Note::
+
+ BGP tests MUST use generous convergence timeouts - you must ensure
+ that any test involving BGP uses a convergence timeout of at least
+ 130 seconds.
+
Topotest File Hierarchy
"""""""""""""""""""""""
diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst
index eaf6c67bc9..f345464a35 100644
--- a/doc/developer/workflow.rst
+++ b/doc/developer/workflow.rst
@@ -276,7 +276,7 @@ Pre-submission Checklist
- In the case of a major new feature or other significant change, document
plans for continued maintenance of the feature. In addition it is a
requirement that automated testing must be written that exercises
- the new feature within our existing CI infrastructure. Also the
+ the new feature within our existing CI infrastructure. Also the
addition of automated testing to cover any pull request is encouraged.
.. _signing-off:
@@ -573,6 +573,30 @@ following requirements have achieved consensus:
constant in these cases. (Rationale: changing a buffer to another size
constant may leave the write operations on a now-incorrect size limit.)
+- For stack allocated structs and arrays that should be zero initialized,
+ prefer initializer expressions over ``memset()`` wherever possible. This
+ helps prevent ``memset()`` calls being missed in branches, and eliminates the
+ error class of an incorrect ``size`` argument to ``memset()``.
+
+ For example, instead of:
+
+ .. code-block:: c
+
+ struct foo mystruct;
+ ...
+ memset(&mystruct, 0x00, sizeof(struct foo));
+
+ Prefer:
+
+ .. code-block:: c
+
+ struct foo mystruct = {};
+
+- Do not zero initialize stack allocated values that must be initialized with a
+ nonzero value in order to be used. This way the compiler and memory checking
+ tools can catch uninitialized value use that would otherwise be suppressed by
+ the (incorrect) zero initialization.
+
Other than these specific rules, coding practices from the Linux kernel as
well as CERT or MISRA C guidelines may provide useful input on safe C code.
However, these rules are not applied as-is; some of them expressly collide
@@ -1034,7 +1058,9 @@ the development mailing list / public Slack instance.
JSON Output
^^^^^^^^^^^
-All JSON keys are to be camelCased, with no spaces.
+* All JSON keys are to be camelCased, with no spaces
+* Commands which output JSON should produce ``{}`` if they have nothing to
+ display
Use of const
^^^^^^^^^^^^