Exemple #1
0
static bool
tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info)
{
	const struct iphdr *iph = ip_hdr(skb);
	struct net *net = pick_net(skb);
	struct rtable *rt;
	struct flowi4 fl4;

	memset(&fl4, 0, sizeof(fl4));
	if (info->priv) {
		if (info->priv->oif == -1)
			return false;
		fl4.flowi4_oif = info->priv->oif;
	}
	fl4.daddr = info->gw.ip;
	fl4.flowi4_tos = RT_TOS(iph->tos);
	fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
	rt = ip_route_output_key(net, &fl4);
	if (IS_ERR(rt))
		return false;

	skb_dst_drop(skb);
	skb_dst_set(skb, &rt->dst);
	skb->dev      = rt->dst.dev;
	skb->protocol = htons(ETH_P_IP);
	return true;
}
Exemple #2
0
static bool
tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)
{
	const struct ipv6hdr *iph = ipv6_hdr(skb);
	struct net *net = pick_net(skb);
	struct dst_entry *dst;
	struct flowi6 fl6;

	memset(&fl6, 0, sizeof(fl6));
	if (info->priv) {
		if (info->priv->oif == -1)
			return false;
		fl6.flowi6_oif = info->priv->oif;
	}
	fl6.daddr = info->gw.in6;
	fl6.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) |
			   (iph->flow_lbl[1] << 8) | iph->flow_lbl[2];
	dst = ip6_route_output(net, NULL, &fl6);
	if (dst == NULL)
		return false;

	skb_dst_drop(skb);
	skb_dst_set(skb, dst);
	skb->dev      = dst->dev;
	skb->protocol = htons(ETH_P_IPV6);
	return true;
}
Exemple #3
0
static int
LibraryChanged (int argc, char **argv, Coord x, Coord y)
{
  int i;
  if (!Library.MenuN)
    return 0;
  if (build_library_dialog ())
    return 0;
  last_pick = -1;
  if (library_strings)
    free (library_strings);
  library_strings = (XmString *) malloc (Library.MenuN * sizeof (XmString));
  for (i = 0; i < Library.MenuN; i++)
    library_strings[i] = XmStringCreatePCB (Library.Menu[i].Name);
  n = 0;
  stdarg (XmNitems, library_strings);
  stdarg (XmNitemCount, Library.MenuN);
  XtSetValues (library_list, args, n);
  pick_net (0);
  return 0;
}
Exemple #4
0
static int
LesstifNetlistChanged (int argc, char **argv, Coord x, Coord y)
{
  int i;
  if (!PCB->NetlistLib.MenuN)
    return 0;
  if (build_netlist_dialog ())
    return 0;
  last_pick = -1;
  if (netlist_strings)
    free (netlist_strings);
  netlist_strings =
    (XmString *) malloc (PCB->NetlistLib.MenuN * sizeof (XmString));
  for (i = 0; i < PCB->NetlistLib.MenuN; i++)
    netlist_strings[i] =
      XmStringCreatePCB (PCB->NetlistLib.Menu[i].Name);
  n = 0;
  stdarg (XmNitems, netlist_strings);
  stdarg (XmNitemCount, PCB->NetlistLib.MenuN);
  XtSetValues (netlist_list, args, n);
  pick_net (0);
  return 0;
}
Exemple #5
0
static void
netlist_extend (Widget w, void *v, XmListCallbackStruct * cbs)
{
  if (cbs->selected_item_count == 1)
    pick_net (cbs->item_position - 1);
}
Exemple #6
0
static void
library_browse (Widget w, void *v, XmListCallbackStruct * cbs)
{
  pick_net (cbs->item_position - 1);
}