librmnetctl: Add flag for netmgrd without uplink features support

Change-Id: I649588d22e457f198a304b317b7e2e93f1c51624
diff --git a/rmnetctl/Android.bp b/rmnetctl/Android.bp
index d51e33e..86b3e21 100644
--- a/rmnetctl/Android.bp
+++ b/rmnetctl/Android.bp
@@ -14,10 +14,27 @@
     vendor: true,
 }
 
+soong_config_module_type {
+    name: "librmnetctl_defaults_pre_uplink",
+    module_type: "cc_defaults",
+    config_namespace: "DATASERVICES",
+    bool_variables: ["USES_PRE_UPLINK_FEATURES_NETMGRD"],
+    properties: ["cflags"],
+}
+
+librmnetctl_defaults_pre_uplink {
+    name: "librmnetctl_pre_uplink",
+    soong_config_variables: {
+        USES_PRE_UPLINK_FEATURES_NETMGRD: {
+            cflags: ["-DNO_UPLINK_FEATURES"],
+        }
+    }
+}
+
 cc_library_shared {
     name: "librmnetctl",
     header_libs: ["generated_kernel_headers"],
-    defaults: ["librmnetctl_defaults"],
+    defaults: ["librmnetctl_defaults", "librmnetctl_pre_uplink"],
     srcs: ["src/librmnetctl.c"],
 }
 
diff --git a/rmnetctl/inc/librmnetctl.h b/rmnetctl/inc/librmnetctl.h
index b621528..ac7c7bf 100644
--- a/rmnetctl/inc/librmnetctl.h
+++ b/rmnetctl/inc/librmnetctl.h
@@ -614,7 +614,12 @@
  */
 int rtrmnet_ctl_getvnd(rmnetctl_hndl_t *hndl, char *vndname,
 		       uint16_t *error_code, uint16_t *mux_id,
-		       uint32_t *flagconfig, uint8_t *agg_count,
+		       uint32_t *flagconfig,
+#ifdef NO_UPLINK_FEATURES
+		       uint16_t *agg_count,
+#else
+		       uint8_t *agg_count,
+#endif
 		       uint16_t *agg_size, uint32_t *agg_time,
 		       uint8_t *features);
 
@@ -655,7 +660,9 @@
 					  uint8_t packet_count,
 					  uint16_t byte_count,
 					  uint32_t time_limit,
+#ifndef NO_UPLINK_FEATURES
 					  uint8_t features,
+#endif
 					  uint16_t *error_code);
 
 int rtrmnet_activate_flow(rmnetctl_hndl_t *hndl,
diff --git a/rmnetctl/src/librmnetctl.c b/rmnetctl/src/librmnetctl.c
index 8ad1874..a03b902 100644
--- a/rmnetctl/src/librmnetctl.c
+++ b/rmnetctl/src/librmnetctl.c
@@ -98,8 +98,12 @@
 
 struct rmnetctl_uplink_params {
 	uint16_t byte_count;
+#ifdef NO_UPLINK_FEATURES
+	uint16_t packet_count;
+#else
 	uint8_t packet_count;
 	uint8_t features;
+#endif
 	uint32_t time_limit;
 };
 
@@ -1514,7 +1518,12 @@
 
 int rtrmnet_ctl_getvnd(rmnetctl_hndl_t *hndl, char *vndname,
 		       uint16_t *error_code, uint16_t *mux_id,
-		       uint32_t *flagconfig, uint8_t *agg_count,
+		       uint32_t *flagconfig,
+#ifdef NO_UPLINK_FEATURES
+		       uint16_t *agg_count,
+#else
+		       uint8_t *agg_count,
+#endif
 		       uint16_t *agg_size, uint32_t *agg_time,
 		       uint8_t *features)
 {
@@ -1612,8 +1621,13 @@
 		if (agg_count)
 			*agg_count = ul_agg->packet_count;
 
+#ifdef NO_UPLINK_FEATURES
+		if (features)
+			*features = 0;
+#else
 		if (features)
 			*features = ul_agg->features;
+#endif
 
 		if (agg_time)
 			*agg_time = ul_agg->time_limit;
@@ -1677,7 +1691,9 @@
 					  uint8_t packet_count,
 					  uint16_t byte_count,
 					  uint32_t time_limit,
+#ifndef NO_UPLINK_FEATURES
 					  uint8_t features,
+#endif
 					  uint16_t *error_code)
 {
 	struct nlmsg req;
@@ -1742,7 +1758,9 @@
 
 	uplink_params.byte_count = byte_count;
 	uplink_params.packet_count = packet_count;
+#ifndef NO_UPLINK_FEATURES
 	uplink_params.features = features;
+#endif
 	uplink_params.time_limit = time_limit;
 	rc = rta_put(&req, &reqsize, RMNETCTL_IFLA_UPLINK_PARAMS,
 		     sizeof(uplink_params), &uplink_params);