3131#include <net/sock.h>
3232#include <net/sch_generic.h>
3333#include <net/act_api.h>
34+ #include <net/netlink.h>
3435
3536void tcf_hash_destroy (struct tcf_common * p , struct tcf_hashinfo * hinfo )
3637{
@@ -98,7 +99,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
9899 err = tcf_action_dump_1 (skb , a , 0 , 0 );
99100 if (err < 0 ) {
100101 index -- ;
101- skb_trim (skb , ( u8 * ) r - skb -> data );
102+ nlmsg_trim (skb , r );
102103 goto done ;
103104 }
104105 r -> rta_len = skb_tail_pointer (skb ) - (u8 * )r ;
@@ -114,7 +115,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
114115 return n_i ;
115116
116117rtattr_failure :
117- skb_trim (skb , ( u8 * ) r - skb -> data );
118+ nlmsg_trim (skb , r );
118119 goto done ;
119120}
120121
@@ -144,7 +145,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
144145
145146 return n_i ;
146147rtattr_failure :
147- skb_trim (skb , ( u8 * ) r - skb -> data );
148+ nlmsg_trim (skb , r );
148149 return - EINVAL ;
149150}
150151
@@ -440,7 +441,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
440441 }
441442
442443rtattr_failure :
443- skb_trim (skb , b - skb -> data );
444+ nlmsg_trim (skb , b );
444445 return -1 ;
445446}
446447
@@ -467,7 +468,7 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref)
467468rtattr_failure :
468469 err = - EINVAL ;
469470errout :
470- skb_trim (skb , b - skb -> data );
471+ nlmsg_trim (skb , b );
471472 return err ;
472473}
473474
@@ -658,7 +659,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
658659
659660rtattr_failure :
660661nlmsg_failure :
661- skb_trim (skb , b - skb -> data );
662+ nlmsg_trim (skb , b );
662663 return -1 ;
663664}
664665
@@ -1059,7 +1060,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
10591060 x -> rta_len = skb_tail_pointer (skb ) - (u8 * )x ;
10601061 ret = skb -> len ;
10611062 } else
1062- skb_trim (skb , ( u8 * ) x - skb -> data );
1063+ nlmsg_trim (skb , x );
10631064
10641065 nlh -> nlmsg_len = skb_tail_pointer (skb ) - b ;
10651066 if (NETLINK_CB (cb -> skb ).pid && ret )
@@ -1070,7 +1071,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
10701071rtattr_failure :
10711072nlmsg_failure :
10721073 module_put (a_o -> owner );
1073- skb_trim (skb , b - skb -> data );
1074+ nlmsg_trim (skb , b );
10741075 return skb -> len ;
10751076}
10761077
0 commit comments