[RFC] Documentation: use RFC 5735 subnet for examples

2018-11-30 Thread Matteo Croce
RFC 5735 defines this subnets for documentation and example code:

  192.0.2.0/24 as TEST-NET-1
  198.51.100.0/24 as TEST-NET-2
  203.0.113.0/24 as TEST-NET-3

Replace where possible the IP addresses in the documentation with
addresses belonging to the test subnets.

Signed-off-by: Matteo Croce 
---
 Documentation/ABI/testing/sysfs-bus-rbd| 2 +-
 Documentation/admin-guide/LSM/Smack.rst| 4 ++--
 Documentation/dev-tools/kgdb.rst   | 2 +-
 Documentation/filesystems/nfs/nfs-rdma.txt | 4 ++--
 Documentation/isdn/README.HiSax| 4 ++--
 Documentation/networking/batman-adv.rst| 6 +++---
 Documentation/networking/cops.txt  | 2 +-
 Documentation/networking/l2tp.txt  | 6 +++---
 Documentation/networking/multiqueue.txt| 4 ++--
 Documentation/networking/net_failover.rst  | 2 +-
 Documentation/networking/pktgen.txt| 6 +++---
 Documentation/networking/switchdev.txt | 4 ++--
 12 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-bus-rbd 
b/Documentation/ABI/testing/sysfs-bus-rbd
index cc30bee8b5f4..82e6a942c274 100644
--- a/Documentation/ABI/testing/sysfs-bus-rbd
+++ b/Documentation/ABI/testing/sysfs-bus-rbd
@@ -7,7 +7,7 @@ Description:
 
Usage: 
[]
 
-$ echo "192.168.0.1 name=admin rbd foo" > /sys/bus/rbd/add
+$ echo "192.0.2.1 name=admin rbd foo" > /sys/bus/rbd/add
 
The snapshot name can be "-" or omitted to map the image
read/write. A  will be assigned for any registered block
diff --git a/Documentation/admin-guide/LSM/Smack.rst 
b/Documentation/admin-guide/LSM/Smack.rst
index 6a5826a13aea..0178467cfb9e 100644
--- a/Documentation/admin-guide/LSM/Smack.rst
+++ b/Documentation/admin-guide/LSM/Smack.rst
@@ -723,11 +723,11 @@ If you don't know what CIPSO is and don't plan to use it, 
you can just do::
echo 127.0.0.1 -CIPSO > /sys/fs/smackfs/netlabel
echo 0.0.0.0/0 @  > /sys/fs/smackfs/netlabel
 
-If you use CIPSO on your 192.168.0.0/16 local network and need also unlabeled
+If you use CIPSO on your 192.0.2.0/16 local network and need also unlabeled
 Internet access, you can have::
 
echo 127.0.0.1  -CIPSO > /sys/fs/smackfs/netlabel
-   echo 192.168.0.0/16 -CIPSO > /sys/fs/smackfs/netlabel
+   echo 192.0.2.0/16 -CIPSO > /sys/fs/smackfs/netlabel
echo 0.0.0.0/0  @  > /sys/fs/smackfs/netlabel
 
 Writing Applications for Smack
diff --git a/Documentation/dev-tools/kgdb.rst b/Documentation/dev-tools/kgdb.rst
index d38be58f872a..50a7641d13c1 100644
--- a/Documentation/dev-tools/kgdb.rst
+++ b/Documentation/dev-tools/kgdb.rst
@@ -541,7 +541,7 @@ Connecting with gdb to a serial port
Example (kgdb to a terminal server on TCP port 2012)::
 
% gdb ./vmlinux
-   (gdb) target remote 192.168.2.2:2012
+   (gdb) target remote 192.0.2.2:2012
 
 
Once connected, you can debug a kernel the way you would debug an
diff --git a/Documentation/filesystems/nfs/nfs-rdma.txt 
b/Documentation/filesystems/nfs/nfs-rdma.txt
index 22dc0dd6889c..1adb29475d34 100644
--- a/Documentation/filesystems/nfs/nfs-rdma.txt
+++ b/Documentation/filesystems/nfs/nfs-rdma.txt
@@ -214,8 +214,8 @@ NFS/RDMA Setup
 
 Exports entries with the following formats have been tested:
 
-/vol0   192.168.0.47(fsid=0,rw,async,insecure,no_root_squash)
-/vol0   192.168.0.0/255.255.255.0(fsid=0,rw,async,insecure,no_root_squash)
+/vol0   192.0.2.47(fsid=0,rw,async,insecure,no_root_squash)
+/vol0   192.0.2.0/255.255.255.0(fsid=0,rw,async,insecure,no_root_squash)
 
 The IP address(es) is(are) the client's IPoIB address for an InfiniBand
 HCA or the client's iWARP address(es) for an RNIC.
diff --git a/Documentation/isdn/README.HiSax b/Documentation/isdn/README.HiSax
index b1a573cf4472..0c3a7e0ef80b 100644
--- a/Documentation/isdn/README.HiSax
+++ b/Documentation/isdn/README.HiSax
@@ -584,8 +584,8 @@ I4L_REMOTE_IS_CISCO=no
 I4L_MODULE_PARAMS="type=16 io=0x268 irq=7 "
 I4L_DEBUG=no
 I4L_LEASED_128K=yes
-LOCAL_IP=192.168.1.1
-REMOTE_IP=192.168.2.1
+LOCAL_IP=192.0.2.1
+REMOTE_IP=198.51.100.1
 
 case "$1" in
 start)
diff --git a/Documentation/networking/batman-adv.rst 
b/Documentation/networking/batman-adv.rst
index 245fb6c0ab6f..7c9bfeed628f 100644
--- a/Documentation/networking/batman-adv.rst
+++ b/Documentation/networking/batman-adv.rst
@@ -118,11 +118,11 @@ IP address which can be either statically configured or 
dynamically (by using
 DHCP or similar services)::
 
   NodeA: ip link set up dev bat0
-  NodeA: ip addr add 192.168.0.1/24 dev bat0
+  NodeA: ip addr add 192.0.2.1/24 dev bat0
 
   NodeB: ip link set up dev bat0
-  NodeB: ip addr add 192.168.0.2/24 dev bat0
-  NodeB: ping 192.168.0.1
+  NodeB: ip addr add 192.0.2.2/24 dev bat0
+  NodeB: ping 192.0.2.1
 
 Note: In order to avoid problems remove all I

Re: [PATCH net] ipv6: fix net.ipv6.conf.all interface DAD handlers

2017-09-29 Thread Matteo Croce
On Thu, Sep 28, 2017 at 1:22 PM, Erik Kline <e...@google.com> wrote:
> Upon further reflection, doesn't the whole premise of this change
> means that it's no longer possible to selectively disable these
> features if they are set on "all"?  Or are we saying that this mode is
> only support with "default" enable + "ifname" disable?

Hi Erik, thanks for the review.
Yes the behaviour seems wrong when writing all.accept_dad respect what
the documentation says.

BTW the previous behaviour was not defined, I put them in OR because
that's what other handlers do, eg. send_redirects.
If you think that it's better to put them in AND we can change the
documentation accordingly.
What do you think?

-- 
Matteo Croce
per aspera ad upstream
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net] ipv6: fix net.ipv6.conf.all interface DAD handlers

2017-09-12 Thread Matteo Croce
Currently, writing into
net.ipv6.conf.all.{accept_dad,use_optimistic,optimistic_dad} has no effect.
Fix handling of these flags by:

- using the maximum of global and per-interface values for the
  accept_dad flag. That is, if at least one of the two values is
  non-zero, enable DAD on the interface. If at least one value is
  set to 2, enable DAD and disable IPv6 operation on the interface if
  MAC-based link-local address was found

- using the logical OR of global and per-interface values for the
  optimistic_dad flag. If at least one of them is set to one, optimistic
  duplicate address detection (RFC 4429) is enabled on the interface

- using the logical OR of global and per-interface values for the
  use_optimistic flag. If at least one of them is set to one,
  optimistic addresses won't be marked as deprecated during source address
  selection on the interface.

While at it, as we're modifying the prototype for ipv6_use_optimistic_addr(),
drop inline, and let the compiler decide.

Fixes: 7fd2561e4ebd ("net: ipv6: Add a sysctl to make optimistic addresses 
useful candidates")
Signed-off-by: Matteo Croce <mcr...@redhat.com>
---
 Documentation/networking/ip-sysctl.txt | 18 ++
 net/ipv6/addrconf.c| 27 ---
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt 
b/Documentation/networking/ip-sysctl.txt
index b3345d0fe0a6..77f4de59dc9c 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1680,6 +1680,9 @@ accept_dad - INTEGER
2: Enable DAD, and disable IPv6 operation if MAC-based duplicate
   link-local address has been found.
 
+   DAD operation and mode on a given interface will be selected according
+   to the maximum value of conf/{all,interface}/accept_dad.
+
 force_tllao - BOOLEAN
Enable sending the target link-layer address option even when
responding to a unicast neighbor solicitation.
@@ -1727,16 +1730,23 @@ suppress_frag_ndisc - INTEGER
 
 optimistic_dad - BOOLEAN
Whether to perform Optimistic Duplicate Address Detection (RFC 4429).
-   0: disabled (default)
-   1: enabled
+   0: disabled (default)
+   1: enabled
+
+   Optimistic Duplicate Address Detection for the interface will be enabled
+   if at least one of conf/{all,interface}/optimistic_dad is set to 1,
+   it will be disabled otherwise.
 
 use_optimistic - BOOLEAN
If enabled, do not classify optimistic addresses as deprecated during
source address selection.  Preferred addresses will still be chosen
before optimistic addresses, subject to other ranking in the source
address selection algorithm.
-   0: disabled (default)
-   1: enabled
+   0: disabled (default)
+   1: enabled
+
+   This will be enabled if at least one of
+   conf/{all,interface}/use_optimistic is set to 1, disabled otherwise.
 
 stable_secret - IPv6 address
This IPv6 address will be used as a secret to generate IPv6
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c2e2a78787ec..774d8794248a 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1399,10 +1399,18 @@ static inline int ipv6_saddr_preferred(int type)
return 0;
 }
 
-static inline bool ipv6_use_optimistic_addr(struct inet6_dev *idev)
+static bool ipv6_use_optimistic_addr(struct net *net,
+struct inet6_dev *idev)
 {
 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
-   return idev && idev->cnf.optimistic_dad && idev->cnf.use_optimistic;
+   if (!idev)
+   return false;
+   if (!net->ipv6.devconf_all->optimistic_dad && !idev->cnf.optimistic_dad)
+   return false;
+   if (!net->ipv6.devconf_all->use_optimistic && !idev->cnf.use_optimistic)
+   return false;
+
+   return true;
 #else
return false;
 #endif
@@ -1472,7 +1480,7 @@ static int ipv6_get_saddr_eval(struct net *net,
/* Rule 3: Avoid deprecated and optimistic addresses */
u8 avoid = IFA_F_DEPRECATED;
 
-   if (!ipv6_use_optimistic_addr(score->ifa->idev))
+   if (!ipv6_use_optimistic_addr(net, score->ifa->idev))
avoid |= IFA_F_OPTIMISTIC;
ret = ipv6_saddr_preferred(score->addr_type) ||
  !(score->ifa->flags & avoid);
@@ -2460,7 +2468,8 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct 
net_device *dev,
int max_addresses = in6_dev->cnf.max_addresses;
 
 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
-   if (in6_dev->cnf.optimistic_dad &&
+   if ((net->ipv6.devconf_all->optimistic_dad ||
+in6_dev->cnf.optimistic_dad) &&

[PATCH v2] Documentation: fix wrong example command

2017-06-30 Thread Matteo Croce
In the IPVLAN documentation there is an example command line where the
master and slave interface names are inverted.
Fix the command line and also add the optional `name' keyword to better
describe what the command is doing.

v2: added commit message

Signed-off-by: Matteo Croce <mcr...@redhat.com>
---
 Documentation/networking/ipvlan.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/ipvlan.txt 
b/Documentation/networking/ipvlan.txt
index 24196ce..1fe42a8 100644
--- a/Documentation/networking/ipvlan.txt
+++ b/Documentation/networking/ipvlan.txt
@@ -22,9 +22,9 @@ The driver can be built into the kernel (CONFIG_IPVLAN=y) or 
as a module
There are no module parameters for this driver and it can be configured
 using IProute2/ip utility.
 
-   ip link add link   type ipvlan mode { l2 | l3 | 
l3s }
+   ip link add link  name  type ipvlan mode { l2 | 
l3 | l3s }
 
-   e.g. ip link add link ipvl0 eth0 type ipvlan mode l2
+   e.g. ip link add link eth0 name ipvl0 type ipvlan mode l2
 
 
 4. Operating modes:
-- 
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Documentation: fix wrong example command

2017-06-29 Thread Matteo Croce
Signed-off-by: Matteo Croce <mcr...@redhat.com>
---
 Documentation/networking/ipvlan.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/ipvlan.txt 
b/Documentation/networking/ipvlan.txt
index 24196ce..1fe42a8 100644
--- a/Documentation/networking/ipvlan.txt
+++ b/Documentation/networking/ipvlan.txt
@@ -22,9 +22,9 @@ The driver can be built into the kernel (CONFIG_IPVLAN=y) or 
as a module
There are no module parameters for this driver and it can be configured
 using IProute2/ip utility.
 
-   ip link add link   type ipvlan mode { l2 | l3 | 
l3s }
+   ip link add link  name  type ipvlan mode { l2 | 
l3 | l3s }
 
-   e.g. ip link add link ipvl0 eth0 type ipvlan mode l2
+   e.g. ip link add link eth0 name ipvl0 type ipvlan mode l2
 
 
 4. Operating modes:
-- 
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html