Skip to contentSkip to conversation

quagga: Avoid duplicate connected address adding to the list

PATCH Applied Xufeng Zhang 2 participants 6 messages Nov 19, 2013 – Nov 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quagga: Avoid duplicate connected address adding to the list

commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal") introduces an regression: ifp->connected list is cleaned up when ripd is restarting, however, for interface addresses which are not specified in ripd configuration file, they are never to be added into ifp->connected again, this will lead to some abnormal behavior for route advertising.

Instead of cleaning up the ifp->connected list to avoid duplicated connected address being added into this list, we can check this condition during interface address adding process and return early when an identical address has already been added.

---
 .../quagga-Avoid-duplicate-connected-address.patch |   53 ++++++++++++++++++++
 .../recipes-protocols/quagga/quagga.inc            |    3 +-
 2 files changed, 55 insertions(+), 1 deletions(-)
 create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch
meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch new file +53 -0
new file mode 100644
index 0000000..585dc29
@@ -0,0 +1,53 @@
+quagga: Avoid duplicate connected address adding to the list
+
+commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
+introduces an regression: ifp->connected list is cleaned up when ripd is
+restarting, however, for interface addresses which are not specified in
+ripd configuration file, they are never to be added into ifp->connected
+again, this will lead to some abnormal behavior for route advertising.
+
+Instead of cleaning up the ifp->connected list to avoid duplicated
+connected address being added into this list, we can check this
+condition during interface address adding process and return early
+when an identical address has already been added.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hu Yadi <[email protected]>
+Signed-off-by: Xufeng Zhang <[email protected]>
+---
+--- a/lib/if.c
++++ b/lib/if.c
+@@ -738,6 +738,16 @@
+                          struct prefix *destination)
+ {
+   struct connected *ifc;
++  struct listnode *cnode;
++  struct connected *c;
++  int ret = 0;
++
++  for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
++    {
++      ret = connected_same_prefix (p, (c->address));
++      if(ret == 1)
++        return NULL;
++    }
+ 
+   /* Allocate new connected address. */
+   ifc = connected_new ();
+--- a/ripd/rip_interface.c
++++ b/ripd/rip_interface.c
+@@ -516,13 +516,6 @@
+ 	  thread_cancel (ri->t_wakeup);
+ 	  ri->t_wakeup = NULL;
+ 	}
+-      
+-      for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
+-	{
+-	  ifc = listgetdata (conn_node);
+-	  next = conn_node->next;
+-	  listnode_delete (ifp->connected, ifc);
+-	}
+     }
+ }
+ 
meta-networking/recipes-protocols/quagga/quagga.inc +2 -1
index 2106c9b..21c2028 100644
@@ -32,7 +32,8 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
            file://watchquagga.init \
            file://watchquagga.default \
            file://volatiles.03_quagga \
-           file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
+           file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
+           file://quagga-Avoid-duplicate-connected-address.patch"
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
Signature · 1 line
1.7.0.2
#1 lore raw

Hi Joe,

After this fix, we can do nothing to other daemons.

Thanks,
Xufeng

Quoted 92 lines · Xufeng Zhang

commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal") introduces an regression: ifp->connected list is cleaned up when ripd is restarting, however, for interface addresses which are not specified in ripd configuration file, they are never to be added into ifp->connected again, this will lead to some abnormal behavior for route advertising.

Instead of cleaning up the ifp->connected list to avoid duplicated connected address being added into this list, we can check this condition during interface address adding process and return early when an identical address has already been added.

---
  .../quagga-Avoid-duplicate-connected-address.patch |   53 ++++++++++++++++++++
  .../recipes-protocols/quagga/quagga.inc            |    3 +-
  2 files changed, 55 insertions(+), 1 deletions(-)

create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch

meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch new file +53 -0
new file mode 100644
index 0000000..585dc29
@@ -0,0 +1,53 @@
+quagga: Avoid duplicate connected address adding to the list
+
+commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
+introduces an regression: ifp->connected list is cleaned up when ripd is
+restarting, however, for interface addresses which are not specified in
+ripd configuration file, they are never to be added into ifp->connected
+again, this will lead to some abnormal behavior for route advertising.
+
+Instead of cleaning up the ifp->connected list to avoid duplicated
+connected address being added into this list, we can check this
+condition during interface address adding process and return early
+when an identical address has already been added.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hu Yadi<[email protected]>
+Signed-off-by: Xufeng Zhang<[email protected]>
+---
+--- a/lib/if.c
++++ b/lib/if.c
+@@ -738,6 +738,16 @@
+                          struct prefix *destination)
+ {
+   struct connected *ifc;
++  struct listnode *cnode;
++  struct connected *c;
++  int ret = 0;
++
++  for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
++    {
++      ret = connected_same_prefix (p, (c->address));
++      if(ret == 1)
++        return NULL;
++    }
+
+   /* Allocate new connected address. */
+   ifc = connected_new ();
+--- a/ripd/rip_interface.c
++++ b/ripd/rip_interface.c
+@@ -516,13 +516,6 @@
+ 	  thread_cancel (ri->t_wakeup);
+ 	  ri->t_wakeup = NULL;
+ 	}
+-
+-      for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
+-	{
+-	  ifc = listgetdata (conn_node);
+-	  next = conn_node->next;
+-	  listnode_delete (ifp->connected, ifc);
+-	}
+     }
+ }
+
meta-networking/recipes-protocols/quagga/quagga.inc +2 -1
index 2106c9b..21c2028 100644
@@ -32,7 +32,8 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
             file://watchquagga.init \
             file://watchquagga.default \
             file://volatiles.03_quagga \
-           file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
+           file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
+           file://quagga-Avoid-duplicate-connected-address.patch"
 
  PACKAGECONFIG ??= ""
  PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
#2 lore raw
Quoted 3 lines · [Re: [oe] [OE][PATCH meta-networking] quagga: Avoid duplicate connected…

Hi Joe,

After this fix, we can do nothing to other daemons.

Nice. Thanks for following up on this, Xufeng. Do you think it is reasonable to remove ripd-fix-two-bugs-after-received-SIGHUP.patch, or is it still required for ripd?

-J.

Quoted 98 lines

Thanks,
Xufeng

Quoted 91 lines · Xufeng Zhang

commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal") introduces an regression: ifp->connected list is cleaned up when ripd is restarting, however, for interface addresses which are not specified in ripd configuration file, they are never to be added into ifp->connected again, this will lead to some abnormal behavior for route advertising.

Instead of cleaning up the ifp->connected list to avoid duplicated connected address being added into this list, we can check this condition during interface address adding process and return early when an identical address has already been added.

---
 .../quagga-Avoid-duplicate-connected-address.patch |   53 ++++++++++++++++++++
 .../recipes-protocols/quagga/quagga.inc            |    3 +-
 2 files changed, 55 insertions(+), 1 deletions(-)
 create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch
meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch new file +53 -0
new file mode 100644
index 0000000..585dc29
@@ -0,0 +1,53 @@
+quagga: Avoid duplicate connected address adding to the list
+
+commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
+introduces an regression: ifp->connected list is cleaned up when ripd is
+restarting, however, for interface addresses which are not specified in
+ripd configuration file, they are never to be added into ifp->connected
+again, this will lead to some abnormal behavior for route advertising.
+
+Instead of cleaning up the ifp->connected list to avoid duplicated
+connected address being added into this list, we can check this
+condition during interface address adding process and return early
+when an identical address has already been added.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hu Yadi<[email protected]>
+Signed-off-by: Xufeng Zhang<[email protected]>
+---
+--- a/lib/if.c
++++ b/lib/if.c
+@@ -738,6 +738,16 @@
+                          struct prefix *destination)
+ {
+   struct connected *ifc;
++  struct listnode *cnode;
++  struct connected *c;
++  int ret = 0;
++
++  for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
++    {
++      ret = connected_same_prefix (p, (c->address));
++      if(ret == 1)
++        return NULL;
++    }
+
+   /* Allocate new connected address. */
+   ifc = connected_new ();
+--- a/ripd/rip_interface.c
++++ b/ripd/rip_interface.c
+@@ -516,13 +516,6 @@
+ 	  thread_cancel (ri->t_wakeup);
+ 	  ri->t_wakeup = NULL;
+ 	}
+-
+-      for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
+-	{
+-	  ifc = listgetdata (conn_node);
+-	  next = conn_node->next;
+-	  listnode_delete (ifp->connected, ifc);
+-	}
+     }
+ }
+
meta-networking/recipes-protocols/quagga/quagga.inc +2 -1
index 2106c9b..21c2028 100644
@@ -32,7 +32,8 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
            file://watchquagga.init \
            file://watchquagga.default \
            file://volatiles.03_quagga \
-           file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
+           file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
+           file://quagga-Avoid-duplicate-connected-address.patch"
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
Signature · 2 lines
-Joe MacDonald.
:wq
#3 lore raw
Quoted 11 lines · Joe MacDonald
Quoted 4 lines · [Re: [oe] [OE][PATCH meta-networking] quagga: Avoid duplicate connected…

Hi Joe,

After this fix, we can do nothing to other daemons.

Nice. Thanks for following up on this, Xufeng. Do you think it is reasonable to remove ripd-fix-two-bugs-after-received-SIGHUP.patch, or is it still required for ripd?

We should still keep it since ripd-fix-two-bugs-after-received-SIGHUP.patch also fix another bug(RIP_NO_SPLIT_HORIZON flag problem).

Thanks,
Xufeng

Quoted 103 lines

-J.

Quoted 99 lines

Thanks,
Xufeng

Quoted 92 lines · Xufeng Zhang

commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal") introduces an regression: ifp->connected list is cleaned up when ripd is restarting, however, for interface addresses which are not specified in ripd configuration file, they are never to be added into ifp->connected again, this will lead to some abnormal behavior for route advertising.

Instead of cleaning up the ifp->connected list to avoid duplicated connected address being added into this list, we can check this condition during interface address adding process and return early when an identical address has already been added.

---
  .../quagga-Avoid-duplicate-connected-address.patch |   53 ++++++++++++++++++++
  .../recipes-protocols/quagga/quagga.inc            |    3 +-
  2 files changed, 55 insertions(+), 1 deletions(-)

create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch

meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch new file +53 -0
new file mode 100644
index 0000000..585dc29
@@ -0,0 +1,53 @@
+quagga: Avoid duplicate connected address adding to the list
+
+commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
+introduces an regression: ifp->connected list is cleaned up when ripd is
+restarting, however, for interface addresses which are not specified in
+ripd configuration file, they are never to be added into ifp->connected
+again, this will lead to some abnormal behavior for route advertising.
+
+Instead of cleaning up the ifp->connected list to avoid duplicated
+connected address being added into this list, we can check this
+condition during interface address adding process and return early
+when an identical address has already been added.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hu Yadi<[email protected]>
+Signed-off-by: Xufeng Zhang<[email protected]>
+---
+--- a/lib/if.c
++++ b/lib/if.c
+@@ -738,6 +738,16 @@
+                          struct prefix *destination)
+ {
+   struct connected *ifc;
++  struct listnode *cnode;
++  struct connected *c;
++  int ret = 0;
++
++  for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
++    {
++      ret = connected_same_prefix (p, (c->address));
++      if(ret == 1)
++        return NULL;
++    }
+
+   /* Allocate new connected address. */
+   ifc = connected_new ();
+--- a/ripd/rip_interface.c
++++ b/ripd/rip_interface.c
+@@ -516,13 +516,6 @@
+ 	  thread_cancel (ri->t_wakeup);
+ 	  ri->t_wakeup = NULL;
+ 	}
+-
+-      for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
+-	{
+-	  ifc = listgetdata (conn_node);
+-	  next = conn_node->next;
+-	  listnode_delete (ifp->connected, ifc);
+-	}
+     }
+ }
+
meta-networking/recipes-protocols/quagga/quagga.inc +2 -1
index 2106c9b..21c2028 100644
@@ -32,7 +32,8 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
             file://watchquagga.init \
             file://watchquagga.default \
             file://volatiles.03_quagga \
-           file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
+           file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
+           file://quagga-Avoid-duplicate-connected-address.patch"
 
  PACKAGECONFIG ??= ""
  PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
#4 lore raw
Quoted 5 lines · [Re: [oe] [OE][PATCH meta-networking] quagga: Avoid duplicate connected…
Quoted 4 lines · Joe MacDonald
Quoted 2 lines · [Re: [oe] [OE][PATCH meta-networking] quagga: Avoid duplicate connected…

Hi Joe,

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

After this fix, we can do nothing to other daemons.

Nice. Thanks for following up on this, Xufeng. Do you think it is reasonable to remove ripd-fix-two-bugs-after-received-SIGHUP.patch, or is it still required for ripd?

We should still keep it since ripd-fix-two-bugs-after-received-SIGHUP.patch also fix another bug(RIP_NO_SPLIT_HORIZON flag problem).

That's what I was thinking after I looked at the patch again, but thanks for the confirmation.

-J.

Quoted 104 lines

Thanks,
Xufeng

Quoted 98 lines

-J.

Quoted 96 lines

Thanks,
Xufeng

Quoted 91 lines · Xufeng Zhang

commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal") introduces an regression: ifp->connected list is cleaned up when ripd is restarting, however, for interface addresses which are not specified in ripd configuration file, they are never to be added into ifp->connected again, this will lead to some abnormal behavior for route advertising.

Instead of cleaning up the ifp->connected list to avoid duplicated connected address being added into this list, we can check this condition during interface address adding process and return early when an identical address has already been added.

---
 .../quagga-Avoid-duplicate-connected-address.patch |   53 ++++++++++++++++++++
 .../recipes-protocols/quagga/quagga.inc            |    3 +-
 2 files changed, 55 insertions(+), 1 deletions(-)
 create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch
meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch new file +53 -0
new file mode 100644
index 0000000..585dc29
@@ -0,0 +1,53 @@
+quagga: Avoid duplicate connected address adding to the list
+
+commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
+introduces an regression: ifp->connected list is cleaned up when ripd is
+restarting, however, for interface addresses which are not specified in
+ripd configuration file, they are never to be added into ifp->connected
+again, this will lead to some abnormal behavior for route advertising.
+
+Instead of cleaning up the ifp->connected list to avoid duplicated
+connected address being added into this list, we can check this
+condition during interface address adding process and return early
+when an identical address has already been added.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hu Yadi<[email protected]>
+Signed-off-by: Xufeng Zhang<[email protected]>
+---
+--- a/lib/if.c
++++ b/lib/if.c
+@@ -738,6 +738,16 @@
+                          struct prefix *destination)
+ {
+   struct connected *ifc;
++  struct listnode *cnode;
++  struct connected *c;
++  int ret = 0;
++
++  for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
++    {
++      ret = connected_same_prefix (p, (c->address));
++      if(ret == 1)
++        return NULL;
++    }
+
+   /* Allocate new connected address. */
+   ifc = connected_new ();
+--- a/ripd/rip_interface.c
++++ b/ripd/rip_interface.c
+@@ -516,13 +516,6 @@
+ 	  thread_cancel (ri->t_wakeup);
+ 	  ri->t_wakeup = NULL;
+ 	}
+-
+-      for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
+-	{
+-	  ifc = listgetdata (conn_node);
+-	  next = conn_node->next;
+-	  listnode_delete (ifp->connected, ifc);
+-	}
+     }
+ }
+
meta-networking/recipes-protocols/quagga/quagga.inc +2 -1
index 2106c9b..21c2028 100644
@@ -32,7 +32,8 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
            file://watchquagga.init \
            file://watchquagga.default \
            file://volatiles.03_quagga \
-           file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
+           file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
+           file://quagga-Avoid-duplicate-connected-address.patch"
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
Signature · 2 lines
-Joe MacDonald.
:wq
#5 lore raw
In reply to Xufeng Zhang

Merged, thanks.
-J.

Quoted 91 lines · [[oe] [OE][PATCH meta-networking] quagga: Avoid duplicate connected address…

commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal") introduces an regression: ifp->connected list is cleaned up when ripd is restarting, however, for interface addresses which are not specified in ripd configuration file, they are never to be added into ifp->connected again, this will lead to some abnormal behavior for route advertising.

Instead of cleaning up the ifp->connected list to avoid duplicated connected address being added into this list, we can check this condition during interface address adding process and return early when an identical address has already been added.

---
 .../quagga-Avoid-duplicate-connected-address.patch |   53 ++++++++++++++++++++
 .../recipes-protocols/quagga/quagga.inc            |    3 +-
 2 files changed, 55 insertions(+), 1 deletions(-)
 create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch
meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch new file +53 -0
new file mode 100644
index 0000000..585dc29
@@ -0,0 +1,53 @@
+quagga: Avoid duplicate connected address adding to the list
+
+commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
+introduces an regression: ifp->connected list is cleaned up when ripd is
+restarting, however, for interface addresses which are not specified in
+ripd configuration file, they are never to be added into ifp->connected
+again, this will lead to some abnormal behavior for route advertising.
+
+Instead of cleaning up the ifp->connected list to avoid duplicated
+connected address being added into this list, we can check this
+condition during interface address adding process and return early
+when an identical address has already been added.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hu Yadi <[email protected]>
+Signed-off-by: Xufeng Zhang <[email protected]>
+---
+--- a/lib/if.c
++++ b/lib/if.c
+@@ -738,6 +738,16 @@
+                          struct prefix *destination)
+ {
+   struct connected *ifc;
++  struct listnode *cnode;
++  struct connected *c;
++  int ret = 0;
++
++  for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
++    {
++      ret = connected_same_prefix (p, (c->address));
++      if(ret == 1)
++        return NULL;
++    }
+ 
+   /* Allocate new connected address. */
+   ifc = connected_new ();
+--- a/ripd/rip_interface.c
++++ b/ripd/rip_interface.c
+@@ -516,13 +516,6 @@
+ 	  thread_cancel (ri->t_wakeup);
+ 	  ri->t_wakeup = NULL;
+ 	}
+-      
+-      for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
+-	{
+-	  ifc = listgetdata (conn_node);
+-	  next = conn_node->next;
+-	  listnode_delete (ifp->connected, ifc);
+-	}
+     }
+ }
+ 
meta-networking/recipes-protocols/quagga/quagga.inc +2 -1
index 2106c9b..21c2028 100644
@@ -32,7 +32,8 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
            file://watchquagga.init \
            file://watchquagga.default \
            file://volatiles.03_quagga \
-           file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
+           file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
+           file://quagga-Avoid-duplicate-connected-address.patch"
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
Signature · 2 lines
-Joe MacDonald.
:wq