static unsigned int target(struct sk_buff *skb, const struct xt_action_param *par) { const struct xt_MPLS_target_info *mplsinfo = par->targinfo; struct mpls_nhlfe *nhlfe = mplsinfo->nhlfe; MPLS_ENTER; if (mpls_set_nexthop2(nhlfe, skb_dst(skb))) { printk("MPLS: Couldn't set nexthop for key %x\n", mplsinfo->key); MPLS_EXIT; return NF_DROP; } MPLS_EXIT; return XT_CONTINUE; }
int mpls_set_nexthop (struct shim_blk *sblk, struct dst_entry *dst) { struct mpls_nhlfe *nhlfe = NULL; unsigned int key; int ret; MPLS_ENTER; memcpy(&key, sblk->data, sizeof(key)); nhlfe = mpls_get_nhlfe(key); if (unlikely(!nhlfe)) { MPLS_EXIT; return -ENXIO; } ret = mpls_set_nexthop2(nhlfe, dst); mpls_nhlfe_release(nhlfe); MPLS_EXIT; return ret; }