• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/net/ipx/

Lines Matching refs:intrfc

86 extern int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
88 extern void ipxrtr_del_routes(struct ipx_interface *intrfc);
136 struct ipx_interface *intrfc = ipx_sk(sk)->intrfc;
138 if (!intrfc)
141 ipxitf_hold(intrfc);
142 spin_lock_bh(&intrfc->if_sklist_lock);
144 spin_unlock_bh(&intrfc->if_sklist_lock);
145 ipxitf_put(intrfc);
228 static void ipxitf_insert_socket(struct ipx_interface *intrfc, struct sock *sk)
230 ipxitf_hold(intrfc);
231 spin_lock_bh(&intrfc->if_sklist_lock);
232 ipx_sk(sk)->intrfc = intrfc;
233 sk_add_node(sk, &intrfc->if_sklist);
234 spin_unlock_bh(&intrfc->if_sklist_lock);
235 ipxitf_put(intrfc);
238 /* caller must hold intrfc->if_sklist_lock */
239 static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc,
245 sk_for_each(s, node, &intrfc->if_sklist)
253 /* caller must hold a reference to intrfc */
254 static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
259 spin_lock_bh(&intrfc->if_sklist_lock);
260 s = __ipxitf_find_socket(intrfc, port);
263 spin_unlock_bh(&intrfc->if_sklist_lock);
269 static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc,
276 ipxitf_hold(intrfc);
277 spin_lock_bh(&intrfc->if_sklist_lock);
279 sk_for_each(s, node, &intrfc->if_sklist) {
288 spin_unlock_bh(&intrfc->if_sklist_lock);
289 ipxitf_put(intrfc);
294 static void __ipxitf_down(struct ipx_interface *intrfc)
300 ipxrtr_del_routes(intrfc);
302 spin_lock_bh(&intrfc->if_sklist_lock);
304 sk_for_each_safe(s, node, t, &intrfc->if_sklist) {
309 ipxs->intrfc = NULL;
314 INIT_HLIST_HEAD(&intrfc->if_sklist);
315 spin_unlock_bh(&intrfc->if_sklist_lock);
318 list_del(&intrfc->node);
321 if (intrfc == ipx_primary_net)
323 if (intrfc == ipx_internal_net)
326 if (intrfc->if_dev)
327 dev_put(intrfc->if_dev);
328 kfree(intrfc);
331 void ipxitf_down(struct ipx_interface *intrfc)
334 __ipxitf_down(intrfc);
338 static __inline__ void __ipxitf_put(struct ipx_interface *intrfc)
340 if (atomic_dec_and_test(&intrfc->refcnt))
341 __ipxitf_down(intrfc);
387 /* caller must hold a reference to intrfc */
390 static int ipxitf_demux_socket(struct ipx_interface *intrfc,
400 spin_lock_bh(&intrfc->if_sklist_lock);
402 sk_for_each(s, node, &intrfc->if_sklist) {
423 if (intrfc != ipx_internal_net)
434 spin_unlock_bh(&intrfc->if_sklist_lock);
438 static struct sock *ncp_connection_hack(struct ipx_interface *intrfc,
462 spin_lock_bh(&intrfc->if_sklist_lock);
463 sk_for_each(sk, node, &intrfc->if_sklist)
470 spin_unlock_bh(&intrfc->if_sklist_lock);
475 static int ipxitf_demux_socket(struct ipx_interface *intrfc,
483 if (intrfc == ipx_primary_net && ntohs(ipx->ipx_dest.sock) == 0x451)
484 sock1 = ncp_connection_hack(intrfc, ipx);
487 sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock);
497 if (ipx_primary_net && intrfc != ipx_primary_net) {
562 static struct sk_buff *ipxitf_adjust_skbuff(struct ipx_interface *intrfc,
567 int out_offset = intrfc->if_ipx_offset;
589 /* caller must hold a reference to intrfc and the skb has to be unshared */
590 int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node)
593 struct net_device *dev = intrfc->if_dev;
594 struct datalink_proto *dl = intrfc->if_dlink;
628 if (ipx->ipx_dest.net == intrfc->if_netnum) {
633 if (intrfc == ipx_internal_net ||
634 !memcmp(intrfc->if_node, node, IPX_NODE_LEN)) {
639 return ipxitf_demux_socket(intrfc, skb, 0);
646 ipxitf_demux_socket(intrfc, skb, send_to_wire);
657 if (ipx->ipx_source.net != intrfc->if_netnum) {
682 skb = ipxitf_adjust_skbuff(intrfc, skb);
696 static int ipxitf_add_local_route(struct ipx_interface *intrfc)
698 return ipxrtr_add_route(intrfc->if_netnum, intrfc, NULL);
701 static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
703 static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb);
705 static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
710 ipxitf_hold(intrfc);
713 if (!intrfc->if_netnum) /* net number of intrfc not known yet */
714 ipxitf_discover_netnum(intrfc, skb);
718 rc = ipxitf_pprop(intrfc, skb);
725 IPX_SKB_CB(skb)->ipx_dest_net = intrfc->if_netnum;
727 IPX_SKB_CB(skb)->ipx_source_net = intrfc->if_netnum;
732 intrfc->if_netnum != IPX_SKB_CB(skb)->ipx_dest_net) {
746 !memcmp(intrfc->if_node, ipx->ipx_dest.node, IPX_NODE_LEN)) {
747 rc = ipxitf_demux_socket(intrfc, skb, 0);
755 ipxitf_put(intrfc);
759 static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
772 intrfc->if_netnum = cb->ipx_source_net;
773 ipxitf_add_local_route(intrfc);
780 ipx_device_name(intrfc),
781 ipx_frame_name(intrfc->if_dlink_type));
790 * @intrfc: IPX interface receiving this packet
811 static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
842 if (*l++ == intrfc->if_netnum)
849 IPX_SKB_CB(skb)->last_hop.netnum = intrfc->if_netnum;
858 if (ifcs == intrfc)
880 static void ipxitf_insert(struct ipx_interface *intrfc)
883 list_add_tail(&intrfc->node, &ipx_interfaces);
887 ipx_primary_net = intrfc;
896 struct ipx_interface *intrfc = kmalloc(sizeof(*intrfc), GFP_ATOMIC);
898 if (intrfc) {
899 intrfc->if_dev = dev;
900 intrfc->if_netnum = netnum;
901 intrfc->if_dlink_type = dlink_type;
902 intrfc->if_dlink = dlink;
903 intrfc->if_internal = internal;
904 intrfc->if_ipx_offset = ipx_offset;
905 intrfc->if_sknum = IPX_MIN_EPHEMERAL_SOCKET;
906 INIT_HLIST_HEAD(&intrfc->if_sklist);
907 atomic_set(&intrfc->refcnt, 1);
908 spin_lock_init(&intrfc->if_sklist_lock);
911 return intrfc;
916 struct ipx_interface *intrfc;
927 intrfc = ipxitf_find_using_net(idef->ipx_network);
929 if (intrfc) {
930 ipxitf_put(intrfc);
933 intrfc = ipxitf_alloc(NULL, idef->ipx_network, 0, NULL, 1, 0);
935 if (!intrfc)
937 memcpy((char *)&(intrfc->if_node), idef->ipx_node, IPX_NODE_LEN);
938 ipx_internal_net = ipx_primary_net = intrfc;
939 ipxitf_hold(intrfc);
940 ipxitf_insert(intrfc);
942 rc = ipxitf_add_local_route(intrfc);
943 ipxitf_put(intrfc);
967 struct ipx_interface *intrfc;
979 intrfc = ipxitf_find_using_net(idef->ipx_network);
981 if (idef->ipx_network && intrfc) {
982 ipxitf_put(intrfc);
986 if (intrfc)
987 ipxitf_put(intrfc);
1036 intrfc = ipxitf_find_using_phys(dev, dlink_type);
1037 if (!intrfc) {
1039 intrfc = ipxitf_alloc(dev, idef->ipx_network, dlink_type,
1043 if (!intrfc)
1047 ipx_primary_net = intrfc;
1050 memset(intrfc->if_node, 0, IPX_NODE_LEN);
1051 memcpy(intrfc->if_node + IPX_NODE_LEN - dev->addr_len,
1054 memcpy(intrfc->if_node, idef->ipx_node, IPX_NODE_LEN);
1055 ipxitf_hold(intrfc);
1056 ipxitf_insert(intrfc);
1062 if (!intrfc->if_netnum)
1065 rc = ipxitf_add_local_route(intrfc);
1067 ipxitf_put(intrfc);
1079 struct ipx_interface *intrfc;
1102 intrfc = __ipxitf_find_using_phys(dev, dlink_type);
1104 if (!intrfc)
1106 __ipxitf_put(intrfc);
1117 struct ipx_interface *intrfc = NULL;
1135 intrfc = ipxitf_alloc(dev, 0, dlink_type, datalink, 0,
1138 if (intrfc) {
1139 memset(intrfc->if_node, 0, IPX_NODE_LEN);
1140 memcpy((char *)&(intrfc->if_node[IPX_NODE_LEN-dev->addr_len]),
1142 spin_lock_init(&intrfc->if_sklist_lock);
1143 atomic_set(&intrfc->refcnt, 1);
1144 ipxitf_insert(intrfc);
1149 return intrfc;
1293 const char *ipx_device_name(struct ipx_interface *intrfc)
1295 return intrfc->if_internal ? "Internal" :
1296 intrfc->if_dev ? intrfc->if_dev->name : "Unknown";
1411 /* caller must hold a reference to intrfc */
1413 static __be16 ipx_first_free_socketnum(struct ipx_interface *intrfc)
1415 unsigned short socketNum = intrfc->if_sknum;
1417 spin_lock_bh(&intrfc->if_sklist_lock);
1422 while (__ipxitf_find_socket(intrfc, htons(socketNum)))
1428 spin_unlock_bh(&intrfc->if_sklist_lock);
1429 intrfc->if_sknum = socketNum;
1438 struct ipx_interface *intrfc;
1445 intrfc = ipxitf_find_using_net(addr->sipx_network);
1447 if (!intrfc)
1451 addr->sipx_port = ipx_first_free_socketnum(intrfc);
1466 if (intrfc == ipx_internal_net) {
1476 memcpy(ipxs->node, intrfc->if_node, IPX_NODE_LEN);
1481 if (ipxitf_find_internal_socket(intrfc, ipxs->node,
1494 memcpy(ipxs->node, intrfc->if_node, IPX_NODE_LEN);
1497 if (ipxitf_find_socket(intrfc, addr->sipx_port)) {
1511 if (ipxitf_find_socket(intrfc, addr->sipx_port)) {
1519 ipxitf_insert_socket(intrfc, sk);
1524 ipxitf_put(intrfc);
1554 if (!ipxs->intrfc)
1556 memcpy(uaddr.sipx_node, ipxs->intrfc->if_node,
1612 if (ipxs->intrfc) {
1613 sipx.sipx_network = ipxs->intrfc->if_netnum;
1617 memcpy(sipx.sipx_node, ipxs->intrfc->if_node,
1642 struct ipx_interface *intrfc;
1674 intrfc = ipxitf_find_using_phys(dev, pt->type);
1675 if (!intrfc) {
1678 intrfc = ipxitf_auto_create(dev, pt->type);
1679 if (intrfc)
1680 ipxitf_hold(intrfc);
1683 if (!intrfc) /* Not one of ours */
1688 rc = ipxitf_rcv(intrfc, skb);
1689 ipxitf_put(intrfc);
1725 if (!ipxs->intrfc)
1727 memcpy(uaddr.sipx_node, ipxs->intrfc->if_node,
1781 if (!ipxs->intrfc)
1783 memcpy(uaddr.sipx_node, ipxs->intrfc->if_node, IPX_NODE_LEN);