libnetdevice: define default request flags
Bug: 372814636
Test: verified with b/372814636 test service
Change-Id: I81e8ac625e6d075d9780b6e2e0a172aec0a04468
diff --git a/automotive/can/1.0/default/libnetdevice/can.cpp b/automotive/can/1.0/default/libnetdevice/can.cpp
index 8d82c36..9cf0253 100644
--- a/automotive/can/1.0/default/libnetdevice/can.cpp
+++ b/automotive/can/1.0/default/libnetdevice/can.cpp
@@ -70,7 +70,7 @@
can_bittiming bt = {};
bt.bitrate = bitrate;
- nl::MessageFactory<ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_ACK);
+ nl::MessageFactory<ifinfomsg> req(RTM_NEWLINK);
req->ifi_index = nametoindex(ifname);
if (req->ifi_index == 0) {
diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
index 4c4b77b..1830633 100644
--- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
+++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
@@ -104,8 +104,7 @@
}
bool addAddr4(std::string_view ifname, std::string_view addr, uint8_t prefixlen) {
- android::nl::MessageFactory<ifaddrmsg> req(
- RTM_NEWADDR, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL | NLM_F_ACK);
+ nl::MessageFactory<ifaddrmsg> req(RTM_NEWADDR, nl::kCreateFlags);
req->ifa_family = AF_INET;
req->ifa_prefixlen = prefixlen;
req->ifa_flags = IFA_F_SECONDARY;
@@ -120,8 +119,7 @@
}
bool add(std::string_view dev, std::string_view type) {
- nl::MessageFactory<ifinfomsg> req(RTM_NEWLINK,
- NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL | NLM_F_ACK);
+ nl::MessageFactory<ifinfomsg> req(RTM_NEWLINK, nl::kCreateFlags);
req.add(IFLA_IFNAME, dev);
{
@@ -134,7 +132,7 @@
}
bool del(std::string_view dev) {
- nl::MessageFactory<ifinfomsg> req(RTM_DELLINK, NLM_F_REQUEST | NLM_F_ACK);
+ nl::MessageFactory<ifinfomsg> req(RTM_DELLINK);
req.add(IFLA_IFNAME, dev);
nl::Socket sock(NETLINK_ROUTE);
diff --git a/automotive/can/1.0/default/libnetdevice/vlan.cpp b/automotive/can/1.0/default/libnetdevice/vlan.cpp
index a437c32..e5b5a61 100644
--- a/automotive/can/1.0/default/libnetdevice/vlan.cpp
+++ b/automotive/can/1.0/default/libnetdevice/vlan.cpp
@@ -33,8 +33,7 @@
return false;
}
- nl::MessageFactory<ifinfomsg> req(RTM_NEWLINK,
- NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL | NLM_F_ACK);
+ nl::MessageFactory<ifinfomsg> req(RTM_NEWLINK, nl::kCreateFlags);
req.add(IFLA_IFNAME, vlan);
req.add<uint32_t>(IFLA_LINK, ethidx);