Hi, Ansuel, On Thu, 20 Jan 2022 at 15:11, Ansuel Smith <ansuels...@gmail.com> wrote: > > Add support for link set useful to set CPU port for dsa drivers. > > Signed-off-by: Ansuel Smith <ansuels...@gmail.com> > --- > ...-iplink_allow_to_change_iplink_value.patch | 94 +++++++++++++++++++ > 1 file changed, 94 insertions(+) > create mode 100644 > package/network/utils/iproute2/patches/191-iplink_allow_to_change_iplink_value.patch > > diff --git > a/package/network/utils/iproute2/patches/191-iplink_allow_to_change_iplink_value.patch > > b/package/network/utils/iproute2/patches/191-iplink_allow_to_change_iplink_value.patch > new file mode 100644 > index 0000000000..1a8bad9119 > --- /dev/null > +++ > b/package/network/utils/iproute2/patches/191-iplink_allow_to_change_iplink_value.patch > @@ -0,0 +1,94 @@ > +From: Marek Behún <marek.be...@nic.cz> > +Subject: [PATCH RFC iproute2-next] iplink: allow to change iplink value > +Date: Sat, 24 Aug 2019 04:42:51 +0200 > + > +Allow to change the interface to which a given interface is linked to. > +This is useful in the case of multi-CPU port DSA, for changing the CPU > +port of a given user port. > + > +Signed-off-by: Marek Behún <marek.be...@nic.cz> > +Cc: David Ahern <dsah...@gmail.com> > +Cc: Stephen Hemminger <step...@networkplumber.org> > +Signed-off-by: Ansuel Smith <ansuels...@gmail.com> > +--- > + ip/iplink.c | 16 +++++----------- > + man/man8/ip-link.8.in | 7 +++++++ > + 2 files changed, 12 insertions(+), 11 deletions(-) > + > +diff --git a/ip/iplink.c b/ip/iplink.c > +index 212a0885..d52c0aaf 100644 > +--- a/ip/iplink.c > ++++ b/ip/iplink.c > +@@ -579,7 +579,6 @@ int iplink_parse(int argc, char **argv, struct > iplink_req *req, char **type) > + { > + char *name = NULL; > + char *dev = NULL; > +- char *link = NULL; > + int ret, len; > + char abuf[32]; > + int qlen = -1; > +@@ -590,6 +589,7 @@ int iplink_parse(int argc, char **argv, struct > iplink_req *req, char **type) > + int numrxqueues = -1; > + int link_netnsid = -1; > + int index = 0; > ++ int link = -1; > + int group = -1; > + int addr_len = 0; > + > +@@ -620,7 +620,10 @@ int iplink_parse(int argc, char **argv, struct > iplink_req *req, char **type) > + invarg("Invalid \"index\" value", *argv); > + } else if (matches(*argv, "link") == 0) { > + NEXT_ARG(); > +- link = *argv; > ++ link = ll_name_to_index(*argv); > ++ if (!link) > ++ return nodev(*argv); > ++ addattr32(&req->n, sizeof(*req), IFLA_LINK, link); > + } else if (matches(*argv, "address") == 0) { > + NEXT_ARG(); > + addr_len = ll_addr_a2n(abuf, sizeof(abuf), *argv); > +@@ -1004,15 +1007,6 @@ int iplink_parse(int argc, char **argv, struct > iplink_req *req, char **type) > + exit(-1); > + } > + > +- if (link) { > +- int ifindex; > +- > +- ifindex = ll_name_to_index(link); > +- if (!ifindex) > +- return nodev(link); > +- addattr32(&req->n, sizeof(*req), IFLA_LINK, ifindex); > +- } > +- > + req->i.ifi_index = index; > + } > + > +diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in > +index a8ae72d2..800aed05 100644 > +--- a/man/man8/ip-link.8.in > ++++ b/man/man8/ip-link.8.in > +@@ -149,6 +149,9 @@ ip-link \- network device configuration > + .br > + .RB "[ " nomaster " ]" > + .br > ++.RB "[ " link > ++.IR DEVICE " ]" > ++.br > + .RB "[ " vrf > + .IR NAME " ]" > + .br > +@@ -2131,6 +2134,10 @@ set master device of the device (enslave device). > + .BI nomaster > + unset master device of the device (release device). > + > ++.TP > ++.BI link " DEVICE" > ++set device to which this device is linked to. > ++ > + .TP > + .BI addrgenmode " eui64|none|stable_secret|random" > + set the IPv6 address generation mode > +-- > +2.21.0 > + > + > -- > 2.30.2.windows.1 >
Nice, but we'll need to do the same for BusyBox's ip applet. Let's not force everyone who needs multi-CPU DSA to install iproute2's ip just for this case. ;) Cheers, Rui _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel