From: Leandro Stasi Date: Sun, 02 Jun 2002 20:55:53 +0000 Subject: [LARTC] configuring traffic control without tc (struct tcmsg)] Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: lartc@vger.kernel.org Hi I need some help/doc with the rtnetlink struct tcmsg prameters. I'm trying to configure traffic control kernel fuctions from inside a program, and I don't want to use tc. I try to make a function to del the root qdisc from a device but I couldn't complete it. So far I know this: I have to open a netlink socket with PF_NETLINK and NETLINK_ROUTE. Send a nlmsghdr struct. (which I know the param) Send a tcmsg struct (which I don't know the parm) struct mensages { struct nlmsghdr nh; struct tcmsg tc; char attrbuf [512]; }; void delroot (struct root *ptroot) { struct mensages reg; int rtnetlink_socket; struct rtattr *rta; rtnetlink_socket=3Dsocket(PF_NETLINK,SOCK_RAW,NETLINK_ROUTE); memset(®,0,sizeof(reg)); reg.nh.nlmsg_len=3DNLMSG_LENGHT(sizeof(struct ifinfomsg)); reg.nh.nlmsg_flags=3DNLM_F_REQUEST; reg.nh.nlmsq_type=3DRTML_NEWLINK; reg.tc.tcm_family=AF_UNSPEC; reg.tc.tcm_index=3DINTERFACE_INDEX; reg.tc.tcm_handle=3D?????; rta=3D(struct rtattr*)( ((char *) ®)+NLMSG_ALING(n->nlmsg_len) ); rta->rta_type=3D???????; rta->rta_len=3Dsizeof(unsigned int); reg.nh.nlmsg_len=3DNLMSG_ALING(reg.nh.nlmsg_len) + R_LENGTH(sizeof(???)); memcpy(RTA_DAtA(rta),???????,sizeof(?????)); send(rtnetlink_socket,®,reg.nh.nlmsg_len); } _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/ _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/