The iface.prefix_len field might be present in existing records created
with older versions of the Open-iSCSI tools.

Need to not start throwing errors after an update.
---
 libopeniscsiusr/idbm.c        | 2 ++
 libopeniscsiusr/idbm_fields.h | 1 +
 libopeniscsiusr/iface.h       | 6 +++++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c
index b881eabd65a9..f7dc5923bb74 100644
--- a/libopeniscsiusr/idbm.c
+++ b/libopeniscsiusr/idbm.c
@@ -370,6 +370,8 @@ static int _idbm_iface_rec_link(struct iscsi_iface *iface,
                 _CAN_MODIFY);
        _rec_str(IFACE_IPADDR, recs, iface, ipaddress, IDBM_SHOW, num,
                 _CAN_MODIFY);
+       _rec_uint8(IFACE_PREFIX_LEN, recs, iface, prefix_len, IDBM_SHOW, num,
+               _CAN_MODIFY);
        _rec_str(IFACE_HWADDR, recs, iface, hwaddress, IDBM_SHOW, num,
                 _CAN_MODIFY);
        _rec_str(IFACE_TRANSPORTNAME, recs, iface, transport_name, IDBM_SHOW,
diff --git a/libopeniscsiusr/idbm_fields.h b/libopeniscsiusr/idbm_fields.h
index 090c4f9e513f..3b2808906774 100644
--- a/libopeniscsiusr/idbm_fields.h
+++ b/libopeniscsiusr/idbm_fields.h
@@ -29,6 +29,7 @@
 #define IFACE_ISID             "iface.isid"
 #define IFACE_BOOT_PROTO       "iface.bootproto"
 #define IFACE_IPADDR           "iface.ipaddress"
+#define IFACE_PREFIX_LEN       "iface.prefix_len"
 #define IFACE_SUBNET_MASK      "iface.subnet_mask"
 #define IFACE_GATEWAY          "iface.gateway"
 #define IFACE_PRIMARY_DNS      "iface.primary_dns"
diff --git a/libopeniscsiusr/iface.h b/libopeniscsiusr/iface.h
index af3d9c7ba76c..eaf1832ec4c3 100644
--- a/libopeniscsiusr/iface.h
+++ b/libopeniscsiusr/iface.h
@@ -57,9 +57,13 @@ struct iscsi_iface {
        char                    ipv6_autocfg[NI_MAXHOST];
        char                    linklocal_autocfg[NI_MAXHOST];
        char                    router_autocfg[NI_MAXHOST];
-//     uint8_t                 prefix_len;
+       uint8_t                 prefix_len;
        /* ^ prefix_len is removed, as linux kernel has no such sysfs property
         * and there is no actual code in usr/ folder set this property
+        *
+        * Added back, we need to be backward compatible with iface records
+        * created by older tools. Look at fixing code to ignore in record
+        * files instead? - cleech
         */
        uint16_t                vlan_id;
        uint8_t                 vlan_priority;
-- 
2.14.4

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to