[LARTC] configuring traffic control without tc (struct tcmsg)]

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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=socket(PF_NETLINK,SOCK_RAW,NETLINK_ROUTE);

   memset(&reg,0,sizeof(reg));

   reg.nh.nlmsg_len=NLMSG_LENGHT(sizeof(struct ifinfomsg));
   reg.nh.nlmsg_flags=NLM_F_REQUEST;
   reg.nh.nlmsq_type=RTML_NEWLINK;
   reg.tc.tcm_family=AF_UNSPEC;
   reg.tc.tcm_index=INTERFACE_INDEX;
   reg.tc.tcm_handle=?????;

   rta=(struct rtattr*)( ((char *) &reg)+NLMSG_ALING(n->nlmsg_len) );

   rta->rta_type=???????;
   rta->rta_len=sizeof(unsigned int);

   reg.nh.nlmsg_len=NLMSG_ALING(reg.nh.nlmsg_len) + R_LENGTH(sizeof(???));

memcpy(RTA_DAtA(rta),???????,sizeof(?????));

   send(rtnetlink_socket,&reg,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/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux