FreeBSD iscsi target

2014-06-27 Thread Sreenivasa Honnur
Does freebsd iscsi target supports:
1. ACL (access control lists)
2. iSNS 
3. Multiple connections per session
4. Dynamic Lun allocation/resize
5. Target redirection

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


m_get_tag returns same tag address when called multiple times

2014-05-14 Thread Sreenivasa Honnur
Hi,
In FreeBSd-11 Current i am seeing that m_tag_get() returns same tag address for 
two subsequent calls, and m_tag_find() results in panic with below stack trace. 
Anything wrong here?

Fatal trap 9: general protection fault while in kernel mode
cpuid = 4; apic id = 04
instruction pointer = 0x20:0x80959ff0
stack pointer   = 0x28:0xfe01acfa09a0
frame pointer   = 0x28:0xfe01acfa09d0
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 12 (irq277: t5nex0:0,5)
[ thread pid 12 tid 100128 ]
Stopped at  m_tag_locate+0x40:  cmpl%ebx,0xc(%rcx)

Here is the calling sequence;

1. get_mbuf_mtag: m:0xf8005b3e4c00 mtag:0xf8002c47d180

2. get_mbuf_mtag: m:0xf8005b3e5000 mtag:0xf8002c47d180

3. find_mbuf_mtag(0xf8005b3e4c00) results in above trace.

Note that the same code works fine in FBSD-9.1.

struct my_mbuf_cb * get_mbuf_mtag(struct mbuf *m)
{
struct m_tag*mtag;

mtag = m_tag_get(PACKET_TAG_PF, sizeof(struct my_mbuf_cb), M_NOWAIT);
if (mtag == NULL) {
os_log_info(Error allocating mtag\n,);
return (NULL);
}
bzero(mtag + 1, sizeof(struct my_mbuf_cb));
m_tag_prepend(m, mtag);
 
return ((struct my_mbuf_cb *)(mtag + 1));
}

static struct my_mbuf_cb * find_mbuf_mtag(struct mbuf *m)
{
struct m_tag*mtag;

if ((mtag = m_tag_find(m, PACKET_TAG_PF, NULL)) == NULL)
return (NULL);

return ((struct my_mbuf_cb *)(mtag + 1));
}

Thanks
Sreenivas
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


RE: IPv6 - sobind fails with 49

2013-06-27 Thread Sreenivasa Honnur
I am writing a kernel socket program which binds to a IPv6 address, so bind 
always fails with 49. Below is the code snippet I am using, is something wrong 
here?



roundhay# uname -a

FreeBSD roundhay 9.1-RELEASE FreeBSD 9.1-RELEASE #2: Mon Apr  8 16:15:06 IST 
2013 
root@roundhay:/usr/obj/home/freebsd.org/sys/TOEDmailto:root@roundhay:/usr/obj/home/freebsd.org/sys/TOED
  amd64



Ifconfig/ping6 output:

==

cxgbe1: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 1500


options=6c07bbRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6

ether 00:07:43:11:89:88

inet6 2010::102 prefixlen 64

inet6 fe80::207:43ff:fe11:8988%cxgbe1 prefixlen 64 scopeid 0xd

inet6 fe80::1%cxgbe1 prefixlen 64 scopeid 0xd

nd6 options=21PERFORMNUD,AUTO_LINKLOCAL

media: Ethernet 10Gbase-SR full-duplex

status: active

roundhay# ping6 2010::101

PING6(56=40+8+8 bytes) 2010::102 -- 2010::101

16 bytes from 2010::101, icmp_seq=0 hlim=64 time=0.915 ms

16 bytes from 2010::101, icmp_seq=1 hlim=64 time=0.168 ms

^C

--- 2010::101 ping6 statistics ---

2 packets transmitted, 2 packets received, 0.0% packet loss

round-trip min/avg/max/std-dev = 0.168/0.541/0.915/0.374 ms





Code:

struct sockaddr_in6 saddr6;

rv = socreate(AF_INET6, sock, SOCK_STREAM, IPPROTO_TCP,

td-td_ucred, td);



if (rv != 0) {

printf(sock create ipv6 %s failed %d.\n,

tbuf, rv);

return NULL;

}



saddr6.sin6_family = AF_INET6;

rv = inet_pton(AF_INET6, 2010::102, saddr6.sin6_addr); == 
returns 1, which indicates it's a valid IPV6 address

printf(inet_pton retunred:%d\n, rv);



saddr6.sin6_port = htons(3260);

saddr6.sin6_len = sizeof(saddr6);



rv = sobind(sock, (struct sockaddr *)saddr6, td); == fails 
with return value of 49



___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


IPv6 bind fails with 49 (#define EADDRNOTAVAIL 49 /* Can't assign requested address */)

2013-04-18 Thread Sreenivasa Honnur
I have a ipv6 interface(ping6 to a remove ipv6 works) when I try to bind to 
this address through a socket program sobind fails with 49 as return value. 
If I give saddr6.sin6_addr =  in6addr_any; sobind works.

Any idea what could be going wrong here? 

roundhay# ifconfig cxgbe1
cxgbe1: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 1500

options=6c07bbRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6
ether 00:07:43:11:89:88
inet6 2010::102 prefixlen 64
inet6 fe80::207:43ff:fe11:8988%cxgbe1 prefixlen 64 scopeid 0xd
nd6 options=21PERFORMNUD,AUTO_LINKLOCAL
media: Ethernet 10Gbase-SR full-duplex
status: active
roundhay# ping6 2010::101
PING6(56=40+8+8 bytes) 2010::102 -- 2010::101
16 bytes from 2010::101, icmp_seq=0 hlim=64 time=0.950 ms
16 bytes from 2010::101, icmp_seq=1 hlim=64 time=0.158 ms
^C
--- 2010::101 ping6 statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.158/0.554/0.950/0.396 ms



Code:
=
{
rv = socreate(AF_INET6, sock, SOCK_STREAM, IPPROTO_TCP,
td-td_ucred, td);

if (rv != 0) {
os_log_error(sock create ipv6 %s failed %d.\n,
tbuf, rv);
return NULL;
}

family = saddr6.sin6_family = AF_INET6;
inet_pton(AF_INET6, 2010::102, saddr6.sin6_addr);
saddr6.sin6_port = htons(ep-port);
saddr6.sin6_len = sizeof(struct sockaddr_in6);

rv = sobind(sock, (struct sockaddr *)saddr6, td);
}


Here is the code snippet from where EADDRNOTAVAIL  is returned.

File : netinet6/in6_pcb.c

in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
struct ucred *cred)
{
……..
……..

} else if (!IN6_IS_ADDR_UNSPECIFIED(sin6-sin6_addr)) {
struct ifaddr *ifa;

sin6-sin6_port = 0;/* yech... */
if ((ifa = ifa_ifwithaddr((struct sockaddr *)sin6)) ==
NULL 
(inp-inp_flags  INP_BINDANY) == 0) {
return (EADDRNOTAVAIL);  it fails here since 
ifa_ifwithaddr() returns NULL
}
……..
……..

}

File: net/if.c
struct ifaddr *
ifa_ifwithaddr(struct sockaddr *addr)
{

return (ifa_ifwithaddr_internal(addr, 1));
}

ifa_ifwithaddr_internal(struct sockaddr *addr, int getref)
{
……..
……..

TAILQ_FOREACH(ifp, V_ifnet, if_link) {
IF_ADDR_RLOCK(ifp);
printf(ifp-xname:%s ifp-dname:%s\n,ifp-if_xname, 
ifp-if_dname);
TAILQ_FOREACH(ifa, ifp-if_addrhead, ifa_link) {
if (ifa-ifa_addr-sa_family != addr-sa_family)   
ifa-ifa_addr-sa_family=18  addr-sa_family=28. Even though the interface is 
in IPV6 mode its sa_family is not  set properly, 
continue;
}
Ifa = NULL;
……..
……..

}

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org