Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d5beb85 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Change libnl++ namespace to android::nl

Bug: 162032964
Test: it builds
Change-Id: I3790f49c41319794e61ed422705c5e18e55e8bfc
parent 1695459e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ bool setBitrate(std::string ifname, uint32_t bitrate) {
    struct can_bittiming bt = {};
    bt.bitrate = bitrate;

    NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);
    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);

    const auto ifidx = nametoindex(ifname);
    if (ifidx == 0) {
@@ -89,7 +89,7 @@ bool setBitrate(std::string ifname, uint32_t bitrate) {
        }
    }

    NetlinkSocket sock(NETLINK_ROUTE);
    nl::NetlinkSocket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
}

+5 −4
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ bool down(std::string ifname) {
}

bool add(std::string dev, std::string type) {
    NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK,
                                             NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
    req.addattr(IFLA_IFNAME, dev);

    {
@@ -69,15 +70,15 @@ bool add(std::string dev, std::string type) {
        req.addattr(IFLA_INFO_KIND, type);
    }

    NetlinkSocket sock(NETLINK_ROUTE);
    nl::NetlinkSocket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
}

bool del(std::string dev) {
    NetlinkRequest<struct ifinfomsg> req(RTM_DELLINK, NLM_F_REQUEST);
    nl::NetlinkRequest<struct ifinfomsg> req(RTM_DELLINK, NLM_F_REQUEST);
    req.addattr(IFLA_IFNAME, dev);

    NetlinkSocket sock(NETLINK_ROUTE);
    nl::NetlinkSocket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
}

+3 −2
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ bool add(const std::string& eth, const std::string& vlan, uint16_t id) {
        return false;
    }

    NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK,
                                             NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
    req.addattr(IFLA_IFNAME, vlan);
    req.addattr<uint32_t>(IFLA_LINK, ethidx);

@@ -45,7 +46,7 @@ bool add(const std::string& eth, const std::string& vlan, uint16_t id) {
        }
    }

    NetlinkSocket sock(NETLINK_ROUTE);
    nl::NetlinkSocket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
}

+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

#include <android-base/logging.h>

namespace android::netdevice::impl {
namespace android::nl::impl {

static struct rtattr* nlmsg_tail(struct nlmsghdr* n) {
    return reinterpret_cast<struct rtattr*>(  //
@@ -51,4 +51,4 @@ void addattr_nest_end(struct nlmsghdr* n, struct rtattr* nest) {
    nest->rta_len = nestLen;
}

}  // namespace android::netdevice::impl
}  // namespace android::nl::impl
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include <android-base/logging.h>

namespace android::netdevice {
namespace android::nl {

/**
 * Print all outbound/inbound Netlink messages.
@@ -190,4 +190,4 @@ std::optional<unsigned int> NetlinkSocket::getSocketPid() {
    return sa.nl_pid;
}

}  // namespace android::netdevice
}  // namespace android::nl
Loading